aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/ldlang.c13
2 files changed, 19 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 8739286..2347f9a 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,11 @@
2021-03-01 Alan Modra <amodra@gmail.com>
+ * ldlang.c (undef_start_stop): For ELF make undefined start/stop
+ symbols undefweak if that was how they were referenced. Undo
+ dynamic state too.
+
+2021-03-01 Alan Modra <amodra@gmail.com>
+
* testsuite/ld-elf/pr25708.d: Add --with-symbol-versions to nm.
* testsuite/ld-elf/pr27128a.d: Likewise.
* testsuite/ld-elf/pr27128b.d: Likewise.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 5ffc844..a77e8fa 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -6808,6 +6808,19 @@ undef_start_stop (struct bfd_link_hash_entry *h)
}
h->type = bfd_link_hash_undefined;
h->u.undef.abfd = NULL;
+ if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour)
+ {
+ const struct elf_backend_data *bed;
+ struct elf_link_hash_entry *eh = (struct elf_link_hash_entry *) h;
+ unsigned int was_forced = eh->forced_local;
+
+ bed = get_elf_backend_data (link_info.output_bfd);
+ (*bed->elf_backend_hide_symbol) (&link_info, eh, TRUE);
+ if (!eh->ref_regular_nonweak)
+ h->type = bfd_link_hash_undefweak;
+ eh->def_regular = 0;
+ eh->forced_local = was_forced;
+ }
}
}