aboutsummaryrefslogtreecommitdiff
path: root/ld/ldemul.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-02-02 14:40:03 -0800
committerH.J. Lu <hjl.tools@gmail.com>2022-03-09 18:23:43 -0800
commit320fdefef139160c93089a19ba41a2fcc4121203 (patch)
treed845e8df9ccc432cfb3d06d97cb6d2082a78da93 /ld/ldemul.h
parent399f9ba236fa8026ca8115cb030ee87a1408ce8b (diff)
downloadfsf-binutils-gdb-320fdefef139160c93089a19ba41a2fcc4121203.zip
fsf-binutils-gdb-320fdefef139160c93089a19ba41a2fcc4121203.tar.gz
fsf-binutils-gdb-320fdefef139160c93089a19ba41a2fcc4121203.tar.bz2
ld: Add a before_plugin_all_symbols_read hook
Add a before_plugin_all_symbols_read hook to load symbol references from DT_NEEDED entries, included from --copy-dt-needed-entries, before reading plugin symbols to properly resolve plugin symbol references. bfd/ PR ld/28849 * elf-bfd.h (elf_link_hash_table): Add handling_dt_needed. * elflink.c (_bfd_elf_merge_symbol): Don't set non_ir_ref_dynamic before plugin 'all symbols read' hook is called. ld/ PR ld/28849 * ldelf.c (ldelf_handle_dt_needed): New function. (ldelf_before_plugin_all_symbols_read): Likewise. (ldelf_after_open): Call ldelf_handle_dt_needed. * ldelf.h (ldelf_before_plugin_all_symbols_read): New. * ldemul.c (ldemul_before_plugin_all_symbols_read): Likewise. * ldemul.h (ldemul_before_plugin_all_symbols_read): Likewise. (ld_emulation_xfer_struct): Add before_plugin_all_symbols_read. * ldlang.c (lang_process): Call ldemul_before_plugin_all_symbols_read before calling plugin_call_all_symbols_read. * emultempl/elf.em (gld${EMULATION_NAME}_before_plugin_all_symbols_read): New. (LDEMUL_BEFORE_PLUGIN_ALL_SYMBOLS_READ): New. * emultempl/emulation.em (ld_${EMULATION_NAME}_emulation): Initialize the before_plugin_all_symbols_read field. * testsuite/ld-plugin/lto.exp: Run PR ld/28849 tests. * testsuite/ld-plugin/pr28849.d: New file. * testsuite/ld-plugin/pr28849a.c: Likewise. * testsuite/ld-plugin/pr28849b.c: Likewise.
Diffstat (limited to 'ld/ldemul.h')
-rw-r--r--ld/ldemul.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/ld/ldemul.h b/ld/ldemul.h
index 33e690d..16a3b69 100644
--- a/ld/ldemul.h
+++ b/ld/ldemul.h
@@ -32,6 +32,8 @@ extern void ldemul_after_parse
(void);
extern void ldemul_before_parse
(void);
+extern void ldemul_before_plugin_all_symbols_read
+ (void);
extern void ldemul_after_open
(void);
extern void ldemul_after_check_relocs
@@ -131,6 +133,9 @@ typedef struct ld_emulation_xfer_struct {
/* Run after parsing the command line and script file. */
void (*after_parse) (void);
+ /* Run before calling plugin 'all symbols read' hook. */
+ void (*before_plugin_all_symbols_read) (void);
+
/* Run after opening all input files, and loading the symbols. */
void (*after_open) (void);