https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125899
Bug ID: 125899
Summary: crtstuff.c without debug information
Product: gcc
Version: 16.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcc
Assignee: unassigned at gcc dot gnu.org
Reporter: rdiez-2006 at rd10 dot de
Target Milestone: ---
I am building a cross-compiler toolchain for an embedded ARM target, see here:
https://github.com/rdiez/DebugDue/tree/master/Toolchain
I recently had to debug an issue on start-up, and GDB got confused and showed
me the wrong source code lines. At least part of the reason is probably that
crtstuff.c is apparently compiled without debugging information. This is the
related line in libgcc/Makefile.in:
# Options to use when compiling crtbegin/end.
CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
$(NO_PIE_CFLAGS) -finhibit-size-directive -fno-inline -fno-exceptions \
-fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
-fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \
$(INHIBIT_LIBC_CFLAGS) $(USE_TM_CLONE_REGISTRY)
Note the -g0 flag.
Debugging embedded start-up code is hard enough. Please do not disable debug
information for crtstuff.c , or at least add a comment next to that line
explaining why that is necessary.