| ... | @@ -91,7 +91,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -91,7 +91,7 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 91 | } | 91 | } |
| 92 | | 92 | |
| 93 | fn testDeadStrip(b: *Build, opts: Options) *Step { | 93 | fn testDeadStrip(b: *Build, opts: Options) *Step { |
| 94 | const test_step = addTestStep(b, "macho-dead-strip", opts); | 94 | const test_step = addTestStep(b, "dead-strip", opts); |
| 95 | | 95 | |
| 96 | const obj = addObject(b, opts, .{ .name = "a", .cpp_source_bytes = | 96 | const obj = addObject(b, opts, .{ .name = "a", .cpp_source_bytes = |
| 97 | \\#include <stdio.h> | 97 | \\#include <stdio.h> |
| ... | @@ -172,7 +172,7 @@ fn testDeadStrip(b: *Build, opts: Options) *Step { | ... | @@ -172,7 +172,7 @@ fn testDeadStrip(b: *Build, opts: Options) *Step { |
| 172 | } | 172 | } |
| 173 | | 173 | |
| 174 | fn testDeadStripDylibs(b: *Build, opts: Options) *Step { | 174 | fn testDeadStripDylibs(b: *Build, opts: Options) *Step { |
| 175 | const test_step = addTestStep(b, "macho-dead-strip-dylibs", opts); | 175 | const test_step = addTestStep(b, "dead-strip-dylibs", opts); |
| 176 | | 176 | |
| 177 | const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = | 177 | const main_o = addObject(b, opts, .{ .name = "main", .c_source_bytes = |
| 178 | \\#include <objc/runtime.h> | 178 | \\#include <objc/runtime.h> |
| ... | @@ -221,7 +221,7 @@ fn testDeadStripDylibs(b: *Build, opts: Options) *Step { | ... | @@ -221,7 +221,7 @@ fn testDeadStripDylibs(b: *Build, opts: Options) *Step { |
| 221 | } | 221 | } |
| 222 | | 222 | |
| 223 | fn testDylib(b: *Build, opts: Options) *Step { | 223 | fn testDylib(b: *Build, opts: Options) *Step { |
| 224 | const test_step = addTestStep(b, "macho-dylib", opts); | 224 | const test_step = addTestStep(b, "dylib", opts); |
| 225 | | 225 | |
| 226 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = | 226 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = |
| 227 | \\#include<stdio.h> | 227 | \\#include<stdio.h> |
| ... | @@ -258,7 +258,7 @@ fn testDylib(b: *Build, opts: Options) *Step { | ... | @@ -258,7 +258,7 @@ fn testDylib(b: *Build, opts: Options) *Step { |
| 258 | } | 258 | } |
| 259 | | 259 | |
| 260 | fn testDylibVersionTbd(b: *Build, opts: Options) *Step { | 260 | fn testDylibVersionTbd(b: *Build, opts: Options) *Step { |
| 261 | const test_step = addTestStep(b, "macho-dylib-version-tbd", opts); | 261 | const test_step = addTestStep(b, "dylib-version-tbd", opts); |
| 262 | | 262 | |
| 263 | const tbd = tbd: { | 263 | const tbd = tbd: { |
| 264 | const wf = WriteFile.create(b); | 264 | const wf = WriteFile.create(b); |
| ... | @@ -294,7 +294,7 @@ fn testDylibVersionTbd(b: *Build, opts: Options) *Step { | ... | @@ -294,7 +294,7 @@ fn testDylibVersionTbd(b: *Build, opts: Options) *Step { |
| 294 | } | 294 | } |
| 295 | | 295 | |
| 296 | fn testEmptyObject(b: *Build, opts: Options) *Step { | 296 | fn testEmptyObject(b: *Build, opts: Options) *Step { |
| 297 | const test_step = addTestStep(b, "macho-empty-object", opts); | 297 | const test_step = addTestStep(b, "empty-object", opts); |
| 298 | | 298 | |
| 299 | const empty = addObject(b, opts, .{ .name = "empty", .c_source_bytes = "" }); | 299 | const empty = addObject(b, opts, .{ .name = "empty", .c_source_bytes = "" }); |
| 300 | | 300 | |
| ... | @@ -314,7 +314,7 @@ fn testEmptyObject(b: *Build, opts: Options) *Step { | ... | @@ -314,7 +314,7 @@ fn testEmptyObject(b: *Build, opts: Options) *Step { |
| 314 | } | 314 | } |
| 315 | | 315 | |
| 316 | fn testEmptyZig(b: *Build, opts: Options) *Step { | 316 | fn testEmptyZig(b: *Build, opts: Options) *Step { |
| 317 | const test_step = addTestStep(b, "macho-empty-zig", opts); | 317 | const test_step = addTestStep(b, "empty-zig", opts); |
| 318 | | 318 | |
| 319 | const exe = addExecutable(b, opts, .{ .name = "empty", .zig_source_bytes = "pub fn main() void {}" }); | 319 | const exe = addExecutable(b, opts, .{ .name = "empty", .zig_source_bytes = "pub fn main() void {}" }); |
| 320 | | 320 | |
| ... | @@ -326,7 +326,7 @@ fn testEmptyZig(b: *Build, opts: Options) *Step { | ... | @@ -326,7 +326,7 @@ fn testEmptyZig(b: *Build, opts: Options) *Step { |
| 326 | } | 326 | } |
| 327 | | 327 | |
| 328 | fn testEntryPoint(b: *Build, opts: Options) *Step { | 328 | fn testEntryPoint(b: *Build, opts: Options) *Step { |
| 329 | const test_step = addTestStep(b, "macho-entry-point", opts); | 329 | const test_step = addTestStep(b, "entry-point", opts); |
| 330 | | 330 | |
| 331 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = | 331 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| 332 | \\#include<stdio.h> | 332 | \\#include<stdio.h> |
| ... | @@ -357,7 +357,7 @@ fn testEntryPoint(b: *Build, opts: Options) *Step { | ... | @@ -357,7 +357,7 @@ fn testEntryPoint(b: *Build, opts: Options) *Step { |
| 357 | } | 357 | } |
| 358 | | 358 | |
| 359 | fn testEntryPointArchive(b: *Build, opts: Options) *Step { | 359 | fn testEntryPointArchive(b: *Build, opts: Options) *Step { |
| 360 | const test_step = addTestStep(b, "macho-entry-point-archive", opts); | 360 | const test_step = addTestStep(b, "entry-point-archive", opts); |
| 361 | | 361 | |
| 362 | const lib = addStaticLibrary(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); | 362 | const lib = addStaticLibrary(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); |
| 363 | | 363 | |
| ... | @@ -386,7 +386,7 @@ fn testEntryPointArchive(b: *Build, opts: Options) *Step { | ... | @@ -386,7 +386,7 @@ fn testEntryPointArchive(b: *Build, opts: Options) *Step { |
| 386 | } | 386 | } |
| 387 | | 387 | |
| 388 | fn testEntryPointDylib(b: *Build, opts: Options) *Step { | 388 | fn testEntryPointDylib(b: *Build, opts: Options) *Step { |
| 389 | const test_step = addTestStep(b, "macho-entry-point-dylib", opts); | 389 | const test_step = addTestStep(b, "entry-point-dylib", opts); |
| 390 | | 390 | |
| 391 | const dylib = addSharedLibrary(b, opts, .{ .name = "a" }); | 391 | const dylib = addSharedLibrary(b, opts, .{ .name = "a" }); |
| 392 | addCSourceBytes(dylib, | 392 | addCSourceBytes(dylib, |
| ... | @@ -440,7 +440,7 @@ fn testEntryPointDylib(b: *Build, opts: Options) *Step { | ... | @@ -440,7 +440,7 @@ fn testEntryPointDylib(b: *Build, opts: Options) *Step { |
| 440 | } | 440 | } |
| 441 | | 441 | |
| 442 | fn testHeaderpad(b: *Build, opts: Options) *Step { | 442 | fn testHeaderpad(b: *Build, opts: Options) *Step { |
| 443 | const test_step = addTestStep(b, "macho-headerpad", opts); | 443 | const test_step = addTestStep(b, "headerpad", opts); |
| 444 | | 444 | |
| 445 | const addExe = struct { | 445 | const addExe = struct { |
| 446 | fn addExe(bb: *Build, o: Options, name: []const u8) *Compile { | 446 | fn addExe(bb: *Build, o: Options, name: []const u8) *Compile { |
| ... | @@ -548,7 +548,7 @@ fn testHeaderpad(b: *Build, opts: Options) *Step { | ... | @@ -548,7 +548,7 @@ fn testHeaderpad(b: *Build, opts: Options) *Step { |
| 548 | | 548 | |
| 549 | // Adapted from https://github.com/llvm/llvm-project/blob/main/lld/test/MachO/weak-header-flags.s | 549 | // Adapted from https://github.com/llvm/llvm-project/blob/main/lld/test/MachO/weak-header-flags.s |
| 550 | fn testHeaderWeakFlags(b: *Build, opts: Options) *Step { | 550 | fn testHeaderWeakFlags(b: *Build, opts: Options) *Step { |
| 551 | const test_step = addTestStep(b, "macho-header-weak-flags", opts); | 551 | const test_step = addTestStep(b, "header-weak-flags", opts); |
| 552 | | 552 | |
| 553 | const obj1 = addObject(b, opts, .{ .name = "a", .asm_source_bytes = | 553 | const obj1 = addObject(b, opts, .{ .name = "a", .asm_source_bytes = |
| 554 | \\.globl _x | 554 | \\.globl _x |
| ... | @@ -635,7 +635,7 @@ fn testHeaderWeakFlags(b: *Build, opts: Options) *Step { | ... | @@ -635,7 +635,7 @@ fn testHeaderWeakFlags(b: *Build, opts: Options) *Step { |
| 635 | } | 635 | } |
| 636 | | 636 | |
| 637 | fn testHelloC(b: *Build, opts: Options) *Step { | 637 | fn testHelloC(b: *Build, opts: Options) *Step { |
| 638 | const test_step = addTestStep(b, "macho-hello-c", opts); | 638 | const test_step = addTestStep(b, "hello-c", opts); |
| 639 | | 639 | |
| 640 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = | 640 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| 641 | \\#include <stdio.h> | 641 | \\#include <stdio.h> |
| ... | @@ -659,7 +659,7 @@ fn testHelloC(b: *Build, opts: Options) *Step { | ... | @@ -659,7 +659,7 @@ fn testHelloC(b: *Build, opts: Options) *Step { |
| 659 | } | 659 | } |
| 660 | | 660 | |
| 661 | fn testHelloZig(b: *Build, opts: Options) *Step { | 661 | fn testHelloZig(b: *Build, opts: Options) *Step { |
| 662 | const test_step = addTestStep(b, "macho-hello-zig", opts); | 662 | const test_step = addTestStep(b, "hello-zig", opts); |
| 663 | | 663 | |
| 664 | const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = | 664 | const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes = |
| 665 | \\const std = @import("std"); | 665 | \\const std = @import("std"); |
| ... | @@ -676,7 +676,7 @@ fn testHelloZig(b: *Build, opts: Options) *Step { | ... | @@ -676,7 +676,7 @@ fn testHelloZig(b: *Build, opts: Options) *Step { |
| 676 | } | 676 | } |
| 677 | | 677 | |
| 678 | fn testLargeBss(b: *Build, opts: Options) *Step { | 678 | fn testLargeBss(b: *Build, opts: Options) *Step { |
| 679 | const test_step = addTestStep(b, "macho-large-bss", opts); | 679 | const test_step = addTestStep(b, "large-bss", opts); |
| 680 | | 680 | |
| 681 | // TODO this test used use a 4GB zerofill section but this actually fails and causes every | 681 | // TODO this test used use a 4GB zerofill section but this actually fails and causes every |
| 682 | // linker I tried misbehave in different ways. This only happened on arm64. I thought that | 682 | // linker I tried misbehave in different ways. This only happened on arm64. I thought that |
| ... | @@ -697,7 +697,7 @@ fn testLargeBss(b: *Build, opts: Options) *Step { | ... | @@ -697,7 +697,7 @@ fn testLargeBss(b: *Build, opts: Options) *Step { |
| 697 | } | 697 | } |
| 698 | | 698 | |
| 699 | fn testLayout(b: *Build, opts: Options) *Step { | 699 | fn testLayout(b: *Build, opts: Options) *Step { |
| 700 | const test_step = addTestStep(b, "macho-layout", opts); | 700 | const test_step = addTestStep(b, "layout", opts); |
| 701 | | 701 | |
| 702 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = | 702 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| 703 | \\#include <stdio.h> | 703 | \\#include <stdio.h> |
| ... | @@ -816,7 +816,7 @@ fn testLayout(b: *Build, opts: Options) *Step { | ... | @@ -816,7 +816,7 @@ fn testLayout(b: *Build, opts: Options) *Step { |
| 816 | } | 816 | } |
| 817 | | 817 | |
| 818 | fn testLinkDirectlyCppTbd(b: *Build, opts: Options) *Step { | 818 | fn testLinkDirectlyCppTbd(b: *Build, opts: Options) *Step { |
| 819 | const test_step = addTestStep(b, "macho-link-directly-cpp-tbd", opts); | 819 | const test_step = addTestStep(b, "link-directly-cpp-tbd", opts); |
| 820 | | 820 | |
| 821 | const sdk = std.zig.system.darwin.getSdk(b.allocator, opts.target.result) orelse | 821 | const sdk = std.zig.system.darwin.getSdk(b.allocator, opts.target.result) orelse |
| 822 | @panic("macOS SDK is required to run the test"); | 822 | @panic("macOS SDK is required to run the test"); |
| ... | @@ -887,7 +887,7 @@ fn testLinkingStaticLib(b: *Build, opts: Options) *Step { | ... | @@ -887,7 +887,7 @@ fn testLinkingStaticLib(b: *Build, opts: Options) *Step { |
| 887 | } | 887 | } |
| 888 | | 888 | |
| 889 | fn testLinksection(b: *Build, opts: Options) *Step { | 889 | fn testLinksection(b: *Build, opts: Options) *Step { |
| 890 | const test_step = addTestStep(b, "macho-linksection", opts); | 890 | const test_step = addTestStep(b, "linksection", opts); |
| 891 | | 891 | |
| 892 | const obj = addObject(b, opts, .{ .name = "main", .zig_source_bytes = | 892 | const obj = addObject(b, opts, .{ .name = "main", .zig_source_bytes = |
| 893 | \\export var test_global: u32 linksection("__DATA,__TestGlobal") = undefined; | 893 | \\export var test_global: u32 linksection("__DATA,__TestGlobal") = undefined; |
| ... | @@ -914,7 +914,7 @@ fn testLinksection(b: *Build, opts: Options) *Step { | ... | @@ -914,7 +914,7 @@ fn testLinksection(b: *Build, opts: Options) *Step { |
| 914 | } | 914 | } |
| 915 | | 915 | |
| 916 | fn testMhExecuteHeader(b: *Build, opts: Options) *Step { | 916 | fn testMhExecuteHeader(b: *Build, opts: Options) *Step { |
| 917 | const test_step = addTestStep(b, "macho-mh-execute-header", opts); | 917 | const test_step = addTestStep(b, "mh-execute-header", opts); |
| 918 | | 918 | |
| 919 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); | 919 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); |
| 920 | | 920 | |
| ... | @@ -927,7 +927,7 @@ fn testMhExecuteHeader(b: *Build, opts: Options) *Step { | ... | @@ -927,7 +927,7 @@ fn testMhExecuteHeader(b: *Build, opts: Options) *Step { |
| 927 | } | 927 | } |
| 928 | | 928 | |
| 929 | fn testNoDeadStrip(b: *Build, opts: Options) *Step { | 929 | fn testNoDeadStrip(b: *Build, opts: Options) *Step { |
| 930 | const test_step = addTestStep(b, "macho-no-dead-strip", opts); | 930 | const test_step = addTestStep(b, "no-dead-strip", opts); |
| 931 | | 931 | |
| 932 | const exe = addExecutable(b, opts, .{ .name = "name", .c_source_bytes = | 932 | const exe = addExecutable(b, opts, .{ .name = "name", .c_source_bytes = |
| 933 | \\__attribute__((used)) int bogus1 = 0; | 933 | \\__attribute__((used)) int bogus1 = 0; |
| ... | @@ -954,7 +954,7 @@ fn testNoDeadStrip(b: *Build, opts: Options) *Step { | ... | @@ -954,7 +954,7 @@ fn testNoDeadStrip(b: *Build, opts: Options) *Step { |
| 954 | } | 954 | } |
| 955 | | 955 | |
| 956 | fn testNoExportsDylib(b: *Build, opts: Options) *Step { | 956 | fn testNoExportsDylib(b: *Build, opts: Options) *Step { |
| 957 | const test_step = addTestStep(b, "macho-no-exports-dylib", opts); | 957 | const test_step = addTestStep(b, "no-exports-dylib", opts); |
| 958 | | 958 | |
| 959 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = "static void abc() {}" }); | 959 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = "static void abc() {}" }); |
| 960 | | 960 | |
| ... | @@ -967,7 +967,7 @@ fn testNoExportsDylib(b: *Build, opts: Options) *Step { | ... | @@ -967,7 +967,7 @@ fn testNoExportsDylib(b: *Build, opts: Options) *Step { |
| 967 | } | 967 | } |
| 968 | | 968 | |
| 969 | fn testNeededFramework(b: *Build, opts: Options) *Step { | 969 | fn testNeededFramework(b: *Build, opts: Options) *Step { |
| 970 | const test_step = addTestStep(b, "macho-needed-framework", opts); | 970 | const test_step = addTestStep(b, "needed-framework", opts); |
| 971 | | 971 | |
| 972 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); | 972 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); |
| 973 | exe.root_module.linkFramework("Cocoa", .{ .needed = true }); | 973 | exe.root_module.linkFramework("Cocoa", .{ .needed = true }); |
| ... | @@ -987,7 +987,7 @@ fn testNeededFramework(b: *Build, opts: Options) *Step { | ... | @@ -987,7 +987,7 @@ fn testNeededFramework(b: *Build, opts: Options) *Step { |
| 987 | } | 987 | } |
| 988 | | 988 | |
| 989 | fn testNeededLibrary(b: *Build, opts: Options) *Step { | 989 | fn testNeededLibrary(b: *Build, opts: Options) *Step { |
| 990 | const test_step = addTestStep(b, "macho-needed-library", opts); | 990 | const test_step = addTestStep(b, "needed-library", opts); |
| 991 | | 991 | |
| 992 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = "int a = 42;" }); | 992 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = "int a = 42;" }); |
| 993 | | 993 | |
| ... | @@ -1011,7 +1011,7 @@ fn testNeededLibrary(b: *Build, opts: Options) *Step { | ... | @@ -1011,7 +1011,7 @@ fn testNeededLibrary(b: *Build, opts: Options) *Step { |
| 1011 | } | 1011 | } |
| 1012 | | 1012 | |
| 1013 | fn testObjc(b: *Build, opts: Options) *Step { | 1013 | fn testObjc(b: *Build, opts: Options) *Step { |
| 1014 | const test_step = addTestStep(b, "macho-objc", opts); | 1014 | const test_step = addTestStep(b, "objc", opts); |
| 1015 | | 1015 | |
| 1016 | const lib = addStaticLibrary(b, opts, .{ .name = "a", .objc_source_bytes = | 1016 | const lib = addStaticLibrary(b, opts, .{ .name = "a", .objc_source_bytes = |
| 1017 | \\#import <Foundation/Foundation.h> | 1017 | \\#import <Foundation/Foundation.h> |
| ... | @@ -1058,7 +1058,7 @@ fn testObjc(b: *Build, opts: Options) *Step { | ... | @@ -1058,7 +1058,7 @@ fn testObjc(b: *Build, opts: Options) *Step { |
| 1058 | } | 1058 | } |
| 1059 | | 1059 | |
| 1060 | fn testObjcpp(b: *Build, opts: Options) *Step { | 1060 | fn testObjcpp(b: *Build, opts: Options) *Step { |
| 1061 | const test_step = addTestStep(b, "macho-objcpp", opts); | 1061 | const test_step = addTestStep(b, "objcpp", opts); |
| 1062 | | 1062 | |
| 1063 | const foo_h = foo_h: { | 1063 | const foo_h = foo_h: { |
| 1064 | const wf = WriteFile.create(b); | 1064 | const wf = WriteFile.create(b); |
| ... | @@ -1111,7 +1111,7 @@ fn testObjcpp(b: *Build, opts: Options) *Step { | ... | @@ -1111,7 +1111,7 @@ fn testObjcpp(b: *Build, opts: Options) *Step { |
| 1111 | } | 1111 | } |
| 1112 | | 1112 | |
| 1113 | fn testPagezeroSize(b: *Build, opts: Options) *Step { | 1113 | fn testPagezeroSize(b: *Build, opts: Options) *Step { |
| 1114 | const test_step = addTestStep(b, "macho-pagezero-size", opts); | 1114 | const test_step = addTestStep(b, "pagezero-size", opts); |
| 1115 | | 1115 | |
| 1116 | { | 1116 | { |
| 1117 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main () { return 0; }" }); | 1117 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main () { return 0; }" }); |
| ... | @@ -1145,7 +1145,7 @@ fn testPagezeroSize(b: *Build, opts: Options) *Step { | ... | @@ -1145,7 +1145,7 @@ fn testPagezeroSize(b: *Build, opts: Options) *Step { |
| 1145 | } | 1145 | } |
| 1146 | | 1146 | |
| 1147 | fn testReexportsZig(b: *Build, opts: Options) *Step { | 1147 | fn testReexportsZig(b: *Build, opts: Options) *Step { |
| 1148 | const test_step = addTestStep(b, "macho-reexports-zig", opts); | 1148 | const test_step = addTestStep(b, "reexports-zig", opts); |
| 1149 | | 1149 | |
| 1150 | const lib = addStaticLibrary(b, opts, .{ .name = "a", .zig_source_bytes = | 1150 | const lib = addStaticLibrary(b, opts, .{ .name = "a", .zig_source_bytes = |
| 1151 | \\const x: i32 = 42; | 1151 | \\const x: i32 = 42; |
| ... | @@ -1174,7 +1174,7 @@ fn testReexportsZig(b: *Build, opts: Options) *Step { | ... | @@ -1174,7 +1174,7 @@ fn testReexportsZig(b: *Build, opts: Options) *Step { |
| 1174 | } | 1174 | } |
| 1175 | | 1175 | |
| 1176 | fn testRelocatable(b: *Build, opts: Options) *Step { | 1176 | fn testRelocatable(b: *Build, opts: Options) *Step { |
| 1177 | const test_step = addTestStep(b, "macho-relocatable", opts); | 1177 | const test_step = addTestStep(b, "relocatable", opts); |
| 1178 | | 1178 | |
| 1179 | const a_o = addObject(b, opts, .{ .name = "a", .cpp_source_bytes = | 1179 | const a_o = addObject(b, opts, .{ .name = "a", .cpp_source_bytes = |
| 1180 | \\#include <stdexcept> | 1180 | \\#include <stdexcept> |
| ... | @@ -1242,7 +1242,7 @@ fn testRelocatable(b: *Build, opts: Options) *Step { | ... | @@ -1242,7 +1242,7 @@ fn testRelocatable(b: *Build, opts: Options) *Step { |
| 1242 | } | 1242 | } |
| 1243 | | 1243 | |
| 1244 | fn testRelocatableZig(b: *Build, opts: Options) *Step { | 1244 | fn testRelocatableZig(b: *Build, opts: Options) *Step { |
| 1245 | const test_step = addTestStep(b, "macho-relocatable-zig", opts); | 1245 | const test_step = addTestStep(b, "relocatable-zig", opts); |
| 1246 | | 1246 | |
| 1247 | const a_o = addObject(b, opts, .{ .name = "a", .zig_source_bytes = | 1247 | const a_o = addObject(b, opts, .{ .name = "a", .zig_source_bytes = |
| 1248 | \\const std = @import("std"); | 1248 | \\const std = @import("std"); |
| ... | @@ -1293,7 +1293,7 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step { | ... | @@ -1293,7 +1293,7 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step { |
| 1293 | } | 1293 | } |
| 1294 | | 1294 | |
| 1295 | fn testSearchStrategy(b: *Build, opts: Options) *Step { | 1295 | fn testSearchStrategy(b: *Build, opts: Options) *Step { |
| 1296 | const test_step = addTestStep(b, "macho-search-strategy", opts); | 1296 | const test_step = addTestStep(b, "search-strategy", opts); |
| 1297 | | 1297 | |
| 1298 | const obj = addObject(b, opts, .{ .name = "a", .c_source_bytes = | 1298 | const obj = addObject(b, opts, .{ .name = "a", .c_source_bytes = |
| 1299 | \\#include<stdio.h> | 1299 | \\#include<stdio.h> |
| ... | @@ -1361,7 +1361,7 @@ fn testSearchStrategy(b: *Build, opts: Options) *Step { | ... | @@ -1361,7 +1361,7 @@ fn testSearchStrategy(b: *Build, opts: Options) *Step { |
| 1361 | } | 1361 | } |
| 1362 | | 1362 | |
| 1363 | fn testSectionBoundarySymbols(b: *Build, opts: Options) *Step { | 1363 | fn testSectionBoundarySymbols(b: *Build, opts: Options) *Step { |
| 1364 | const test_step = addTestStep(b, "macho-section-boundary-symbols", opts); | 1364 | const test_step = addTestStep(b, "section-boundary-symbols", opts); |
| 1365 | | 1365 | |
| 1366 | const obj1 = addObject(b, opts, .{ | 1366 | const obj1 = addObject(b, opts, .{ |
| 1367 | .name = "obj1", | 1367 | .name = "obj1", |
| ... | @@ -1441,7 +1441,7 @@ fn testSectionBoundarySymbols(b: *Build, opts: Options) *Step { | ... | @@ -1441,7 +1441,7 @@ fn testSectionBoundarySymbols(b: *Build, opts: Options) *Step { |
| 1441 | } | 1441 | } |
| 1442 | | 1442 | |
| 1443 | fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { | 1443 | fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { |
| 1444 | const test_step = addTestStep(b, "macho-segment-boundary-symbols", opts); | 1444 | const test_step = addTestStep(b, "segment-boundary-symbols", opts); |
| 1445 | | 1445 | |
| 1446 | const obj1 = addObject(b, opts, .{ .name = "a", .cpp_source_bytes = | 1446 | const obj1 = addObject(b, opts, .{ .name = "a", .cpp_source_bytes = |
| 1447 | \\constexpr const char* MESSAGE __attribute__((used, section("__DATA_CONST_1,__message_ptr"))) = "codebase"; | 1447 | \\constexpr const char* MESSAGE __attribute__((used, section("__DATA_CONST_1,__message_ptr"))) = "codebase"; |
| ... | @@ -1509,7 +1509,7 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { | ... | @@ -1509,7 +1509,7 @@ fn testSegmentBoundarySymbols(b: *Build, opts: Options) *Step { |
| 1509 | } | 1509 | } |
| 1510 | | 1510 | |
| 1511 | fn testStackSize(b: *Build, opts: Options) *Step { | 1511 | fn testStackSize(b: *Build, opts: Options) *Step { |
| 1512 | const test_step = addTestStep(b, "macho-stack-size", opts); | 1512 | const test_step = addTestStep(b, "stack-size", opts); |
| 1513 | | 1513 | |
| 1514 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); | 1514 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); |
| 1515 | exe.stack_size = 0x100000000; | 1515 | exe.stack_size = 0x100000000; |
| ... | @@ -1528,7 +1528,7 @@ fn testStackSize(b: *Build, opts: Options) *Step { | ... | @@ -1528,7 +1528,7 @@ fn testStackSize(b: *Build, opts: Options) *Step { |
| 1528 | } | 1528 | } |
| 1529 | | 1529 | |
| 1530 | fn testTbdv3(b: *Build, opts: Options) *Step { | 1530 | fn testTbdv3(b: *Build, opts: Options) *Step { |
| 1531 | const test_step = addTestStep(b, "macho-tbdv3", opts); | 1531 | const test_step = addTestStep(b, "tbdv3", opts); |
| 1532 | | 1532 | |
| 1533 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = "int getFoo() { return 42; }" }); | 1533 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = "int getFoo() { return 42; }" }); |
| 1534 | | 1534 | |
| ... | @@ -1566,7 +1566,7 @@ fn testTbdv3(b: *Build, opts: Options) *Step { | ... | @@ -1566,7 +1566,7 @@ fn testTbdv3(b: *Build, opts: Options) *Step { |
| 1566 | } | 1566 | } |
| 1567 | | 1567 | |
| 1568 | fn testTentative(b: *Build, opts: Options) *Step { | 1568 | fn testTentative(b: *Build, opts: Options) *Step { |
| 1569 | const test_step = addTestStep(b, "macho-tentative", opts); | 1569 | const test_step = addTestStep(b, "tentative", opts); |
| 1570 | | 1570 | |
| 1571 | const exe = addExecutable(b, opts, .{ .name = "main" }); | 1571 | const exe = addExecutable(b, opts, .{ .name = "main" }); |
| 1572 | addCSourceBytes(exe, | 1572 | addCSourceBytes(exe, |
| ... | @@ -1592,7 +1592,7 @@ fn testTentative(b: *Build, opts: Options) *Step { | ... | @@ -1592,7 +1592,7 @@ fn testTentative(b: *Build, opts: Options) *Step { |
| 1592 | } | 1592 | } |
| 1593 | | 1593 | |
| 1594 | fn testThunks(b: *Build, opts: Options) *Step { | 1594 | fn testThunks(b: *Build, opts: Options) *Step { |
| 1595 | const test_step = addTestStep(b, "macho-thunks", opts); | 1595 | const test_step = addTestStep(b, "thunks", opts); |
| 1596 | | 1596 | |
| 1597 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = | 1597 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| 1598 | \\#include <stdio.h> | 1598 | \\#include <stdio.h> |
| ... | @@ -1621,7 +1621,7 @@ fn testThunks(b: *Build, opts: Options) *Step { | ... | @@ -1621,7 +1621,7 @@ fn testThunks(b: *Build, opts: Options) *Step { |
| 1621 | } | 1621 | } |
| 1622 | | 1622 | |
| 1623 | fn testTls(b: *Build, opts: Options) *Step { | 1623 | fn testTls(b: *Build, opts: Options) *Step { |
| 1624 | const test_step = addTestStep(b, "macho-tls", opts); | 1624 | const test_step = addTestStep(b, "tls", opts); |
| 1625 | | 1625 | |
| 1626 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = | 1626 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = |
| 1627 | \\_Thread_local int a; | 1627 | \\_Thread_local int a; |
| ... | @@ -1655,7 +1655,7 @@ fn testTls(b: *Build, opts: Options) *Step { | ... | @@ -1655,7 +1655,7 @@ fn testTls(b: *Build, opts: Options) *Step { |
| 1655 | } | 1655 | } |
| 1656 | | 1656 | |
| 1657 | fn testTlsLargeTbss(b: *Build, opts: Options) *Step { | 1657 | fn testTlsLargeTbss(b: *Build, opts: Options) *Step { |
| 1658 | const test_step = addTestStep(b, "macho-tls-large-tbss", opts); | 1658 | const test_step = addTestStep(b, "tls-large-tbss", opts); |
| 1659 | | 1659 | |
| 1660 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = | 1660 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| 1661 | \\#include <stdio.h> | 1661 | \\#include <stdio.h> |
| ... | @@ -1676,7 +1676,7 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step { | ... | @@ -1676,7 +1676,7 @@ fn testTlsLargeTbss(b: *Build, opts: Options) *Step { |
| 1676 | } | 1676 | } |
| 1677 | | 1677 | |
| 1678 | fn testTwoLevelNamespace(b: *Build, opts: Options) *Step { | 1678 | fn testTwoLevelNamespace(b: *Build, opts: Options) *Step { |
| 1679 | const test_step = addTestStep(b, "macho-two-level-namespace", opts); | 1679 | const test_step = addTestStep(b, "two-level-namespace", opts); |
| 1680 | | 1680 | |
| 1681 | const liba = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = | 1681 | const liba = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = |
| 1682 | \\#include <stdio.h> | 1682 | \\#include <stdio.h> |
| ... | @@ -1796,7 +1796,7 @@ fn testTwoLevelNamespace(b: *Build, opts: Options) *Step { | ... | @@ -1796,7 +1796,7 @@ fn testTwoLevelNamespace(b: *Build, opts: Options) *Step { |
| 1796 | } | 1796 | } |
| 1797 | | 1797 | |
| 1798 | fn testUndefinedFlag(b: *Build, opts: Options) *Step { | 1798 | fn testUndefinedFlag(b: *Build, opts: Options) *Step { |
| 1799 | const test_step = addTestStep(b, "macho-undefined-flag", opts); | 1799 | const test_step = addTestStep(b, "undefined-flag", opts); |
| 1800 | | 1800 | |
| 1801 | const obj = addObject(b, opts, .{ .name = "a", .c_source_bytes = "int foo = 42;" }); | 1801 | const obj = addObject(b, opts, .{ .name = "a", .c_source_bytes = "int foo = 42;" }); |
| 1802 | | 1802 | |
| ... | @@ -1873,7 +1873,7 @@ fn testUndefinedFlag(b: *Build, opts: Options) *Step { | ... | @@ -1873,7 +1873,7 @@ fn testUndefinedFlag(b: *Build, opts: Options) *Step { |
| 1873 | } | 1873 | } |
| 1874 | | 1874 | |
| 1875 | fn testUnwindInfo(b: *Build, opts: Options) *Step { | 1875 | fn testUnwindInfo(b: *Build, opts: Options) *Step { |
| 1876 | const test_step = addTestStep(b, "macho-unwind-info", opts); | 1876 | const test_step = addTestStep(b, "unwind-info", opts); |
| 1877 | | 1877 | |
| 1878 | const all_h = all_h: { | 1878 | const all_h = all_h: { |
| 1879 | const wf = WriteFile.create(b); | 1879 | const wf = WriteFile.create(b); |
| ... | @@ -2031,7 +2031,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step { | ... | @@ -2031,7 +2031,7 @@ fn testUnwindInfo(b: *Build, opts: Options) *Step { |
| 2031 | } | 2031 | } |
| 2032 | | 2032 | |
| 2033 | fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step { | 2033 | fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step { |
| 2034 | const test_step = addTestStep(b, "macho-unwind-info-no-subsections-arm64", opts); | 2034 | const test_step = addTestStep(b, "unwind-info-no-subsections-arm64", opts); |
| 2035 | | 2035 | |
| 2036 | const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = | 2036 | const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = |
| 2037 | \\.globl _foo | 2037 | \\.globl _foo |
| ... | @@ -2091,7 +2091,7 @@ fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step { | ... | @@ -2091,7 +2091,7 @@ fn testUnwindInfoNoSubsectionsArm64(b: *Build, opts: Options) *Step { |
| 2091 | } | 2091 | } |
| 2092 | | 2092 | |
| 2093 | fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step { | 2093 | fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step { |
| 2094 | const test_step = addTestStep(b, "macho-unwind-info-no-subsections-x64", opts); | 2094 | const test_step = addTestStep(b, "unwind-info-no-subsections-x64", opts); |
| 2095 | | 2095 | |
| 2096 | const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = | 2096 | const a_o = addObject(b, opts, .{ .name = "a", .asm_source_bytes = |
| 2097 | \\.globl _foo | 2097 | \\.globl _foo |
| ... | @@ -2144,7 +2144,7 @@ fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step { | ... | @@ -2144,7 +2144,7 @@ fn testUnwindInfoNoSubsectionsX64(b: *Build, opts: Options) *Step { |
| 2144 | | 2144 | |
| 2145 | // Adapted from https://github.com/llvm/llvm-project/blob/main/lld/test/MachO/weak-binding.s | 2145 | // Adapted from https://github.com/llvm/llvm-project/blob/main/lld/test/MachO/weak-binding.s |
| 2146 | fn testWeakBind(b: *Build, opts: Options) *Step { | 2146 | fn testWeakBind(b: *Build, opts: Options) *Step { |
| 2147 | const test_step = addTestStep(b, "macho-weak-bind", opts); | 2147 | const test_step = addTestStep(b, "weak-bind", opts); |
| 2148 | | 2148 | |
| 2149 | const lib = addSharedLibrary(b, opts, .{ .name = "foo", .asm_source_bytes = | 2149 | const lib = addSharedLibrary(b, opts, .{ .name = "foo", .asm_source_bytes = |
| 2150 | \\.globl _weak_dysym | 2150 | \\.globl _weak_dysym |
| ... | @@ -2275,7 +2275,7 @@ fn testWeakBind(b: *Build, opts: Options) *Step { | ... | @@ -2275,7 +2275,7 @@ fn testWeakBind(b: *Build, opts: Options) *Step { |
| 2275 | } | 2275 | } |
| 2276 | | 2276 | |
| 2277 | fn testWeakFramework(b: *Build, opts: Options) *Step { | 2277 | fn testWeakFramework(b: *Build, opts: Options) *Step { |
| 2278 | const test_step = addTestStep(b, "macho-weak-framework", opts); | 2278 | const test_step = addTestStep(b, "weak-framework", opts); |
| 2279 | | 2279 | |
| 2280 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); | 2280 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = "int main() { return 0; }" }); |
| 2281 | exe.root_module.linkFramework("Cocoa", .{ .weak = true }); | 2281 | exe.root_module.linkFramework("Cocoa", .{ .weak = true }); |
| ... | @@ -2294,7 +2294,7 @@ fn testWeakFramework(b: *Build, opts: Options) *Step { | ... | @@ -2294,7 +2294,7 @@ fn testWeakFramework(b: *Build, opts: Options) *Step { |
| 2294 | } | 2294 | } |
| 2295 | | 2295 | |
| 2296 | fn testWeakLibrary(b: *Build, opts: Options) *Step { | 2296 | fn testWeakLibrary(b: *Build, opts: Options) *Step { |
| 2297 | const test_step = addTestStep(b, "macho-weak-library", opts); | 2297 | const test_step = addTestStep(b, "weak-library", opts); |
| 2298 | | 2298 | |
| 2299 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = | 2299 | const dylib = addSharedLibrary(b, opts, .{ .name = "a", .c_source_bytes = |
| 2300 | \\#include<stdio.h> | 2300 | \\#include<stdio.h> |
| ... | @@ -2337,7 +2337,7 @@ fn testWeakLibrary(b: *Build, opts: Options) *Step { | ... | @@ -2337,7 +2337,7 @@ fn testWeakLibrary(b: *Build, opts: Options) *Step { |
| 2337 | } | 2337 | } |
| 2338 | | 2338 | |
| 2339 | fn testWeakRef(b: *Build, opts: Options) *Step { | 2339 | fn testWeakRef(b: *Build, opts: Options) *Step { |
| 2340 | const test_step = addTestStep(b, "macho-weak-ref", opts); | 2340 | const test_step = addTestStep(b, "weak-ref", opts); |
| 2341 | | 2341 | |
| 2342 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = | 2342 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| 2343 | \\#include <stdio.h> | 2343 | \\#include <stdio.h> |
| ... | @@ -2356,7 +2356,7 @@ fn testWeakRef(b: *Build, opts: Options) *Step { | ... | @@ -2356,7 +2356,7 @@ fn testWeakRef(b: *Build, opts: Options) *Step { |
| 2356 | } | 2356 | } |
| 2357 | | 2357 | |
| 2358 | fn addTestStep(b: *Build, comptime prefix: []const u8, opts: Options) *Step { | 2358 | fn addTestStep(b: *Build, comptime prefix: []const u8, opts: Options) *Step { |
| 2359 | return link.addTestStep(b, "macho-" ++ prefix, opts); | 2359 | return link.addTestStep(b, "" ++ prefix, opts); |
| 2360 | } | 2360 | } |
| 2361 | | 2361 | |
| 2362 | const builtin = @import("builtin"); | 2362 | const builtin = @import("builtin"); |