This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Problems with startup code symbols (Copious warnings)
On Wed, 2006-06-14 at 17:12 -0700, Jim Blandy wrote:
[...]
> /* When using the GNU linker, .gnu.linkonce. sections are used to
> eliminate duplicate copies of functions and vtables and such.
> The linker will arbitrarily choose one and discard the others.
> The AT_*_pc values for such functions refer to local labels in
> these sections. If the section from that file was discarded, the
> labels are not in the output, so the relocs get a value of 0.
> If this is a discarded function, mark the pc bounds as invalid,
> so that GDB will ignore it. */
> if (low == 0 && (bfd_get_file_flags (obfd) & HAS_RELOC) == 0)
> return 0;
>
> (Linkonce sections are a crock: if a section of code is discarded, the
> debug info should be discarded along with it, but there's no way to do
> that with linkonce sections.) But in your case, you really have a
> compilation unit at address zero.
[...]
> If anyone can see a way to handle discarded linkonce sections better,
> I'd love to hear it.
What about looking at section VMAs? If one loadable section has a VMA of
0 then we can't discard debug info with low_pc == 0. If no section lives
at address 0 then low_pc == 0 implies that the relocations for this
info couldn't be applied because the code has vanished.
I'm sure I missed somethnig in the general case, but I've added
something like this as a post-load pass in a target_so_ops I implemented
some time ago and it worked well.
Fred.