This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
patch for bfd/dwarf2.c, problem if .debug_info section was relocated
- To: binutils@sourceware.cygnus.com
- Subject: patch for bfd/dwarf2.c, problem if .debug_info section was relocated
- From: Stephane Carrez <stcarrez@worldnet.fr>
- Date: Sun, 5 Sep 1999 10:50:16 +0200
- Cc: stcarrez@worldnet.fr
Hi!
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.
Can you integrate this patch?
Thanks,
Stephane
1999-09-05 Stephane Carrez <stcarrez@worldnet.fr>
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't abort if
the .debug_info section was relocated, print an error message.
*** gas-i386/binutils/bfd/dwarf2.c Sun Sep 5 09:49:33 1999
--- cygnus/binutils/bfd/dwarf2.c Fri Aug 6 21:36:40 1999
*************** _bfd_dwarf2_find_nearest_line (abfd, sec
*** 1516,1534 ****
return false;
}
- /* If the linker relocates some dwarf-2 sections before some others
- (.text, .data), we can't find the line of the symbol. Complain
- and pretend there is no dwarf2 info. Otherwise, the next call to
- 'bfd_get_section_size_before_reloc' will abort. This error can
- happen when the default indirect link order is used and the linker
- script indicates to relocate dwarf2 section before .text. */
- if (msec->reloc_done)
- {
- (* _bfd_error_handler)
- ("Linker error: the .debug_info section has been relocated");
- return false;
- }
-
size = bfd_get_section_size_before_reloc (msec);
if (size == 0)
return false;
--- 1516,1521 ----