binutils-gdb/ld/testsuite
H.J. Lu 8c0546e928 elf/x86-64: Subtract __ImageBase for R_AMD64_IMAGEBASE
When linking Windows x86-64 relocatable object files to generate x86-64
ELF executable, we need to subtract __ImageBase, aka __executable_start,
for R_AMD64_IMAGEBASE relocation:

1. Add link_info to struct output_elf_obj_tdata to store linker info and
_bfd_get_link_info() to retrieve it.
2. Add ldelf_set_output_arch to set up link_info.
3. Add pex64_link_add_symbols to create an indirect reference to
__executable_start for __ImageBase to support R_AMD64_IMAGEBASE relocation
when adding symbols from Windows x86-64 relocatable object files to
generate x86-64 ELF executable.
4. Also subtract __ImageBase for R_AMD64_IMAGEBASE when generating x86-64
ELF executable.

bfd/

	PR ld/27425
	PR ld/27432
	* bfd.c (_bfd_get_link_info): New function.
	* elf-bfd.h (output_elf_obj_tdata): Add link_info.
	(elf_link_info): New.
	* libbfd-in.h (_bfd_get_link_info): New prototype.
	* coff-x86_64.c (coff_amd64_reloc): Also subtract __ImageBase for
	R_AMD64_IMAGEBASE when generating x86-64 ELF executable.
	* pe-x86_64.c: Include "coff/internal.h" and "libcoff.h".
	(pex64_link_add_symbols): New function.
	(coff_bfd_link_add_symbols): New macro.
	* libbfd.h: Regenerated.

ld/

	PR ld/27425
	PR ld/27432
	* ldelf.c (ldelf_set_output_arch): New function.
	* ldelf.h (ldelf_set_output_arch): New prototype.
	* emultempl/elf.em (LDEMUL_SET_OUTPUT_ARCH): Default to
	ldelf_set_output_arch.
	* ld-x86-64/pe-x86-64-1.od: Expect __executable_start.
	* testsuite/ld-x86-64/pe-x86-64-2.od: Likewise.
	* testsuite/ld-x86-64/pe-x86-64-3.od: Likewise.
	* testsuite/ld-x86-64/pe-x86-64-4.od: Likewise.
	* testsuite/ld-x86-64/pe-x86-64-5.od: Likewise.
	* testsuite/ld-x86-64/pe-x86-64-5.rd: Likewise.
	* testsuite/ld-x86-64/pe-x86-64-6.obj.bz2: New file.
	* testsuite/ld-x86-64/pe-x86-64-6.od: Likewise.
	* testsuite/ld-x86-64/pe-x86-64.exp: Run ld/27425 test.
2021-03-05 18:25:06 -08:00
..
config
ld-aarch64
ld-alpha
ld-arc
ld-arm
ld-auto-import
ld-avr
ld-bootstrap
ld-bpf
ld-cdtest ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-checks ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-cris
ld-crx
ld-csky
ld-ctf
ld-cygwin
ld-d10v
ld-discard
ld-dynamic
ld-elf PR27128, nm -P portable output format regression 2021-03-01 14:26:39 +10:30
ld-elfcomm ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-elfvers ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-elfvsb ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-elfweak ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-fastcall
ld-frv
ld-gc --gc-sections with groups and start/stop syms 2021-03-03 17:46:36 +10:30
ld-h8300
ld-i386 readelf: Replace procesor with processor 2021-02-20 05:55:42 -08:00
ld-ia64
ld-ifunc ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-libs
ld-linkonce
ld-m68hc11
ld-m68k
ld-mep
ld-metag
ld-mips-elf ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-misc ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-mmix
ld-mn10300 ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-msp430-elf
ld-nds32
ld-nios2
ld-or1k
ld-pdp11
ld-pe ld: don't generate base relocations in PE output for absolute symbols 2021-03-04 16:55:01 +01:00
ld-pie
ld-plugin Add PR27441 testcase 2021-02-26 17:49:04 +10:30
ld-powerpc PR27451, -z start_stop_gc for powerpc64 2021-03-02 21:49:56 +10:30
ld-pru
ld-riscv-elf
ld-s12z
ld-s390
ld-scripts ld: adjust ld-scripts/map-address.* 2021-03-04 16:56:40 +01:00
ld-selective ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-sh ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-shared ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-size
ld-sparc
ld-spu
ld-srec ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-tic6x ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-tilegx
ld-tilepro
ld-undefined ld testsuite: change unresolved to unsupported/fail 2021-02-14 22:34:27 +10:30
ld-unique
ld-v850
ld-vax-elf
ld-visium
ld-vxworks
ld-x86-64 elf/x86-64: Subtract __ImageBase for R_AMD64_IMAGEBASE 2021-03-05 18:25:06 -08:00
ld-xc16x
ld-xstormy16
ld-xtensa
ld-z8k
ld-z80
lib Wrong ELF class plugin vs. gcc ld version 2021-02-19 13:49:15 +10:30
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-9303