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. Signed-off-by: Pierrick Bouvier <[email protected]> --- tests/tcg/meson.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build index 75f0a52fd22..35b3dff4ef2 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', -- 2.43.0
