binutils-gdb/ld/scripttempl
Mark Harmstone 8819b23615 Avoid unaligned pointer reads in PEP .idata section
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.
2023-01-04 03:47:09 +00:00
..
aix.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
alpha.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
alphavms.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
aout.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
arclinux.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
avr.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
crisaout.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
dlx.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
DWARF.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elf32cr16.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elf32crx.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elf32msp430.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elf64bpf.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elf64hppa.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elf_chaos.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elf.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elfarc.sc
elfarcv2.sc
elfd10v.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elfd30v.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elfm9s12z.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elfm68hc11.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elfm68hc12.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elfmicroblaze.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elfxgate.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
elfxtensa.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
epiphany_4x4.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ft32.sc
hppaelf.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
i386beos.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
i386go32.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
i386msdos.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ia64vms.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
ip2k.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
iq2000.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
mcorepe.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
mep.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
mips.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
mipsbsd.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
mmo.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
moxie.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
nds32elf.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
pdp11.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
pe.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
pep.sc Avoid unaligned pointer reads in PEP .idata section 2023-01-04 03:47:09 +00:00
pj.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
pru.sc
README Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
sh.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
tic4xcoff.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
tic30coff.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
tic54xcoff.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
v850_rh850.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
v850.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
vanilla.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
visium.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
xstormy16.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
z80.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +10:30
z8000.sc Update year range in copyright notice of binutils files 2023-01-01 21:50:11 +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 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.