xiaoxiang781216 commented on a change in pull request #447: ESP32 module support
URL: https://github.com/apache/incubator-nuttx/pull/447#discussion_r389037949
 
 

 ##########
 File path: libs/libc/machine/xtensa/arch_elf.c
 ##########
 @@ -154,6 +161,57 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const 
Elf32_Sym *sym,
 int up_relocateadd(FAR const Elf32_Rela *rel, FAR const Elf32_Sym *sym,
                    uintptr_t addr)
 {
-  berr("ERROR: RELA relocation not supported\n");
-  return -ENOSYS;
+  unsigned int relotype;
+  unsigned char *p;
+  uint32_t value;
+
+  relotype = ELF32_R_TYPE(rel->r_info);
+  value = sym->st_value + rel->r_addend;
+
+  /* Handle the relocation by relocation type */
+
+  switch (relotype)
+    {
+    case R_XTENSA_32:
+      (*(uint32_t *)addr) += value;
+      break;
+
+    case R_XTENSA_ASM_EXPAND:
+      bwarn("ERROR: Ignoring RELA relocation R_XTENSA_ASM_EXPAND %u\n",
+          relotype);
+      break;
+
+    case R_XTENSA_SLOT0_OP:
+      p = (unsigned char *)addr;
 
 Review comment:
   FAR unsigned char *

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to