You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/23 07:51:09 UTC

[GitHub] [incubator-nuttx] pussuw opened a new pull request #5829: RISC-V: Add/fix implementation for arch_elf.c

pussuw opened a new pull request #5829:
URL: https://github.com/apache/incubator-nuttx/pull/5829


   The jump instruction relocation had an assert that tests for jumps with
   an offset of 0. This makes it so that a while(1); statement causes an
   assert because the jump instruction points to the same address, which
   is perfectly legal.
   
   Addend was not handled correctly in several reloc types.
   
   Add ADD32/64 + SUB32/64 relocations, for some reason the compiler
   I use likes to add them.
   
   ## Summary
   Fixes some relocation issues
   ## Impact
   
   ## Testing
   Tested with MPFS icicle:knsh (CONFIG_BUILD_KERNEL=y) / not released yet
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5829: RISC-V: Add/fix implementation for arch_elf.c

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5829:
URL: https://github.com/apache/incubator-nuttx/pull/5829#discussion_r832979072



##########
File path: libs/libc/machine/risc-v/common/arch_elf.c
##########
@@ -343,7 +343,7 @@ int up_relocateadd(FAR const Elf_Rela *rel, FAR const Elf_Sym *sym,
                 addr, _get_val((uint16_t *)addr),
                 sym, sym->st_value);
 
-          offset = (long)sym->st_value - (long)addr;

Review comment:
       should we change offset type to uintptr_t, and remove all (long) castt?




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5829: RISC-V: Add/fix implementation for arch_elf.c

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5829:
URL: https://github.com/apache/incubator-nuttx/pull/5829#discussion_r833004623



##########
File path: libs/libc/machine/risc-v/common/arch_elf.c
##########
@@ -343,7 +343,7 @@ int up_relocateadd(FAR const Elf_Rela *rel, FAR const Elf_Sym *sym,
                 addr, _get_val((uint16_t *)addr),
                 sym, sym->st_value);
 
-          offset = (long)sym->st_value - (long)addr;

Review comment:
       But since there is a subtraction here maybe we can use `intptr_t` and not `uintptr_t` just to handle possible errors.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5829: RISC-V: Add/fix implementation for arch_elf.c

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5829:
URL: https://github.com/apache/incubator-nuttx/pull/5829#discussion_r833059131



##########
File path: libs/libc/machine/risc-v/common/arch_elf.c
##########
@@ -343,7 +343,7 @@ int up_relocateadd(FAR const Elf_Rela *rel, FAR const Elf_Sym *sym,
                 addr, _get_val((uint16_t *)addr),
                 sym, sym->st_value);
 
-          offset = (long)sym->st_value - (long)addr;

Review comment:
       Ok, let's move it to new patch if you think it's good suggestion since the unification of rv32 and rv64 into the same code base already do many similar change.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pussuw commented on a change in pull request #5829: RISC-V: Add/fix implementation for arch_elf.c

Posted by GitBox <gi...@apache.org>.
pussuw commented on a change in pull request #5829:
URL: https://github.com/apache/incubator-nuttx/pull/5829#discussion_r833053995



##########
File path: libs/libc/machine/risc-v/common/arch_elf.c
##########
@@ -343,7 +343,7 @@ int up_relocateadd(FAR const Elf_Rela *rel, FAR const Elf_Sym *sym,
                 addr, _get_val((uint16_t *)addr),
                 sym, sym->st_value);
 
-          offset = (long)sym->st_value - (long)addr;

Review comment:
       I kept the original format on the already existing parts, just fixing the issue with r_addend. 
   
   If you want I can unify the types to the stdint types for the entire file.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5829: RISC-V: Add/fix implementation for arch_elf.c

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5829:
URL: https://github.com/apache/incubator-nuttx/pull/5829


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org