Define __start/__stop symbols when there is only a dynamic def
authorAlan Modra <amodra@gmail.com>
Tue, 23 Jan 2018 00:20:02 +0000 (10:50 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 26 Jan 2018 03:22:07 +0000 (13:52 +1030)
This patch fixes a case where a user had a C-representable named
section in both the executable and shared libraries, and of course
wanted the size of the local section in the executable, not the
dynamic section.  It does mean that __start and __stop symbols don't
behave exactly like PROVIDEd symbols, but I think that's a reasonable
difference particularly since this is the way they used to behave.

* elflink.c (bfd_elf_define_start_stop): Override symbols when
they are defined dynamically.

bfd/ChangeLog
bfd/elflink.c

index 4ad0127b21315a3ce28758cb1f7c81b9050229e8..2eb4916ce68a404badd508c312387823a8bd5dba 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-26  Alan Modra  <amodra@gmail.com>
+
+       * elflink.c (bfd_elf_define_start_stop): Override symbols when
+       they are defined dynamically.
+
 2018-01-26  Alan Modra  <amodra@gmail.com>
 
        * elf64-ppc.c (ppc64_elf_size_stubs): Iterate sizing when
index e3751fa122cf936a3c277ddd36631a5b0d2647f2..e81f6c6d820e2b9a536b9ec0a6ff4907dfdc0124 100644 (file)
@@ -14338,7 +14338,7 @@ bfd_elf_define_start_stop (struct bfd_link_info *info,
   if (h != NULL
       && (h->root.type == bfd_link_hash_undefined
          || h->root.type == bfd_link_hash_undefweak
-         || (h->ref_regular && !h->def_regular)))
+         || ((h->ref_regular || h->def_dynamic) && !h->def_regular)))
     {
       h->root.type = bfd_link_hash_defined;
       h->root.u.def.section = sec;
This page took 0.03322 seconds and 4 git commands to generate.