From df44909b30a5a864777477a202027e78cad2768d Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 10 Mar 2020 18:46:06 +0900 Subject: [PATCH] xtensa/arch_elf.c: Ignore R_XTENSA_NONE Now examples/sotest passes on qemu. --- libs/libc/machine/xtensa/arch_elf.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libs/libc/machine/xtensa/arch_elf.c b/libs/libc/machine/xtensa/arch_elf.c index 84a8848375..7d63840507 100644 --- a/libs/libc/machine/xtensa/arch_elf.c +++ b/libs/libc/machine/xtensa/arch_elf.c @@ -167,13 +167,30 @@ int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym, unsigned char *p; uint32_t value; + /* All relocations except NONE depend upon having valid symbol + * information. + */ + relotype = ELF32_R_TYPE(rel->r_info); - value = sym->st_value + rel->r_addend; + if (sym == NULL) + { + if (relotype != R_XTENSA_NONE) + { + return -EINVAL; + } + } + else + { + value = sym->st_value + rel->r_addend; + } /* Handle the relocation by relocation type */ switch (relotype) { + case R_XTENSA_NONE: + break; + case R_XTENSA_32: (*(FAR uint32_t *)addr) += value; break;