From 79fd6241e4347f67d659cc02669448397b458d52 Mon Sep 17 00:00:00 2001 From: Romain Naour Date: Thu, 27 Aug 2026 23:21:25 +0200 Subject: [PATCH] board/qemu: add xtensa kernel patch -fno-stack-protector must be passed to avoid linking errors related to undefined references to '__stack_chk_guard' and '__stack_chk_fail' if toolchain enforces -fstack-protector. Fixes: https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15876432953 Signed-off-by: Romain Naour Signed-off-by: Julien Olivain --- .../0001-xtensa-disable-SSP-when-needed.patch | 36 +++++++++++++++++++ configs/qemu_xtensa_lx60_defconfig | 2 +- configs/qemu_xtensa_lx60_nommu_defconfig | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 board/qemu/xtensa-lx60/patches/linux/0001-xtensa-disable-SSP-when-needed.patch diff --git a/board/qemu/xtensa-lx60/patches/linux/0001-xtensa-disable-SSP-when-needed.patch b/board/qemu/xtensa-lx60/patches/linux/0001-xtensa-disable-SSP-when-needed.patch new file mode 100644 index 0000000000..cc19348140 --- /dev/null +++ b/board/qemu/xtensa-lx60/patches/linux/0001-xtensa-disable-SSP-when-needed.patch @@ -0,0 +1,36 @@ +From 5358d4e20801ffbb1c0834eab36c003049d4055f Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Sun, 16 Aug 2026 22:27:28 +0200 +Subject: [PATCH] xtensa: disable SSP when needed + +-fno-stack-protector must be passed to avoid linking errors related to +undefined references to '__stack_chk_guard' and '__stack_chk_fail' if +toolchain enforces -fstack-protector. + +Fixes: +https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/15876432953 + +Upstream: Submitted to Max Filippov via email for initial review. + +Cc: Max Filippov +Signed-off-by: Romain Naour +--- + arch/xtensa/boot/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile +index d8b0fadf429a9..dfb758cdb2756 100644 +--- a/arch/xtensa/boot/Makefile ++++ b/arch/xtensa/boot/Makefile +@@ -9,7 +9,7 @@ + + + # KBUILD_CFLAGS used when building rest of boot (takes effect recursively) +-KBUILD_CFLAGS += -fno-builtin ++KBUILD_CFLAGS += -fno-builtin -fno-stack-protector + + subdir-y := lib + targets += vmlinux.bin vmlinux.bin.gz +-- +2.55.0 + diff --git a/configs/qemu_xtensa_lx60_defconfig b/configs/qemu_xtensa_lx60_defconfig index d2d6c92faf..a84395a344 100644 --- a/configs/qemu_xtensa_lx60_defconfig +++ b/configs/qemu_xtensa_lx60_defconfig @@ -2,7 +2,7 @@ BR2_xtensa=y BR2_XTENSA_CUSTOM=y BR2_XTENSA_OVERLAY_FILE="https://github.com/jcmvbkbc/xtensa-toolchain-build/raw/95291b7c39e6f790d0b2f062c945a630290f2c81/overlays/xtensa_dc233c.tar.gz" BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_18=y -BR2_GLOBAL_PATCH_DIR="board/qemu/patches" +BR2_GLOBAL_PATCH_DIR="board/qemu/patches board/qemu/xtensa-lx60/patches" BR2_DOWNLOAD_FORCE_CHECK_HASHES=y BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" BR2_SYSTEM_DHCP="eth0" diff --git a/configs/qemu_xtensa_lx60_nommu_defconfig b/configs/qemu_xtensa_lx60_nommu_defconfig index 89b73ee1e6..a937112a9e 100644 --- a/configs/qemu_xtensa_lx60_nommu_defconfig +++ b/configs/qemu_xtensa_lx60_nommu_defconfig @@ -3,7 +3,7 @@ BR2_XTENSA_CUSTOM=y BR2_XTENSA_OVERLAY_FILE="https://github.com/jcmvbkbc/xtensa-toolchain-build/raw/95291b7c39e6f790d0b2f062c945a630290f2c81/overlays/xtensa_dc233c.tar.gz" # BR2_XTENSA_USE_MMU is not set BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_18=y -BR2_GLOBAL_PATCH_DIR="board/qemu/patches" +BR2_GLOBAL_PATCH_DIR="board/qemu/patches board/qemu/xtensa-lx60/patches" BR2_DOWNLOAD_FORCE_CHECK_HASHES=y BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" BR2_SYSTEM_DHCP="eth0"