Don't compress empty debug sections.
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 18 Jan 2011 18:55:59 +0000 (18:55 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 18 Jan 2011 18:55:59 +0000 (18:55 +0000)
gas/

2011-01-18  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/12409
* write.c (compress_debug): Return if section size is 0.

gas/testsuite/

2011-01-18  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/12409
* gas/elf/dwarf2-4.d: New.
* gas/elf/dwarf2-4.s: Likewise.

gas/ChangeLog
gas/testsuite/ChangeLog
gas/testsuite/gas/elf/dwarf2-4.d [new file with mode: 0644]
gas/testsuite/gas/elf/dwarf2-4.s [new file with mode: 0644]
gas/testsuite/gas/elf/elf.exp
gas/write.c

index 30d7609c722ee94fc09a222628e988dbbdee9b30..bb47e720f82a0ff3a87f254a5a9758fda6be69f0 100644 (file)
@@ -1,3 +1,8 @@
+2011-01-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/12409
+       * write.c (compress_debug): Return if section size is 0.
+
 2011-01-18  Mingfeng Wu  <mingfeng@faraday-tech.com>
 
        * config/tc-arm.c (arm_cpus): Add Faraday ARMv5TE compatible
index 26a1addbbc29a4dfa1e2b41fec3619e02eb45889..2fc1b36bc742480c596d05bc9671873e70f58906 100644 (file)
@@ -1,3 +1,11 @@
+2011-01-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/12409
+       * gas/elf/dwarf2-4.d: New.
+       * gas/elf/dwarf2-4.s: Likewise.
+
+       * gas/elf/elf.exp: Run dwarf2-4.
+
 2011-01-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gas/i386/intel.d: Updated.
diff --git a/gas/testsuite/gas/elf/dwarf2-4.d b/gas/testsuite/gas/elf/dwarf2-4.d
new file mode 100644 (file)
index 0000000..39e0326
--- /dev/null
@@ -0,0 +1,12 @@
+#as:  --compress-debug-sections
+#readelf: -w
+#name: DWARF2 4
+#not-target: ia64-*-*
+
+Contents of the .[z]?debug_abbrev section:
+
+
+
+Section '.debug_info' has no debugging data.
+
+Section '.debug_line' has no debugging data.
diff --git a/gas/testsuite/gas/elf/dwarf2-4.s b/gas/testsuite/gas/elf/dwarf2-4.s
new file mode 100644 (file)
index 0000000..eeb4ace
--- /dev/null
@@ -0,0 +1,12 @@
+       .file   "__dn_comp.c"
+       .section        .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+       .section        .debug_info,"",@progbits
+.Ldebug_info0:
+       .section        .debug_line,"",@progbits
+.Ldebug_line0:
+       .text
+.Ltext0:
+.Letext0:
+       .section        .debug_abbrev
+       .byte   0x0
index 7f86266e11cd17d5b95431b56b322ff94d39acba..382815124726951cb4d999b2876ef4f3c95eb74c 100644 (file)
@@ -178,5 +178,6 @@ if { ([istarget "*-*-*elf*"]
     run_dump_test "dwarf2-1"
     run_dump_test "dwarf2-2"
     run_dump_test "dwarf2-3"
+    run_dump_test "dwarf2-4"
     run_dump_test "bad-section-flag"
 }
index 018800e0750ba05be3c0335086e86372fed20f52..aabb96d236c569ce929aa7c1f9d47daf1ba95b4b 100644 (file)
@@ -1359,6 +1359,7 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
   flagword flags = bfd_get_section_flags (abfd, sec);
 
   if (seginfo == NULL
+      || sec->size == 0
       || (flags & (SEC_ALLOC | SEC_HAS_CONTENTS)) == SEC_ALLOC)
     return;