binutils-gdb/ld/emultempl
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
..
aarch64elf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
aix.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
alphaelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
arclinux.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
armcoff.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
armelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
astring.sed
avrelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
beos.em PR27226, ld.bfd contains huge .rodata section 2021-01-26 20:54:43 +10:30
bfin.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
cr16elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
crxelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
cskyelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
elf-generic.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf-x86.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf.em elf/x86-64: Subtract __ImageBase for R_AMD64_IMAGEBASE 2021-03-05 18:25:06 -08:00
epiphanyelf_4x4.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
genelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
generic.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
hppaelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
ia64elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
irix.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
linux.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
m68hc1xelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
m68kelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
metagelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
mipself.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
mmix-elfnmmo.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
mmixelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
mmo.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
msp430.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
nds32elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
needrelax.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
netbsd.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
nios2elf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
ostring.sed
pdp11.em PR27226, ld.bfd contains huge .rodata section 2021-01-26 20:54:43 +10:30
pe.em PR27226, ld.bfd contains huge .rodata section 2021-01-26 20:54:43 +10:30
pep.em PR27226, ld.bfd contains huge .rodata section 2021-01-26 20:54:43 +10:30
ppc32elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
ppc64elf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
pruelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
README Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
riscvelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
rxelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
rxlinux.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
s390.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
scoreelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
solaris2-x86.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
solaris2.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
spu_icache.o_c
spu_icache.S
spu_ovl.o_c Regenerate spu_ovl.o_c 2016-10-15 12:53:57 +10:30
spu_ovl.S Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
spuelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
tic6xdsbt.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
ticoff.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
v850elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
vanilla.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
vms.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
vxworks.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
xtensaelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
z80.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30

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-2021 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.