diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2010-07-05 15:07:20 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2010-07-05 15:07:20 +0000 |
commit | df1c40a732c509d6729b2874d7e08987b7815490 (patch) | |
tree | efa004eff372ae9b16ed80de22e5ed266991a72a /gas/dwarf2dbg.c | |
parent | 5b9144488e69022bcaba2ed410ac777ed22272c2 (diff) | |
download | gdb-df1c40a732c509d6729b2874d7e08987b7815490.zip gdb-df1c40a732c509d6729b2874d7e08987b7815490.tar.gz gdb-df1c40a732c509d6729b2874d7e08987b7815490.tar.bz2 |
Don't generate .debug_line section if it isn't empty.
binutils/testsuite/
2010-07-05 H.J. Lu <hongjiu.lu@intel.com>
PR gas/10531
PR gas/11789
* binutils-all/objdump.W: Remove bogus line debug info.
gas/
2010-07-05 Jim Wilson <wilson@codesourcery.com>
PR gas/10531
PR gas/11789
* dwarf2dbg.c (dwarf2_finish): Don't generate .debug_line section
if it isn't empty.
gas/testsuite/
2010-07-05 H.J. Lu <hongjiu.lu@intel.com>
PR gas/10531
PR gas/11789
* gas/i386/dw2-compress-1.d: Remove bogus line debug info.
* gas/elf/dwarf2-1.d: New.
* gas/elf/dwarf2-1.s: Likewise.
* gas/elf/dwarf2-2.d: Likewise.
* gas/elf/dwarf2-2.s: Likewise.
* gas/elf/dwarf2-3.d: Likewise.
* gas/elf/dwarf2-3.s: Likewise.
* gas/i386/debug1.d: Likewise.
* gas/i386/debug1.s: Likewise.
* gas/elf/elf.exp: Run dwarf2-1, dwarf2-2 and dwarf2-3.
* gas/i386/i386.exp: Run debug1 for both 32bit and 64bit.
Diffstat (limited to 'gas/dwarf2dbg.c')
-rw-r--r-- | gas/dwarf2dbg.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 4061c72..85c1f30 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -1718,11 +1718,12 @@ dwarf2_init (void) /* Finish the dwarf2 debug sections. We emit .debug.line if there were any .file/.loc directives, or --gdwarf2 was given, or if the - file has a non-empty .debug_info section. If we emit .debug_line, - and the .debug_info section is empty, we also emit .debug_info, - .debug_aranges and .debug_abbrev. ALL_SEGS will be non-null if - there were any .file/.loc directives, or --gdwarf2 was given and - there were any located instructions emitted. */ + file has a non-empty .debug_info section and an empty .debug_line + section. If we emit .debug_line, and the .debug_info section is + empty, we also emit .debug_info, .debug_aranges and .debug_abbrev. + ALL_SEGS will be non-null if there were any .file/.loc directives, + or --gdwarf2 was given and there were any located instructions + emitted. */ void dwarf2_finish (void) @@ -1731,13 +1732,24 @@ dwarf2_finish (void) struct line_seg *s; segT info_seg; int emit_other_sections = 0; + int empty_debug_line = 0; info_seg = bfd_get_section_by_name (stdoutput, ".debug_info"); emit_other_sections = info_seg == NULL || !seg_not_empty_p (info_seg); - if (!all_segs && emit_other_sections) - /* There is no line information and no non-empty .debug_info - section. */ + line_seg = bfd_get_section_by_name (stdoutput, ".debug_line"); + empty_debug_line = line_seg == NULL || !seg_not_empty_p (line_seg); + + /* We can't construct a new debug_line section if we already have one. + Give an error. */ + if (all_segs && !empty_debug_line) + as_fatal ("duplicate .debug_line sections"); + + if ((!all_segs && emit_other_sections) + || (!emit_other_sections && !empty_debug_line)) + /* If there is no line information and no non-empty .debug_info + section, or if there is both a non-empty .debug_info and a non-empty + .debug_line, then we do nothing. */ return; /* Calculate the size of an address for the target machine. */ |