You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/03/16 13:55:15 UTC

[incubator-nuttx] 13/14: xtensa/arch_elf.c: Ignore R_XTENSA_NONE

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit df44909b30a5a864777477a202027e78cad2768d
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Tue Mar 10 18:46:06 2020 +0900

    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 84a8848..7d63840 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;