Skip to content

Commit

Permalink
macho: test creating dylibs with no exports
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Jul 26, 2023
1 parent 3861a03 commit 5ea5e54
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/macho.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub fn addMachOTests(b: *Build, opts: Options) *Step {
macho_step.dependOn(testLayout(b, opts));
macho_step.dependOn(testNeededFramework(b, opts));
macho_step.dependOn(testNeededLibrary(b, opts));
macho_step.dependOn(testNoExportsDylib(b, opts));
macho_step.dependOn(testPagezeroSize(b, opts));
macho_step.dependOn(testSearchStrategy(b, opts));
macho_step.dependOn(testStackSize(b, opts));
Expand Down Expand Up @@ -525,6 +526,23 @@ fn testNeededLibrary(b: *Build, opts: Options) *Step {
return test_step;
}

fn testNoExportsDylib(b: *Build, opts: Options) *Step {
const test_step = b.step("test-macho-no-exports-dylib", "");

const dylib = cc(b, opts);
dylib.addCSource("static void abc() {}");
dylib.addArg("-shared");

const check = dylib.check();
check.checkStart();
check.checkExact("cmd SYMTAB");
check.checkExtract("nsyms {nsyms}");
check.checkComputeCompare("nsyms", .{ .op = .eq, .value = .{ .literal = 0 } });
test_step.dependOn(&check.step);

return test_step;
}

fn testPagezeroSize(b: *Build, opts: Options) *Step {
const test_step = b.step("test-macho-pagezero-size", "");

Expand Down

0 comments on commit 5ea5e54

Please sign in to comment.