patch for bfd/dwarf2.c, problem if .debug_info section was relocated

Ian Lance Taylor ian@zembu.com
Sun Feb 27 19:41:00 GMT 2000


   Date: Tue, 22 Feb 2000 21:40:28 +0100
   From: Stephane Carrez <Stephane.Carrez@worldnet.fr>

   I've found a small problem in bfd/dwarf2.c. If I wrote a linker
   script that had all the *(.debug_info) sections at beginning, and I had
   some undefined symbols during the link, the linker would abort without
   any message.

   If I write such bad linker script, the .debug_info sections gets relocated
   before the undefined symbols are reported. In bfd/dwarf2.c, we call
   'bfd_get_section_size_before_reloc' which aborts.

   I propose the following fix that checks this situation before aborting
   and print an error message. We also don't need to abort: in that case
   the dwarf-2 debugging info can simply be ignored. The linker will print
   the undefined symbol without the file/line information.

I checked in a different patch: to just use _raw_size rather than
bfd_get_section_size_before_reloc.

The dwarf2 code always wants the size of the section in the input BFD.
It doesn't care about the relocated size, and it doesn't care about
what happens to the section during the linking process.  It was a bug
for the code to call bfd_get_section_size_before_reloc.

Ian


More information about the Binutils mailing list