Skip to content

Commit 291c08f

Browse files
authored
Merge pull request #11910 from ziglang/linker-tests
2 parents 87d8cb1 + 03ddb42 commit 291c08f

File tree

54 files changed

+857
-180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+857
-180
lines changed

build.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ pub fn build(b: *Builder) !void {
489489

490490
toolchain_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));
491491
toolchain_step.dependOn(tests.addStandaloneTests(b, test_filter, modes, skip_non_native, enable_macos_sdk, target));
492+
toolchain_step.dependOn(tests.addLinkTests(b, test_filter, modes, enable_macos_sdk));
492493
toolchain_step.dependOn(tests.addStackTraceTests(b, test_filter, modes));
493494
toolchain_step.dependOn(tests.addCliTests(b, test_filter, modes));
494495
toolchain_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, modes));

ci/azure/macos_script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ release/bin/zig build test-run-translated-c -Denable-macos-sdk
7676
release/bin/zig build docs -Denable-macos-sdk
7777
release/bin/zig build test-fmt -Denable-macos-sdk
7878
release/bin/zig build test-cases -Denable-macos-sdk -Dsingle-threaded
79+
release/bin/zig build test-link -Denable-macos-sdk
7980

8081
if [ "${BUILD_REASON}" != "PullRequest" ]; then
8182
mv ../LICENSE release/

lib/std/build.zig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub const TranslateCStep = @import("build/TranslateCStep.zig");
2424
pub const WriteFileStep = @import("build/WriteFileStep.zig");
2525
pub const RunStep = @import("build/RunStep.zig");
2626
pub const CheckFileStep = @import("build/CheckFileStep.zig");
27+
pub const CheckObjectStep = @import("build/CheckObjectStep.zig");
2728
pub const InstallRawStep = @import("build/InstallRawStep.zig");
2829
pub const OptionsStep = @import("build/OptionsStep.zig");
2930

@@ -1582,6 +1583,9 @@ pub const LibExeObjStep = struct {
15821583
/// (Darwin) Path to entitlements file
15831584
entitlements: ?[]const u8 = null,
15841585

1586+
/// (Darwin) Size of the pagezero segment.
1587+
pagezero_size: ?u64 = null,
1588+
15851589
/// Position Independent Code
15861590
force_pic: ?bool = null,
15871591

@@ -1861,6 +1865,10 @@ pub const LibExeObjStep = struct {
18611865
return run_step;
18621866
}
18631867

1868+
pub fn checkObject(self: *LibExeObjStep, obj_format: std.Target.ObjectFormat) *CheckObjectStep {
1869+
return CheckObjectStep.create(self.builder, self.getOutputSource(), obj_format);
1870+
}
1871+
18641872
pub fn setLinkerScriptPath(self: *LibExeObjStep, source: FileSource) void {
18651873
self.linker_script = source.dupe(self.builder);
18661874
source.addStepDependencies(&self.step);
@@ -2638,6 +2646,10 @@ pub const LibExeObjStep = struct {
26382646
if (self.entitlements) |entitlements| {
26392647
try zig_args.appendSlice(&[_][]const u8{ "--entitlements", entitlements });
26402648
}
2649+
if (self.pagezero_size) |pagezero_size| {
2650+
const size = try std.fmt.allocPrint(builder.allocator, "{x}", .{pagezero_size});
2651+
try zig_args.appendSlice(&[_][]const u8{ "-pagezero_size", size });
2652+
}
26412653

26422654
if (self.bundle_compiler_rt) |x| {
26432655
if (x) {
@@ -3443,6 +3455,7 @@ pub const Step = struct {
34433455
write_file,
34443456
run,
34453457
check_file,
3458+
check_object,
34463459
install_raw,
34473460
options,
34483461
custom,

0 commit comments

Comments
 (0)