zig
zig copied to clipboard
C ABI tests fail with LTO off
Zig Version
0.11.0-dev.1970+962299157
Steps to Reproduce and Observed Behavior
Apply this diff:
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -1370,11 +1370,9 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S
test_step.linkLibC();
test_step.addCSourceFile("test/c_abi/cfuncs.c", &.{"-std=c99"});
- if (c_abi_target.isWindows() and (c_abi_target.getCpuArch() == .x86 or builtin.target.os.tag == .linux)) {
- // LTO currently incorrectly strips stdcall name-mangled functions
- // LLD crashes in LTO here when cross compiling for windows on linux
- test_step.want_lto = false;
- }
+ // This test is intentionally trying to check if the external ABI is
+ // done properly. LTO would be a hindrance to this.
+ test_step.want_lto = false;
const triple_prefix = c_abi_target.zigTriple(b.allocator) catch unreachable;
test_step.setNamePrefix(b.fmt("{s}-{s}-{s} ", .{
This causes 3 targets to fail:
$ stage4/bin/zig build test-c-abi -fwasmtime -fqemu -fwine
run test: error: thread 3143452 panic: zig_panic called from C
run test: error: the following command terminated with signal 6 (expected exited with code 0):
/home/andy/Downloads/zig/zig-cache/o/2a897fd49ed824e7fc2313ec1a9390a5/test --listen=-
run test: error: thread 3143472 panic: zig_panic called from C
run test: error: the following command terminated with signal 6 (expected exited with code 0):
/home/andy/Downloads/zig/zig-cache/o/ce90734f8cce5e881bee06cc98d8093f/test --listen=-
run test: error: thread 3143476 panic: test failure: zig_i8
run test: error: the following command terminated with signal 6 (expected exited with code 0):
qemu-aarch64 /home/andy/Downloads/zig/zig-cache/o/3beaa71513d6a2cbcbc7c89e80392eea/test --listen=-
Build Summary: 43/49 steps succeeded; 2 skipped; 3 failed; 833/1210 tests passed; 377 skipped (disable with -fno-summary)
...
├─ run test failure
│ └─ zig test ReleaseFast native success 15s MaxRSS:226M
├─ run test failure
│ └─ zig test ReleaseFast x86_64-linux-musl success 15s MaxRSS:228M
├─ run test failure
│ └─ zig test ReleaseFast aarch64-linux-musl success 15s MaxRSS:231M
...
Expected Behavior
All C ABI tests passed with LTO always off.