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 <hanzhijian@zepp.com>
This commit is contained in:
hanzhijian
2026-05-20 19:49:18 +08:00
committed by Alin Jerpelea
parent bb27808631
commit ad182bcb4b
+4
View File
@@ -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;