From 0e6a3f07f50723d1831291492b96fdf74bcbdc11 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 22 Jul 2020 03:49:07 -0700 Subject: ld: Properly override the IR definition We change the previous definition in the IR object to undefweak only after all LTO symbols have been read. include/ PR ld/26262 PR ld/26267 * bfdlink.h (bfd_link_info): Add lto_all_symbols_read. ld/ PR ld/26262 PR ld/26267 * ldlang.c (lang_process): Set lto_all_symbols_read after all LTO IR symbols have been read. * plugin.c (plugin_notice): Override the IR definition only if all LTO IR symbols have been read or the new definition is non-weak and the the IR definition is weak * testsuite/ld-plugin/lto.exp: Run PR ld/26262 and ld/26267 tests. * testsuite/ld-plugin/pr26262a.c: New file. * testsuite/ld-plugin/pr26262b.c: Likewise. * testsuite/ld-plugin/pr26262c.c: Likewise. * testsuite/ld-plugin/pr26267.err: Likewise. * testsuite/ld-plugin/pr26267a.c: Likewise. * testsuite/ld-plugin/pr26267b.c: Likewise. * testsuite/ld-plugin/pr26267c.c: Likewise. --- include/ChangeLog | 6 ++++++ include/bfdlink.h | 3 +++ 2 files changed, 9 insertions(+) (limited to 'include') diff --git a/include/ChangeLog b/include/ChangeLog index 6a69a74..211d545 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2020-07-22 H.J. Lu + + PR ld/26262 + PR ld/26267 + * bfdlink.h (bfd_link_info): Add lto_all_symbols_read. + 2020-07-11 H.J. Lu * elf/common.h (GNU_PROPERTY_X86_FEATURE_2_TMM): New. diff --git a/include/bfdlink.h b/include/bfdlink.h index 7163433..3badfbdb 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -361,6 +361,9 @@ struct bfd_link_info /* TRUE if the LTO plugin is active. */ unsigned int lto_plugin_active: 1; + /* TRUE if all LTO IR symbols have been read. */ + unsigned int lto_all_symbols_read : 1; + /* TRUE if global symbols in discarded sections should be stripped. */ unsigned int strip_discarded: 1; -- cgit v1.1