casaroli commented on code in PR #19942:
URL: https://github.com/apache/nuttx/pull/19942#discussion_r3912607045


##########
libs/libc/elf/elf_load.c:
##########
@@ -573,14 +685,10 @@ int libelf_load(FAR struct mod_loadinfo_s *loadinfo)
     }
 
   loadinfo->gotindex = libelf_findsection(loadinfo, ".got");
-  if (loadinfo->gotindex >= 0)
+  if (loadinfo->gotindex >= 0 || loadinfo->fdpic)

Review Comment:
   done.



##########
libs/libc/elf/elf_load.c:
##########
@@ -729,14 +912,10 @@ int libelf_load_with_addrenv(FAR struct mod_loadinfo_s 
*loadinfo)
     }
 
   loadinfo->gotindex = libelf_findsection(loadinfo, ".got");
-  if (loadinfo->gotindex >= 0)
+  if (loadinfo->gotindex >= 0 || loadinfo->fdpic)

Review Comment:
   done



##########
binfmt/Kconfig:
##########
@@ -60,6 +60,38 @@ config ELF_STACKSIZE
        default DEFAULT_TASK_STACKSIZE
        ---help---
                This is the default stack size that will be used when starting 
ELF binaries.
+
+config FDPIC
+       bool "FDPIC modules"
+       default n
+       select PIC
+       depends on ARCH_HAVE_ELF_FDPIC
+       ---help---
+               Load ELF modules built for the FDPIC ABI.
+
+               An FDPIC module places its read-only and writable segments
+               independently, so its text can be executed directly out of flash
+               while only the writable segment is copied to RAM, once per 
running
+               instance.  A filesystem that can show its media, such as XIPFS 
or
+               ROMFS, gives that result.  On any other filesystem the loader 
copies
+               the text to RAM, and the module runs but shares nothing.
+
+               Building a module needs an arm-uclinuxfdpiceabi linker.  The 
stock
+               arm-none-eabi compiler emits correct FDPIC objects for both C 
and
+               C++, so only the link needs it.
+
+               What this adds over the position independent ELF support already
+               present is a function pointer that carries its own data base, 
as a
+               two word descriptor rather than a bare code address.  That is 
what
+               lets a module be called back on a thread it did not create, 
such as
+               the work queue worker that runs a SIGEV_THREAD notification.
+
+               Selecting this makes ten libc and sched entry points that can
+               accept a callback from a module resolve such a descriptor before
+               storing or branching to it.  Each costs a register read and a
+               branch on a path that is not hot.
+
+               FDPIC is specified only for ARM Thumb-2.

Review Comment:
   done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to