summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2019-09-04 15:49:28 -0700
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2019-09-05 10:05:08 -0700
commit04d9d89b7dd489c22558fc9691fc8152704c827f (patch)
treec494d57f1a4a34a267166d989b82a14993f5f778
parent8a1305a11f3bda2d6c1ab758e4aea79ee021dd1c (diff)
ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: revert to PIE linking
In some cases, the CLANG38 toolchain profile in LTO mode emits GOT based relocations in spite of our attempts to avoid this, by using hidden visibility, -Bsymbolic etc. On AARCH64, we managed to work around this by processing the GOT based relocations in GenFw. As it turns out, the same issue exists on 32-bit ARM, but unfortunately, we cannot use a similar trick to get rid of the GOT entry, and the relocation metadata is insufficient to locate the GOT entry in the binary. Note that in this particular case, we are interested in PIE linking only (i.e., producing a .rela section containing dynamic relocations that the startup code can process directly), and not in position independent code generation, and by passing the -pie option to the linker directly using -Wl,-pie (and dropping -shared), we can coerce the GOLD linker into doing only the former rather than both when it performs its LTO code generation. Acked-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rwxr-xr-xArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf2
1 files changed, 1 insertions, 1 deletions
diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
index 683397b7af..9e58e56fce 100755
--- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
+++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
@@ -97,4 +97,4 @@
gArmTokenSpaceGuid.PcdFvBaseAddress
[BuildOptions]
- GCC:*_*_*_DLINK_FLAGS = -shared -Wl,-Bsymbolic -Wl,-T,$(MODULE_DIR)/Scripts/PrePi-PIE.lds
+ GCC:*_*_*_DLINK_FLAGS = -Wl,-Bsymbolic,-pie,-T,$(MODULE_DIR)/Scripts/PrePi-PIE.lds