summaryrefslogtreecommitdiffstats
path: root/IntelFsp2Pkg
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2019-09-03 20:58:18 -0700
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2019-09-04 09:08:39 -0700
commitd2687f23c909475d80cef32cdf9a5d121f0a9ae6 (patch)
tree676eb41f96358c1e3e16f29f160d8ad015546257 /IntelFsp2Pkg
parentadb59b633c12eae334540295092da94736bffa33 (diff)
downloadedk2-d2687f23c909475d80cef32cdf9a5d121f0a9ae6.tar.gz
edk2-d2687f23c909475d80cef32cdf9a5d121f0a9ae6.tar.bz2
edk2-d2687f23c909475d80cef32cdf9a5d121f0a9ae6.zip
BaseTools/GenFw AARCH64: fix up GOT based relative relocations
We take great care to avoid GOT based relocations in EDK2 executables, primarily because they are pointless - we don't care about things like the CoW footprint or relocations that target read-only sections, and so GOT entries only bloat the binary. However, in some cases (e.g., when building the relocatable PrePi SEC module in ArmVirtPkg with the CLANG38 toolchain), we may end up with some GOT based relocations nonetheless, which break the build since GenFw does not know how to deal with them. The relocations emitted in this case are ADRP/LDR instruction pairs that are annotated as GOT based, which means that it is the linker's job to emit the GOT entry and tag it with an appropriate dynamic relocation that ensures that the correct absolute value is stored into the GOT entry when the executable is loaded. This dynamic relocation is not visible to GenFw, and so populating the PE/COFF relocation section for these entries is non-trivial. Since each ADRP/LDR pair refers to a single symbol that is local to the binary (given that shared libraries are not supported), we can actually convert the ADRP/LDR pair into an ADRP/ADD pair that produces the symbol address directly rather than loading it from memory. This leaves the GOT entry in the binary, but since it is now unused, it is no longer necessary to emit a PE/COFF relocation entry for it. Acked-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'IntelFsp2Pkg')
0 files changed, 0 insertions, 0 deletions