aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-07-04 06:27:58 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-07-04 06:29:13 -0700
commit94d401b8b88a76b1372ce44e805516756a4f737b (patch)
tree62f580d5a657896a602fad555ea6b11c7cdc48fa /ld/ldlang.c
parentb14b7ff14ffe911ec562004304841cf7d2775a19 (diff)
downloadgdb-94d401b8b88a76b1372ce44e805516756a4f737b.zip
gdb-94d401b8b88a76b1372ce44e805516756a4f737b.tar.gz
gdb-94d401b8b88a76b1372ce44e805516756a4f737b.tar.bz2
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.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 21ef9be..350baf2 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -3413,6 +3413,7 @@ insert_undefined (const char *name)
{
h->type = bfd_link_hash_undefined;
h->u.undef.abfd = NULL;
+ h->non_ir_ref_regular = TRUE;
if (is_elf_hash_table (link_info.hash))
((struct elf_link_hash_entry *) h)->mark = 1;
bfd_link_add_undef (link_info.hash, h);