summaryrefslogtreecommitdiff
path: root/gas/dwarf2dbg.c
diff options
context:
space:
mode:
Diffstat (limited to 'gas/dwarf2dbg.c')
-rw-r--r--gas/dwarf2dbg.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index b27652c9f9d..0f459a54de5 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -1248,8 +1248,15 @@ dwarf2_finish ()
segT line_seg;
struct line_seg *s;
- /* If no debug information was recorded, nothing to do. */
- if (all_segs == NULL && files_in_use <= 1)
+ /* We don't need to do anything unless:
+ - Some debug information was recorded via .file/.loc
+ - or, we are generating DWARF2 information ourself (--gdwarf2)
+ - or, there is a user-provided .debug_info section which could
+ reference the file table in the .debug_line section we generate
+ below. */
+ if (all_segs == NULL
+ && debug_type != DEBUG_DWARF2
+ && bfd_get_section_by_name (stdoutput, ".debug_info") == NULL)
return;
/* Calculate the size of an address for the target machine. */