From 94d401b8b88a76b1372ce44e805516756a4f737b Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 4 Jul 2018 06:27:58 -0700 Subject: ld: Set non_ir_ref_regular for --undefined SYMBOL Set non_ir_ref_regular to TRUE for symbols forced into the output file so that they won't be removed by garbage collection with LTO. PR ld/23309 * ldlang.c (insert_undefined): Set non_ir_ref_regular to TRUE. * plugin.c (is_visible_from_outside): Don't scan entry_symbol. * testsuite/ld-plugin/pr23309.c: New file. * testsuite/ld-plugin/pr23309.d: Likewise. --- ld/plugin.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'ld/plugin.c') diff --git a/ld/plugin.c b/ld/plugin.c index 78f2e04..994eb6b 100644 --- a/ld/plugin.c +++ b/ld/plugin.c @@ -625,8 +625,6 @@ static inline bfd_boolean is_visible_from_outside (struct ld_plugin_symbol *lsym, struct bfd_link_hash_entry *blhe) { - struct bfd_sym_chain *sym; - if (bfd_link_relocatable (&link_info)) return TRUE; if (blhe->non_ir_ref_dynamic @@ -658,11 +656,6 @@ is_visible_from_outside (struct ld_plugin_symbol *lsym, || lsym->visibility == LDPV_PROTECTED); } - for (sym = &entry_symbol; sym != NULL; sym = sym->next) - if (sym->name - && strcmp (sym->name, blhe->root.string) == 0) - return TRUE; - return FALSE; } -- cgit v1.1