]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
DWARF LTO debug sections vs. .stabstr
authorAlan Modra <amodra@gmail.com>
Fri, 19 Mar 2021 23:52:37 +0000 (10:22 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 20 Mar 2021 00:05:18 +0000 (10:35 +1030)
The exception for debug sections in clearing SEC_EXCLUDE when
relocatable was really for one specific debug section, so let's make
it do just that.

bfd/
PR 27590
* elf.c (_bfd_elf_make_section_from_shdr): Remove SHF_EXCLUDE
test for .gnu.debuglto*.
ld/
PR 27590
* ldlang.c (lang_gc_sections): Clear SEC_EXCLUDE when relocatable
for all sections except .stabstr.

bfd/ChangeLog
bfd/elf.c
ld/ChangeLog
ld/ldlang.c

index 2e43a4d784d368f547fde24e5d332d6da7f4cd62..90ec96bacbf60b6908cf0b2c43e2ffa28417a0bd 100644 (file)
@@ -1,7 +1,13 @@
+2021-03-20  Alan Modra  <amodra@gmail.com>
+
+       PR 27590
+       * elf.c (_bfd_elf_make_section_from_shdr): Remove SHF_EXCLUDE
+       test for .gnu.debuglto*.
+
 2021-03-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/27590
-       * elf.c (_bfd_elf_make_section_from_shdr): Treate
+       * elf.c (_bfd_elf_make_section_from_shdr): Treat
        .gnu.debuglto_.debug_ section as debugging section unless it is
        marked with SHF_EXCLUDE.
        * elflink.c (elf_create_symbuf): Revert commit 994b2513281.
index 7bd12dfbf37be4ca22304fa10729aa258000334f..381951da12cc6ee865a2396e7fe9a61b4989eda1 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1085,10 +1085,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
       if (name [0] == '.')
        {
          if (strncmp (name, ".debug", 6) == 0
-             /* NB: Treate .gnu.debuglto_.debug_ section as debugging
-                section unless it is marked with SHF_EXCLUDE.  */
-             || ((flags & SEC_EXCLUDE) == 0
-                 && strncmp (name, ".gnu.debuglto_.debug_", 21) == 0)
+             || strncmp (name, ".gnu.debuglto_.debug_", 21) == 0
              || strncmp (name, ".gnu.linkonce.wi.", 17) == 0
              || strncmp (name, ".zdebug", 7) == 0)
            flags |= SEC_DEBUGGING | SEC_ELF_OCTETS;
index 8489a9db5e531018144e579132de012b89586886..0be65fc38866d82f91169373ac4e364bf6e44935 100644 (file)
@@ -1,3 +1,9 @@
+2021-03-20  Alan Modra  <amodra@gmail.com>
+
+       PR 27590
+       * ldlang.c (lang_gc_sections): Clear SEC_EXCLUDE when relocatable
+       for all sections except .stabstr.
+
 2021-03-19  Alan Modra  <amodra@gmail.com>
 
        PR 27590
index 684e1d23a214cfcbfb85588b81baf0b7660b3d6c..df8a5d17acacb7bdc31a1c8f27973f1e2e1d87d2 100644 (file)
@@ -7565,7 +7565,7 @@ lang_gc_sections (void)
   lang_gc_sections_1 (statement_list.head);
 
   /* SEC_EXCLUDE is ignored when doing a relocatable link, except in
-     the special case of debug info.  (See bfd/stabs.c)
+     the special case of .stabstr debug info.  (See bfd/stabs.c)
      Twiddle the flag here, to simplify later linker code.  */
   if (bfd_link_relocatable (&link_info))
     {
@@ -7577,7 +7577,8 @@ lang_gc_sections (void)
            continue;
 #endif
          for (sec = f->the_bfd->sections; sec != NULL; sec = sec->next)
-           if ((sec->flags & SEC_DEBUGGING) == 0)
+           if ((sec->flags & SEC_DEBUGGING) == 0
+               || strcmp (sec->name, ".stabstr") != 0)
              sec->flags &= ~SEC_EXCLUDE;
        }
     }