tests/tcg/meson.build: compile test with -fno-stack-protector by default
PATCH 1/1 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.
--- tests/tcg/meson.build | 6 ++++++ 1 file changed, 6 insertions(+)
tests/tcg/meson.build +6 -0
@@ -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',
Signature · 1 line
2.43.0
Am 24. September 2026 20:20:12 UTC schrieb Pierrick Bouvier <[email protected]>:
Quoted 10 lines
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-gcctests/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/../../minilibtests/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
Quoted 7 lines
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.
Thanks for providing the working patch so blazingly fast!
Quoted 23 lines
Signed-off-by Pierrick Bouvier <[email protected]>---
tests/tcg/meson.build | 6 ++++++1 file changed, 6 insertions(+)tests/tcg/meson.build +6
-0@@ -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',
Quoted 18 lines · Bernhard Beschow
Am 24. September 2026 20:20:12 UTC schrieb Pierrick Bouvier <[email protected]>:
Quoted 15 lines
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-gcctests/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/../../minilibtests/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 statusThis 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.
Quoted 7 lines
Quoted 2 lines
Thus, disable stack protection by default. It has no impact on tests results.
Thanks for providing the working patch so blazingly fast!
Tested-by Bernhard Beschow <[email protected]>
I'll pull it tomorrow with other series on tcg-tests 👍
Quoted 23 lines
Quoted 23 lines
Signed-off-by Pierrick Bouvier <[email protected]>---
tests/tcg/meson.build | 6 ++++++1 file changed, 6 insertions(+)tests/tcg/meson.build +6
-0@@ -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',
Quoted 15 lines · Pierrick Bouvier
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-gcctests/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/../../minilibtests/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 statusThis 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.
Quoted 8 lines
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(+)
This was merged into master (efa3b9d5ac8024078225e1ab434411fdfe53b457).
Regards,
Pierrick