authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-01-13 19:09:40+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-01-24 12:34:39+01:00
logfaa1849f81fd1478f2340ab6ccdc8d71d1c5d102
tree5c2b5e8a5147a6075436d63c1c4aa41504361957
parent49c11e0c3404b28af8b98994bad15db138272fa7

test/link/macho: test for correct handling of __mh_execute_header symbol


1 files changed, 14 insertions(+), 0 deletions(-)

test/link/macho.zig+14
...@@ -10,6 +10,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {...@@ -10,6 +10,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
1010
11 macho_step.dependOn(testDeadStrip(b, .{ .target = default_target }));11 macho_step.dependOn(testDeadStrip(b, .{ .target = default_target }));
12 macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target }));12 macho_step.dependOn(testEntryPointDylib(b, .{ .target = default_target }));
13 macho_step.dependOn(testMhExecuteHeader(b, .{ .target = default_target }));
13 macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target }));14 macho_step.dependOn(testSectionBoundarySymbols(b, .{ .target = default_target }));
14 macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target }));15 macho_step.dependOn(testSegmentBoundarySymbols(b, .{ .target = default_target }));
1516
...@@ -161,6 +162,19 @@ fn testEntryPointDylib(b: *Build, opts: Options) *Step {...@@ -161,6 +162,19 @@ fn testEntryPointDylib(b: *Build, opts: Options) *Step {
161 return test_step;162 return test_step;
162}163}
163164
165fn testMhExecuteHeader(b: *Build, opts: Options) *Step {
166 const test_step = addTestStep(b, "macho-mh-execute-header", opts);
167
168 const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" });
169
170 const check = exe.checkObject();
171 check.checkInSymtab();
172 check.checkContains("[referenced dynamically] external __mh_execute_header");
173 test_step.dependOn(&check.step);
174
175 return test_step;
176}
177
164fn testNeededFramework(b: *Build, opts: Options) *Step {178fn testNeededFramework(b: *Build, opts: Options) *Step {
165 const test_step = addTestStep(b, "macho-needed-framework", opts);179 const test_step = addTestStep(b, "macho-needed-framework", opts);
166180