Commit 026638f9ee for qemu.org
commit 026638f9eeb2b478733a05f0956ff2a2ba180688
Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Date: Thu Sep 24 20:20:12 2026 +0000
tests/tcg/meson.build: compile test with -fno-stack-protector by default
Some compilers enable stack protection by default (for instance, on
archlinux). This produce a compilation error on some of our tests:
/usr/sbin/x86_64-linux-gnu-gcc tests/tcg/multiarch/system/interrupt.c -o tests/tcg/x86_64-softmmu-interrupt.test -static -MMD -MF tests/tcg/x86_64-softmmu-interrupt.d -Wall -Werror -O0 -g -fno-strict-aliasing -nostdlib -ffreestanding -Wa,--noexecstack -I tests/tcg/x86_64/system/../../minilib tests/tcg/x86_64/system/../../minilib/printf.c ../tests/tcg/x86_64/system/boot.S -Wl,-T ../tests/tcg/x86_64/system/kernel.ld -Wl,-melf_x86_64 -Wl,--no-warn-rwx-segments -Wl,--build-id=none -lgcc
/usr/bin/ld: /tmp/ccs11W6S.o: in function `print_num':
tests/tcg/x86_64/system/../../minilib/printf.c:45:(.text+0xec): undefined reference to `__stack_chk_fail'
/usr/bin/ld: /tmp/ccs11W6S.o: in function `ml_printf':
tests/tcg/x86_64/system/../../minilib/printf.c:136:(.text+0x549): undefined reference to `__stack_chk_fail'
collect2: error: ld returned 1 exit status
This flag has been previously added, but was removed when moving tcg
tests to meson, with the goal to identify which systems require it.
https://gitlab.com/qemu-project/qemu/-/commit/580731dcc87eb27a2b0dc20ec331f1ce51864c97
One of these system is archlinux.
Thus, disable stack protection by default. It has no impact on tests
results.
Tested-by: Bernhard Beschow <shentey@gmail.com>
Link: https://lore.kernel.org/qemu-devel/20260924202012.2465-1-pierrick.bouvier@oss.qualcomm.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index 3151c5bd63..7a3f06ddcf 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -426,6 +426,12 @@ foreach target, plan: tcg_tests
'-MMD', '-MF', '@DEPFILE@',
'-Wall', '-Werror',
'-O0', '-g', '-fno-strict-aliasing',
+ # Some host compilers (like archlinux)
+ # have stack protection enabled by default.
+ # This results in a linking error for some
+ # of our tests due to missing symbol
+ # __stack_chk_fail. Thus, disable it.
+ '-fno-stack-protector',
cflags],
depfile: exe_name + '.d',
output: exe_name + '.test',