is_relocatable_executable --exclude-libs failure
authorAlan Modra <amodra@gmail.com>
Tue, 5 Jan 2021 12:21:42 +0000 (22:51 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 5 Jan 2021 12:39:04 +0000 (23:09 +1030)
--exclude-libs makes symbols hidden, but that doesn't prevent them
being made dynamic for is_relocatable_executable targets.  Fix that.

* elflink.c (bfd_elf_link_record_dynamic_symbol): Handle no_export
for relocatable executable.

bfd/ChangeLog
bfd/elflink.c

index 4eda3a1e57ecbc75a51bc963ef2476e033ef16b5..6c050b1c1996ebfc6eecd6d77f5b4650cf0d918d 100644 (file)
@@ -1,3 +1,8 @@
+2021-01-05  Alan Modra  <amodra@gmail.com>
+
+       * elflink.c (bfd_elf_link_record_dynamic_symbol): Handle no_export
+       for relocatable executable.
+
 2021-01-05  Alan Modra  <amodra@gmail.com>
 
        * vms-alpha.c (_bfd_vms_slurp_egsd): Read flags after size check.
index df5b997cf0089b515dc97a215671c5a8edbf5335..4c54b1a1591ee72ee72a658f7d7abde6e301ad5d 100644 (file)
@@ -534,7 +534,12 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
              && h->root.type != bfd_link_hash_undefweak)
            {
              h->forced_local = 1;
-             if (!elf_hash_table (info)->is_relocatable_executable)
+             if (!elf_hash_table (info)->is_relocatable_executable
+                 || ((h->root.type == bfd_link_hash_defined
+                      || h->root.type == bfd_link_hash_defweak)
+                     && h->root.u.def.section->owner->no_export)
+                 || (h->root.type == bfd_link_hash_common
+                     && h->root.u.c.p->section->owner->no_export))
                return TRUE;
            }