Ignore symbols defined in SHF_EXCLUDE sections
authorAlan Modra <amodra@gmail.com>
Fri, 26 Aug 2016 12:31:15 +0000 (22:01 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 31 Aug 2016 09:52:43 +0000 (19:22 +0930)
PR 20513
* ldlang.c (section_already_linked): Deal with SHF_EXCLUDE sections.

ld/ChangeLog
ld/ldlang.c

index 83fbe7c3379a9be8557b0efedc85e8f3f1b9fced..9ad7417b73e093817554e5815ab831aa13284414 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-31  Alan Modra  <amodra@gmail.com>
+
+       PR 20513
+       * ldlang.c (section_already_linked): Deal with SHF_EXCLUDE sections.
+
 2016-08-31  Alan Modra  <amodra@gmail.com>
 
        * testsuite/ld-powerpc/vle-multiseg-1.d: Adjust to suit segment change.
index aee87207773d5cad72601f71d6b98a5d083b4ee6..07c218214d349098d89910d7e7195663b0262a0f 100644 (file)
@@ -2294,6 +2294,12 @@ section_already_linked (bfd *abfd, asection *sec, void *data)
       return;
     }
 
+  /* Deal with SHF_EXCLUDE ELF sections.  */
+  if (!bfd_link_relocatable (&link_info)
+      && (abfd->flags & BFD_PLUGIN) == 0
+      && (sec->flags & (SEC_GROUP | SEC_KEEP | SEC_EXCLUDE)) == SEC_EXCLUDE)
+    sec->output_section = bfd_abs_section_ptr;
+
   if (!(abfd->flags & DYNAMIC))
     bfd_section_already_linked (abfd, sec, &link_info);
 }