test: enable thumb-windows-gnu module tests

We use long calls for these just like thumb*-linux-* to prevent range issues as
the binaries grow larger over time.

We also need function and data sections due to the many __stack_chk_guard
references within the std test binary; without these options, the linker is not
able to insert range thunks in between functions because the std binary just has
one giant .text section that's opaque to the linker.

closes https://codeberg.org/ziglang/zig/issues/30923
This commit is contained in:
Alex Rønne Petersen 2026-01-23 19:47:12 +01:00
parent c699bb8134
commit e437efd601
No known key found for this signature in database

View file

@ -28,6 +28,8 @@ const TestTarget = struct {
use_lld: ?bool = null,
pic: ?bool = null,
strip: ?bool = null,
function_sections: ?bool = null,
data_sections: ?bool = null,
skip_modules: []const []const u8 = &.{},
// This is intended for targets that, for any reason, shouldn't be run as part of a normal test
@ -40,7 +42,7 @@ const test_targets = blk: {
// getBaselineCpuFeatures calls populateDependencies which has a O(N ^ 2) algorithm
// (where N is roughly 160, which technically makes it O(1), but it adds up to a
// lot of branches)
@setEvalBranchQuota(60000);
@setEvalBranchQuota(80_000);
break :blk [_]TestTarget{
// Native Targets
@ -1526,36 +1528,43 @@ const test_targets = blk: {
},
.{
.target = .{
.cpu_arch = .thumb,
.os_tag = .windows,
.abi = .msvc,
},
.target = std.Target.Query.parse(.{
.arch_os_abi = "thumb-windows-msvc",
.cpu_features = "baseline+long_calls",
}) catch unreachable,
.pic = false, // Long calls don't work with PIC.
.function_sections = true,
.data_sections = true,
},
.{
.target = .{
.cpu_arch = .thumb,
.os_tag = .windows,
.abi = .msvc,
},
.target = std.Target.Query.parse(.{
.arch_os_abi = "thumb-windows-msvc",
.cpu_features = "baseline+long_calls",
}) catch unreachable,
.link_libc = true,
.pic = false, // Long calls don't work with PIC.
.function_sections = true,
.data_sections = true,
},
.{
.target = std.Target.Query.parse(.{
.arch_os_abi = "thumb-windows-gnu",
.cpu_features = "baseline+long_calls",
}) catch unreachable,
.pic = false, // Long calls don't work with PIC.
.function_sections = true,
.data_sections = true,
},
.{
.target = std.Target.Query.parse(.{
.arch_os_abi = "thumb-windows-gnu",
.cpu_features = "baseline+long_calls",
}) catch unreachable,
.link_libc = true,
.pic = false, // Long calls don't work with PIC.
.function_sections = true,
.data_sections = true,
},
// https://github.com/ziglang/zig/issues/24016
// .{
// .target = .{
// .cpu_arch = .thumb,
// .os_tag = .windows,
// .abi = .gnu,
// },
// },
// .{
// .target = .{
// .cpu_arch = .thumb,
// .os_tag = .windows,
// .abi = .gnu,
// },
// .link_libc = true,
// },
.{
.target = .{
@ -2454,6 +2463,8 @@ fn addOneModuleTest(
if (options.build_options) |build_options| {
these_tests.root_module.addOptions("build_options", build_options);
}
if (test_target.function_sections) |fs| these_tests.link_function_sections = fs;
if (test_target.data_sections) |ds| these_tests.link_data_sections = ds;
const single_threaded_suffix = if (test_target.single_threaded == true) "-single" else "";
const backend_suffix = if (test_target.use_llvm == true)
"-llvm"