commit faa1849f81fd1478f2340ab6ccdc8d71d1c5d102 (tree)
parent 49c11e0c3404b28af8b98994bad15db138272fa7
Author: Jakub Konka <kubkon@jakubkonka.com>
Date: Sat, 13 Jan 2024 19:09:40 +0100
test/link/macho: test for correct handling of __mh_execute_header symbol
Diffstat:
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/test/link/macho.zig b/test/link/macho.zig
@@ -10,6 +10,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
macho_step.dependOn(testDeadStrip(b, .{ .target = default_target }));
macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target }));
+ macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target }));
macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target }));
macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target }));
@@ -161,6 +162,19 @@ fn testEntryPointDylib(b: *Build, opts: Options) *Step {
return test_step;
}
+fn testMhExecuteHeader(b: *Build, opts: Options) *Step {
+ const test_step = addTestStep(b, "macho-mh-execute-header", opts);
+
+ const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" });
+
+ const check = exe.checkObject();
+ check.checkInSymtab();
+ check.checkContains("[referenced dynamically] external __mh_execute_header");
+ test_step.dependOn(&check.step);
+
+ return test_step;
+}
+
fn testNeededFramework(b: *Build, opts: Options) *Step {
const test_step = addTestStep(b, "macho-needed-framework", opts);