aboutsummaryrefslogtreecommitdiff
path: root/ldelf
diff options
context:
space:
mode:
authorEtienne Carriere <etienne.carriere@linaro.org>2020-09-01 15:03:02 +0200
committerJérôme Forissier <jerome@forissier.org>2020-09-02 18:09:39 +0200
commitf104c8ee74935686aa901a0a9bc0e1af4856c059 (patch)
tree9627de8b55901ee119326e03a2dd4b45a9450c07 /ldelf
parent0b9125844ba4380767f2efa180ac30b014961c4d (diff)
ldelf: arm32: support R_ARM_NONE relocations
Fixes an issue when the toolchain used to build a TA creates R_ARM_NONE entries in the relocation table. Such relocation type means that no relocation is expected but the relocation table parser did not handle this type prior this change and TAs with such entries failed to be loaded with an error message like: E/LD: e32_relocate:378 Unknown relocation type 0 It appears that GCC 9 (at least GCC-9.2 and GCC-9.3) creates such entries while prior version of the GCC toolchain did not. Linker that generates the TA executable usually does not add such relocation type entries in the relocation table as it adds no real value at run or debug time. This change ensures that if such entries remain in a TA, it is still loadable. Fixes: https://github.com/OP-TEE/optee_os/issues/4064 Tested-by: Etienne Carriere <etienne.carriere@linaro.org> (stm32mp1, qemu) Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org>
Diffstat (limited to 'ldelf')
-rw-r--r--ldelf/ta_elf_rel.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ldelf/ta_elf_rel.c b/ldelf/ta_elf_rel.c
index d94d0a0c..ea616a68 100644
--- a/ldelf/ta_elf_rel.c
+++ b/ldelf/ta_elf_rel.c
@@ -334,6 +334,13 @@ static void e32_relocate(struct ta_elf *elf, unsigned int rel_sidx)
where = (Elf32_Addr *)(elf->load_addr + rel->r_offset);
switch (ELF32_R_TYPE(rel->r_info)) {
+ case R_ARM_NONE:
+ /*
+ * One would expect linker prevents such useless entry
+ * in the relocation table. We still handle this type
+ * here in case such entries exist.
+ */
+ break;
case R_ARM_ABS32:
sym_idx = ELF32_R_SYM(rel->r_info);
if (sym_idx >= num_syms)