mirror of
https://github.com/ziglang/zig.git
synced 2024-11-28 08:02:32 +00:00
link-tests: add -headerpad_size test scenario
This commit is contained in:
parent
8c1feef4cd
commit
a6fbdfabb9
25
test/link/macho/headerpad_size/build.zig
Normal file
25
test/link/macho/headerpad_size/build.zig
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
const Builder = std.build.Builder;
|
||||||
|
|
||||||
|
pub fn build(b: *Builder) void {
|
||||||
|
const mode = b.standardReleaseOptions();
|
||||||
|
|
||||||
|
const test_step = b.step("test", "Test");
|
||||||
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
|
const exe = b.addExecutable("main", null);
|
||||||
|
exe.setBuildMode(mode);
|
||||||
|
exe.addCSourceFile("main.c", &.{});
|
||||||
|
exe.linkLibC();
|
||||||
|
exe.headerpad_size = 0x10000;
|
||||||
|
|
||||||
|
const check = exe.checkObject(.macho);
|
||||||
|
check.checkStart("sectname __text");
|
||||||
|
check.checkNext("offset {offset}");
|
||||||
|
check.checkComputeCompare("offset", .{ .op = .gte, .value = .{ .literal = 0x10000 } });
|
||||||
|
|
||||||
|
test_step.dependOn(&check.step);
|
||||||
|
|
||||||
|
const run = exe.run();
|
||||||
|
test_step.dependOn(&run.step);
|
||||||
|
}
|
3
test/link/macho/headerpad_size/main.c
Normal file
3
test/link/macho/headerpad_size/main.c
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user