anjiahao1 opened a new pull request, #14285:
URL: https://github.com/apache/nuttx/pull/14285

   ## Summary
   
   This PR implements the loading of position-independent code (PIC). It works 
by utilizing the Global Offset Table (GOT) and a PIC register. The code is 
compiled as position-independent using GCC flags` -fpic`,` -fPIE`,` 
-mno-pic-data-is-text-relative`, and `-msingle-pic-base`. Before jumping to the 
position-independent code, the GOT offset and the PIC register are properly 
configured, allowing the code to execute as position-independent. If the 
dynamic module is in a ROMFS or TMPFS, it can even be executed in-place (XIP), 
saving memory in the text segment.
   
   ## Impact
   
   modlib elf PIC
   
   ## Testing
   
   `./tools/configure.sh mps3-an547:picostest`
   build a PIC ostest elf module, and run it
   
   `./tools/configure.sh mps3-an547:ap`
   `./tools/configure.sh mps3-an547:bl`
   
   build a PIC nuttx image ap, and use bootloader to boot it
   
   more info in `Documentation/platforms/arm/mps/boards/mps3-an547/index.rst`
   and [gcc option](https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html)
   


-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to