diff mbox series

[meta-zephyr,2/4] zephyr-kernel: fix cross compilation

Message ID 20260518051437.693745-2-chee.yang.lee@intel.com
State New
Headers show
Series [meta-zephyr,1/4] zephyr-kernel/4.3: Fix sysrootarg | expand

Commit Message

Lee, Chee Yang May 18, 2026, 5:14 a.m. UTC
From: Lee Chee Yang <chee.yang.lee@intel.com>

set CONFIG_STATIC_INIT_GNU=y when cross-compile toochain selected.

Fix:
| /data/wrynose/bitbake-builds/zephyr-master/build/tmp/work/i586-yocto-elf/zephyr-helloworld/4.3.0+git/recipe-sysroot-native/usr/bin/i586-yocto-elf/i586-yocto-elf-ld.bfd: GNU-style constructors required but STATIC_INIT_GNU not enabled
| /data/wrynose/bitbake-builds/zephyr-master/build/tmp/work/i586-yocto-elf/zephyr-helloworld/4.3.0+git/recipe-sysroot-native/usr/bin/i586-yocto-elf/i586-yocto-elf-ld.bfd: warning: zephyr/zephyr_pre0.elf has a LOAD segment with RWX permissions
| collect2: error: ld returned 1 exit status
| ninja: build stopped: subcommand failed.

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
---
 .../recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc        | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
index 3a8a4da..eb8f224 100644
--- a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
+++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
@@ -26,6 +26,7 @@  EXTRA_OECMAKE = "\
     -DSOC_ROOT=${SOC_ROOT} \
     -DZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT} \
     -DZEPHYR_MODULES=${ZEPHYR_MODULES} \
+    ${@bb.utils.contains('ZEPHYR_TOOLCHAIN_VARIANT', 'cross-compile', '-DCONFIG_STATIC_INIT_GNU=y', '', d)} \
     "
 
 ZEPHYR_EXTRA_MODULES = ""