audk/BaseTools/Source/C
Ard Biesheuvel 026a82abf0 BaseTools/GenFw AARCH64: convert ADRP to ADR instructions if binary size allows it
The ADRP instruction in the AArch64 ISA requires the link time and load time
offsets of a binary to be equal modulo 4 KB. The reason is that this instruction
always produces a multiple of 4 KB, and relies on a subsequent ADD or LDR
instruction to set the offset into the page. The resulting symbol reference
only produces the correct value if the symbol in question resides at that
exact offset into the page, and so loading the binary at arbitrary offsets
is not possible.

Due to the various levels of padding when packing FVs into FVs into FDs, this
alignment is very costly for XIP code, and so we would like to relax this
alignment requirement if possible.

Given that symbols that are sufficiently close (within 1 MB) of the reference
can also be reached using an ADR instruction which does not suffer from this
alignment issue, let's replace ADRP instructions with ADR after linking if
the offset can be encoded in this instruction's immediate field. Note that
this only makes sense if the section alignment is < 4 KB. Otherwise,
replacing the ADRP has no benefit, considering that the subsequent ADD or
LDR instruction is retained, and that micro-architectures are more likely
to be optimized for ADRP/ADD pairs (i.e., via micro op fusing) than for
ADR/ADD pairs, which are non-typical.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2016-08-02 10:58:07 +02:00
..
BootSectImage BaseTools: Change source files to DOS format. 2016-03-10 17:37:51 +08:00
Common BaseTools: Eliminate two shift-negative-value in FvLib.c 2016-05-18 09:50:44 +08:00
EfiLdrImage BaseTools: Change source files to DOS format. 2016-03-10 17:37:51 +08:00
EfiRom License header updated to match correct format. 2014-08-28 13:53:34 +00:00
GenBootSector BaseTools: Fix 'caculate' typos 2016-01-06 01:13:35 +00:00
GenCrc32 License header updated to match correct format. 2014-08-28 13:53:34 +00:00
GenFfs BaseTools: use GUID identifiable section for FFS alignment padding 2015-07-27 13:50:19 +00:00
GenFv BaseTools: Update ARM/AArch64 GenFv vector processing for encapsulated FVs 2016-03-10 22:04:11 +07:00
GenFw BaseTools/GenFw AARCH64: convert ADRP to ADR instructions if binary size allows it 2016-08-02 10:58:07 +02:00
GenPage License header updated to match correct format. 2014-08-28 13:53:34 +00:00
GenSec License header updated to match correct format. 2014-08-28 13:53:34 +00:00
GenVtf BaseTools: Update BaseTools to pass VS2015 compiler 2016-01-29 04:54:37 +00:00
GnuGenBootSector License header updated to match correct format. 2014-08-28 13:53:34 +00:00
Include BaseTools: Add HII definitions from UEFI 2.6 2016-05-16 15:47:21 +08:00
LzmaCompress BaseTools/LZMA: fix the format issue for last patch 2016-03-03 12:06:41 +08:00
Makefiles BaseTools: Fix build on FreeBSD and allow use of non-gcc system compiler 2015-07-08 01:06:25 +00:00
PyEfiCompressor License header updated to match correct format. 2014-08-28 13:53:34 +00:00
PyUtility License header updated to match correct format. 2014-08-28 13:53:34 +00:00
Split BaseTools: Change source files to DOS format. 2016-03-10 17:37:51 +08:00
TianoCompress License header updated to match correct format. 2014-08-28 13:53:34 +00:00
VfrCompile BaseTools: Change source files to DOS format. 2016-03-10 17:37:51 +08:00
VolInfo BaseTools/VolInfo: Update to handle PE image with .code section only 2016-04-15 08:43:49 +08:00
GNUmakefile BaseTools: add ARCH detection for AARCH64 and ARM 2015-08-12 05:22:49 +00:00
Makefile Fix nmake cleanall bugs. 2014-08-25 05:00:34 +00:00