binutils-gdb/ld/emultempl
H.J. Lu 320fdefef1 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.
2022-03-09 18:23:43 -08:00
..
aarch64elf.em
aix.em ld: Add emultempl/emulation.em 2022-02-06 06:25:41 -08:00
alphaelf.em
arclinux.em
armelf.em
astring.sed
avrelf.em
beos.em ld: Add emultempl/emulation.em 2022-02-06 06:25:41 -08:00
bfin.em
cr16elf.em
crxelf.em
cskyelf.em
elf-generic.em
elf-x86.em Revert "PR28824, relro security issues, x86 keep COMMONPAGESIZE relro" 2022-02-14 17:39:34 -08:00
elf.em ld: Add a before_plugin_all_symbols_read hook 2022-03-09 18:23:43 -08:00
emulation.em ld: Add a before_plugin_all_symbols_read hook 2022-03-09 18:23:43 -08:00
epiphanyelf_4x4.em
genelf.em
generic.em ld: Add emultempl/emulation.em 2022-02-06 06:25:41 -08:00
hppaelf.em
ia64elf.em
irix.em
loongarchelf.em
m68hc1xelf.em
m68kelf.em
metagelf.em
mipself.em
mmix-elfnmmo.em
mmixelf.em
mmo.em
msp430.em ld: Add emultempl/emulation.em 2022-02-06 06:25:41 -08:00
nds32elf.em
needrelax.em
netbsd.em
nios2elf.em
ostring.sed
pdp11.em
pe.em ld: Add emultempl/emulation.em 2022-02-06 06:25:41 -08:00
pep.em ld: Add emultempl/emulation.em 2022-02-06 06:25:41 -08:00
ppc32elf.em
ppc64elf.em
pruelf.em
README
riscvelf.em
rxelf.em
rxlinux.em
s390.em
scoreelf.em
solaris2-x86.em
solaris2.em
spu_icache.o_c
spu_icache.S
spu_ovl.o_c
spu_ovl.S
spuelf.em
tic6xdsbt.em
ticoff.em ld: Add emultempl/emulation.em 2022-02-06 06:25:41 -08:00
v850elf.em
vanilla.em ld: Add emultempl/emulation.em 2022-02-06 06:25:41 -08:00
vms.em
vxworks.em
xtensaelf.em
z80.em

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

The files in this directory are sourced by genscripts.sh, after
setting some variables to substitute in, to produce
C source files that contain jump tables for each emulation.

Copyright (C) 2012-2022 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.