diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2018-12-11 10:23:20 +0100 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2018-12-12 08:36:59 +0100 |
commit | 0d68ce514b922f887da28c2a12b8d37cf23903f0 (patch) | |
tree | 60d758752b182f0d493d049cc68d411fdfd6f47e /BaseTools | |
parent | e07092edca8442db4a941dbeea0cd196c7bf8ec9 (diff) | |
download | edk2-0d68ce514b922f887da28c2a12b8d37cf23903f0.zip edk2-0d68ce514b922f887da28c2a12b8d37cf23903f0.tar.gz edk2-0d68ce514b922f887da28c2a12b8d37cf23903f0.tar.bz2 |
BaseTools/GenFw ARM: don't permit R_ARM_GOT_PREL relocations
We currently permit R_ARM_GOT_PREL relocations in the ELF32 conversion
routines, under the assumption that relative relocations are fine as
long as the section layout is the same between ELF and PE/COFF.
However, as is the case with any proxy generating relocation, it is
up to the linker to emit an entry in the GOT table and populate it
with the correct absolute address, which should also be fixed up at
PE/COFF load time. Unfortunately, the relocations covering the GOT
section are not emitted into the static relocation sections processed
by GenFw, but only in the dynamic relocation section as a R_ARM_RELATIVE
relocation, and so GenFw fails to emit the correct PE/COFF relocation
data for GOT entries.
Since GOT indirection is pointless anyway for PE/COFF modules running
in UEFI context, let's just drop the references to R_ARM_GOT_PREL from
GenFw, resulting in a build time failure rather than a runtime failure
if such relocations do occur.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/C/GenFw/Elf32Convert.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c index 3d7de6d..23e8065 100644 --- a/BaseTools/Source/C/GenFw/Elf32Convert.c +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c @@ -837,7 +837,6 @@ WriteSections32 ( case R_ARM_LDC_PC_G0:
case R_ARM_LDC_PC_G1:
case R_ARM_LDC_PC_G2:
- case R_ARM_GOT_PREL:
case R_ARM_THM_JUMP11:
case R_ARM_THM_JUMP8:
case R_ARM_TLS_GD32:
@@ -964,7 +963,6 @@ WriteRelocations32 ( case R_ARM_LDC_PC_G0:
case R_ARM_LDC_PC_G1:
case R_ARM_LDC_PC_G2:
- case R_ARM_GOT_PREL:
case R_ARM_THM_JUMP11:
case R_ARM_THM_JUMP8:
case R_ARM_TLS_GD32:
|