summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2016-02-12 10:06:58 +0100
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2016-02-15 10:29:38 +0100
commit0b6249f5902f85a9c1a438878b27f8d7ef960a41 (patch)
tree2951930d324262af2078e169df15e84da12bb698 /BaseTools
parented5e386a6952cb2cf8ca6d723e2abd6c0b4f18c2 (diff)
downloadedk2-0b6249f5902f85a9c1a438878b27f8d7ef960a41.tar.gz
edk2-0b6249f5902f85a9c1a438878b27f8d7ef960a41.tar.bz2
edk2-0b6249f5902f85a9c1a438878b27f8d7ef960a41.zip
BaseTools/GenFw AARCH64: add support for relative data relocations
This adds support to the ELF to PE/COFF conversion performed by GenFw for the AArch64 ELF relocation types R_AARCH64_PREL64, R_AARCH64_PREL32 and R_AARCH64_PREL16. Since we already require the ELF and PE/COFF section layouts to be identical in order to support other relative relocation types, this is simply a matter of whitelisting these new relocation types in the same way. While we're at it, clean up the code a bit, and add a comment explaining why these relocations are ignored in WriteRelocations64 (). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/C/GenFw/Elf64Convert.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 90d80a22da..fb85b3821b 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -767,6 +767,9 @@ WriteSections64 (
case R_AARCH64_LD_PREL_LO19:
case R_AARCH64_CALL26:
case R_AARCH64_JUMP26:
+ case R_AARCH64_PREL64:
+ case R_AARCH64_PREL32:
+ case R_AARCH64_PREL16:
//
// The GCC toolchains (i.e., binutils) may corrupt section relative
// relocations when emitting relocation sections into fully linked
@@ -855,20 +858,13 @@ WriteRelocations64 (
switch (ELF_R_TYPE(Rel->r_info)) {
case R_AARCH64_ADR_PREL_LO21:
- break;
-
case R_AARCH64_CONDBR19:
- break;
-
case R_AARCH64_LD_PREL_LO19:
- break;
-
case R_AARCH64_CALL26:
- break;
-
case R_AARCH64_JUMP26:
- break;
-
+ case R_AARCH64_PREL64:
+ case R_AARCH64_PREL32:
+ case R_AARCH64_PREL16:
case R_AARCH64_ADR_PREL_PG_HI21:
case R_AARCH64_ADD_ABS_LO12_NC:
case R_AARCH64_LDST8_ABS_LO12_NC:
@@ -876,6 +872,12 @@ WriteRelocations64 (
case R_AARCH64_LDST32_ABS_LO12_NC:
case R_AARCH64_LDST64_ABS_LO12_NC:
case R_AARCH64_LDST128_ABS_LO12_NC:
+ //
+ // No fixups are required for relative relocations, provided that
+ // the relative offsets between sections have been preserved in
+ // the ELF to PE/COFF conversion. We have already asserted that
+ // this is the case in WriteSections64 ().
+ //
break;
case R_AARCH64_ABS64: