Skip to content

Commit a6fbdfa

Browse files
committed
link-tests: add -headerpad_size test scenario
1 parent 8c1feef commit a6fbdfa

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const std = @import("std");
2+
const Builder = std.build.Builder;
3+
4+
pub fn build(b: *Builder) void {
5+
const mode = b.standardReleaseOptions();
6+
7+
const test_step = b.step("test", "Test");
8+
test_step.dependOn(b.getInstallStep());
9+
10+
const exe = b.addExecutable("main", null);
11+
exe.setBuildMode(mode);
12+
exe.addCSourceFile("main.c", &.{});
13+
exe.linkLibC();
14+
exe.headerpad_size = 0x10000;
15+
16+
const check = exe.checkObject(.macho);
17+
check.checkStart("sectname __text");
18+
check.checkNext("offset {offset}");
19+
check.checkComputeCompare("offset", .{ .op = .gte, .value = .{ .literal = 0x10000 } });
20+
21+
test_step.dependOn(&check.step);
22+
23+
const run = exe.run();
24+
test_step.dependOn(&run.step);
25+
}

test/link/macho/headerpad_size/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
int main(int argc, char* argv[]) {
2+
return 0;
3+
}

0 commit comments

Comments
 (0)