| ... | ... | @@ -28,6 +28,7 @@ const TestTarget = struct { |
| 28 | 28 | single_threaded: ?bool = null, |
| 29 | 29 | use_llvm: ?bool = null, |
| 30 | 30 | use_lld: ?bool = null, |
| 31 | force_pic: ?bool = null, |
| 31 | 32 | }; |
| 32 | 33 | |
| 33 | 34 | const test_targets = blk: { |
| ... | ... | @@ -103,6 +104,7 @@ const test_targets = blk: { |
| 103 | 104 | }, |
| 104 | 105 | .use_llvm = false, |
| 105 | 106 | .use_lld = false, |
| 107 | .force_pic = true, |
| 106 | 108 | }, |
| 107 | 109 | .{ |
| 108 | 110 | .target = .{ |
| ... | ... | @@ -494,6 +496,7 @@ const CAbiTarget = struct { |
| 494 | 496 | target: CrossTarget = .{}, |
| 495 | 497 | use_llvm: ?bool = null, |
| 496 | 498 | use_lld: ?bool = null, |
| 499 | force_pic: ?bool = null, |
| 497 | 500 | c_defines: []const []const u8 = &.{}, |
| 498 | 501 | }; |
| 499 | 502 | |
| ... | ... | @@ -536,6 +539,7 @@ const c_abi_targets = [_]CAbiTarget{ |
| 536 | 539 | }, |
| 537 | 540 | .use_llvm = false, |
| 538 | 541 | .use_lld = false, |
| 542 | .force_pic = true, |
| 539 | 543 | .c_defines = &.{"ZIG_BACKEND_STAGE2_X86_64"}, |
| 540 | 544 | }, |
| 541 | 545 | .{ |
| ... | ... | @@ -1118,6 +1122,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1118 | 1122 | .use_lld = test_target.use_lld, |
| 1119 | 1123 | .zig_lib_dir = .{ .path = "lib" }, |
| 1120 | 1124 | }); |
| 1125 | these_tests.force_pic = test_target.force_pic; |
| 1121 | 1126 | const single_threaded_suffix = if (test_target.single_threaded == true) "-single" else ""; |
| 1122 | 1127 | const backend_suffix = if (test_target.use_llvm == true) |
| 1123 | 1128 | "-llvm" |
| ... | ... | @@ -1128,6 +1133,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1128 | 1133 | else |
| 1129 | 1134 | ""; |
| 1130 | 1135 | const use_lld = if (test_target.use_lld == false) "-no-lld" else ""; |
| 1136 | const use_pic = if (test_target.force_pic == true) "-pic" else ""; |
| 1131 | 1137 | |
| 1132 | 1138 | these_tests.addIncludePath(.{ .path = "test" }); |
| 1133 | 1139 | |
| ... | ... | @@ -1136,7 +1142,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1136 | 1142 | these_tests.stack_size = 2 * 1024 * 1024; |
| 1137 | 1143 | } |
| 1138 | 1144 | |
| 1139 | | const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}", .{ |
| 1145 | const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}{s}", .{ |
| 1140 | 1146 | options.name, |
| 1141 | 1147 | triple_txt, |
| 1142 | 1148 | model_txt, |
| ... | ... | @@ -1145,6 +1151,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1145 | 1151 | single_threaded_suffix, |
| 1146 | 1152 | backend_suffix, |
| 1147 | 1153 | use_lld, |
| 1154 | use_pic, |
| 1148 | 1155 | }); |
| 1149 | 1156 | |
| 1150 | 1157 | if (test_target.target.ofmt == std.Target.ObjectFormat.c) { |
| ... | ... | @@ -1240,7 +1247,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S |
| 1240 | 1247 | } |
| 1241 | 1248 | |
| 1242 | 1249 | const test_step = b.addTest(.{ |
| 1243 | | .name = b.fmt("test-c-abi-{s}-{s}-{s}{s}{s}", .{ |
| 1250 | .name = b.fmt("test-c-abi-{s}-{s}-{s}{s}{s}{s}", .{ |
| 1244 | 1251 | c_abi_target.target.zigTriple(b.allocator) catch @panic("OOM"), |
| 1245 | 1252 | c_abi_target.target.getCpuModel().name, |
| 1246 | 1253 | @tagName(optimize_mode), |
| ... | ... | @@ -1253,6 +1260,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S |
| 1253 | 1260 | else |
| 1254 | 1261 | "", |
| 1255 | 1262 | if (c_abi_target.use_lld == false) "-no-lld" else "", |
| 1263 | if (c_abi_target.force_pic == true) "-pic" else "", |
| 1256 | 1264 | }), |
| 1257 | 1265 | .root_source_file = .{ .path = "test/c_abi/main.zig" }, |
| 1258 | 1266 | .target = c_abi_target.target, |
| ... | ... | @@ -1261,6 +1269,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S |
| 1261 | 1269 | .use_llvm = c_abi_target.use_llvm, |
| 1262 | 1270 | .use_lld = c_abi_target.use_lld, |
| 1263 | 1271 | }); |
| 1272 | test_step.force_pic = c_abi_target.force_pic; |
| 1264 | 1273 | if (c_abi_target.target.abi != null and c_abi_target.target.abi.?.isMusl()) { |
| 1265 | 1274 | // TODO NativeTargetInfo insists on dynamically linking musl |
| 1266 | 1275 | // for some reason? |