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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4b77504724d arch/sim: add missing module link option
4b77504724d is described below

commit 4b77504724d992482f26e69a9c11d8e55837c38d
Author: anjiahao <[email protected]>
AuthorDate: Mon Feb 2 19:37:31 2026 +0800

    arch/sim: add missing module link option
    
    The CMake build for the simulator did not pass -r when linking
    loadable modules.  The ELF application link step already uses -r,
    but the module link step was left without it, so the resulting
    object was not linked in the relocatable form expected by the ELF
    loader.
    
    Add nuttx_mod_link_options(-r) next to the existing ELF link
    options.
    
    Verified with a CMake sim build that links the sotest dynlib: the
    generated link command now contains -r and the ELF link completes.
    The standard sim:nsh CMake build also passes.
    
    Signed-off-by: anjiahao <[email protected]>
---
 arch/sim/src/cmake/elf.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sim/src/cmake/elf.cmake b/arch/sim/src/cmake/elf.cmake
index dc2cca50a14..1ce9559f02a 100644
--- a/arch/sim/src/cmake/elf.cmake
+++ b/arch/sim/src/cmake/elf.cmake
@@ -25,5 +25,5 @@ nuttx_elf_compile_options(-fvisibility=hidden -fno-pic)
 nuttx_elf_compile_options_ifdef(CONFIG_LIBC_ARCH_ELF_64BIT -mcmodel=large)
 
 nuttx_elf_link_options(-r -e main)
-
+nuttx_mod_link_options(-r)
 nuttx_elf_link_options_ifdef(CONFIG_SIM_M32 -melf_i386)

Reply via email to