mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
8819b23615
This is something I discovered when working on aarch64, though it's relevant to x86_64 too. The PE32+ imports are located in the .idata section, which starts off with a 20-byte structure for each DLL, containing offsets into the rest of the section. This is the Import Directory Table in https://learn.microsoft.com/en-us/windows/win32/debug/pe-format, which is a concatenation of the .idata$2 sections. This is then followed by an 20 zero bytes generated by the linker script, which calls this .idata$3. After this comes the .idata$4 entries for each function, which the loader overwrites with the function pointers. Because there's no padding between .idata$3 and .idata$4, this means that if there's an even number of DLLs, the function pointers won't be aligned on an 8-byte boundary. Misaligned reads are slower on x86_64, but this is more important on aarch64, as the e.g. `ldr x0, [x0, :lo12:__imp__func]` the compiler might generate requires __imp__func (the .idata$4 entry) to be aligned to 8 bytes. Without this you get IMAGE_REL_ARM64_PAGEOFFSET_12L overflow errors. |
||
---|---|---|
.. | ||
aix.sc | ||
alpha.sc | ||
alphavms.sc | ||
aout.sc | ||
arclinux.sc | ||
avr.sc | ||
crisaout.sc | ||
dlx.sc | ||
DWARF.sc | ||
elf32cr16.sc | ||
elf32crx.sc | ||
elf32msp430.sc | ||
elf64bpf.sc | ||
elf64hppa.sc | ||
elf_chaos.sc | ||
elf.sc | ||
elfarc.sc | ||
elfarcv2.sc | ||
elfd10v.sc | ||
elfd30v.sc | ||
elfm9s12z.sc | ||
elfm68hc11.sc | ||
elfm68hc12.sc | ||
elfmicroblaze.sc | ||
elfxgate.sc | ||
elfxtensa.sc | ||
epiphany_4x4.sc | ||
ft32.sc | ||
hppaelf.sc | ||
i386beos.sc | ||
i386go32.sc | ||
i386msdos.sc | ||
ia64vms.sc | ||
ip2k.sc | ||
iq2000.sc | ||
mcorepe.sc | ||
mep.sc | ||
mips.sc | ||
mipsbsd.sc | ||
mmo.sc | ||
moxie.sc | ||
nds32elf.sc | ||
pdp11.sc | ||
pe.sc | ||
pep.sc | ||
pj.sc | ||
pru.sc | ||
README | ||
sh.sc | ||
tic4xcoff.sc | ||
tic30coff.sc | ||
tic54xcoff.sc | ||
v850_rh850.sc | ||
v850.sc | ||
vanilla.sc | ||
visium.sc | ||
xstormy16.sc | ||
z80.sc | ||
z8000.sc |
The files in this directory are linker script templates.
genscripts.sh sets some shell variables, then sources
EMULATION.sc, to generate EMULATION.{x,xr,xu,xn,xbn} -- the script
files for default, -r, -Ur, -n, -N.
Copyright (C) 2012-2023 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.