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

jerpelea 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 ad182bcb4bf sim: resolve host symbols eagerly on Linux
ad182bcb4bf is described below

commit ad182bcb4bfe17f618c0031410554cb789386ddb
Author: hanzhijian <[email protected]>
AuthorDate: Wed May 20 19:49:18 2026 +0800

    sim: resolve host symbols eagerly on Linux
    
    Resolve PLT entries at load time on Linux hosts so early host calls do not 
enter the lazy binder with simulated interrupts masked.
    
    On Ubuntu 20 with GCC 9, the sim:nsh binary linked successfully after the 
-no-pie fix but crashed very early at runtime inside _dl_fixup / 
_dl_runtime_resolve_xsavec when up_irq_save() triggered a first-time PLT 
resolution.
    
    Setting LD_BIND_NOW=1 avoided the crash and allowed NSH to start, which 
showed lazy binding was the trigger.
    
    Signed-off-by: hanzhijian <[email protected]>
---
 boards/sim/sim/sim/scripts/Make.defs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/boards/sim/sim/sim/scripts/Make.defs 
b/boards/sim/sim/sim/scripts/Make.defs
index 42d78e826b0..0a65fb44e25 100644
--- a/boards/sim/sim/sim/scripts/Make.defs
+++ b/boards/sim/sim/sim/scripts/Make.defs
@@ -340,6 +340,10 @@ else ifeq ($(CONFIG_HOST_MACOS)$(CONFIG_HOST_ARM64),)
 endif
 
 ifeq ($(CONFIG_HOST_LINUX),y)
+  # Resolve PLT entries at load time so early host calls made with
+  # simulated interrupts masked do not fault inside the lazy binder.
+  LDFLAGS += -Wl,-z,now
+
   define POSTBUILD
        $(Q)echo "Pac SIM with dynamic libs..";
        @ rm -rf sim-pac;

Reply via email to