]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add the SEC_ELF_OCTETS flag to debug sections created by the assembler.
authorTucker <tuckkern@sourceware@gmail.com>
Mon, 12 Jul 2021 16:12:13 +0000 (17:12 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 12 Jul 2021 16:12:13 +0000 (17:12 +0100)
PR 28054
gas * config/obj-elf.c (obj_elf_change_section): Set the
SEF_ELF_OCTETS flag on debug sections.

gas/ChangeLog
gas/config/obj-elf.c

index 0bcf9ffb93a588a39a05b8fb2f2e18a0186c37f8..432506baf57aef0514833d27f6457cfeb85bfbe9 100644 (file)
@@ -1,3 +1,9 @@
+2021-07-12  Tucker  <tuckkern@sourceware@gmail.com>
+
+       PR 28054
+       * config/obj-elf.c (obj_elf_change_section): Set the
+       SEF_ELF_OCTETS flag on debug sections.
+
 2021-06-07  Andreas Krebbel  <krebbel@linux.ibm.com>
 
        * testsuite/gas/s390/zarch-arch14.d: Add qpaci.
index e93d59cb081c1ac180dc72d6c226cad4bac44f6c..42a3851e7722d15bd69f870a40b352ed592186f8 100644 (file)
@@ -743,6 +743,22 @@ obj_elf_change_section (const char *name,
   if (linkonce)
     flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
 
+  /* PR 28054: Set the SEC_ELF_OCTETS flag for debugging sections.
+     Based on the code in bfd/elf.c:_bfd_elf_make_section_from_shdr().
+
+     FIXME: We do not set the SEC_DEBUGGING flag because that causes
+     problems for the FT32 and MSP430 targets.  Investigate and fix.  */
+  if ((flags & SEC_ALLOC) == 0 && name [0] == '.')
+    {
+      if (   startswith (name, ".debug")
+         || startswith (name, ".zdebug")
+         || startswith (name, ".gnu.debuglto_.debug_")
+         || startswith (name, ".gnu.linkonce.wi.")
+         || startswith (name, GNU_BUILD_ATTRS_SECTION_NAME)
+         || startswith (name, ".note.gnu"))
+       flags |= SEC_ELF_OCTETS;
+    }
+  
   if (old_sec == NULL)
     {
       symbolS *secsym;