[Bug symtab/34464] GCC binaries in -fPIE -ffunction-sections --gc-sections have DWARF subprograms overlapping main, breaking function resolution
tromey at sourceware dot org via Gdb-prs <[email protected]> Thu, 30 Jul 2026 18:33:55 +0000
| Newsgroups | gmane.comp.gdb.bugs.discuss |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://sourceware.org/bugzilla/show_bug.cgi?id=3D34464
--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to nyanpasu64 from comment #3)
> Bug 13415 references a gdb comment saying that gdb/dwarf2/read.c
> #lnp_state_machine::check_line_address already checks for GC'd functions =
at
> 0, -1, or -2. Apparently this check isn't working here?
I suspect the reason is that this ELF has a section at zero:
$ readelf -WS sys-ftpd.elf
...
[ 1] .text PROGBITS 0000000000000000 010000 032af0 00 =
AX=20
0 0 64
This means that a symbol with PC=3D0 might be valid, so gdb's DWARF reader
skips the GC function stuff in this case. E.g.
if ((bfd_section_flags (sectp) & (SEC_LOAD | SEC_ALLOC))
&& bfd_section_vma (sectp) =3D=3D 0)
this->has_section_at_zero =3D true;
Though I see that lnp_state_machine::check_line_address doesn't actually
check this flag... but other things do.
--=20
You are receiving this mail because:
You are on the CC list for the bug.=