This is the mail archive of the
mailing list for the binutils project.
Re: ld segfault on incrementally linked object
elf32-ppc.c:ppc_elf_relocate_section (and other rela targets) say this
about incremental/relocatable linking:
/* This is a relocateable link. We don't have to change
anything, unless the reloc is against a section symbol,
in which case we have to adjust according to where the
section symbol winds up in the output section. */
That's mostly right too, as the section data with the reloc will be
replaced during final link. What we have in the section doesn't
matter too much. However, dwarf1.c:_bfd_dwarf1_find_nearest_line,
which is called when the linker hits an undefined symbol, reads the
_unrelocated_ .debug data to determine which line of code referenced
the symbol. In particular, the low_pc and high_pc bounds on line
debug info are read, and need to be relocated before they can be used
Sooo, either the above quoted comment is wrong and we do need to
perform section relocations for incremental linking, or dwarf1.c
needs to relocate debug info. I don't particularly like the second
option for a number of reasons.
dwarf2.c has the same problem.