Commit 211de9b63b

Jakub Konka <kubkon@jakubkonka.com>
2022-06-22 10:40:10
link-tests: fix dumping of LOAD_DYLIB: name instead of path field
1 parent 23a63f4
Changed files (3)
lib
test
link
macho
dylib
frameworks
lib/std/build/CheckObjectStep.zig
@@ -320,7 +320,7 @@ const MachODumper = struct {
                 const dylib = lc.dylib.inner.dylib;
                 try writer.writeByte('\n');
                 try writer.print(
-                    \\path {s}
+                    \\name {s}
                     \\timestamp {d}
                     \\current version {x}
                     \\compatibility version {x}
test/link/macho/dylib/build.zig
@@ -15,7 +15,7 @@ pub fn build(b: *Builder) void {
 
     const check_dylib = dylib.checkObject(.macho);
     check_dylib.check("cmd ID_DYLIB");
-    check_dylib.checkNext("path @rpath/liba.dylib");
+    check_dylib.checkNext("name @rpath/liba.dylib");
     check_dylib.checkNext("timestamp 2");
     check_dylib.checkNext("current version 10000");
     check_dylib.checkNext("compatibility version 10000");
@@ -32,7 +32,7 @@ pub fn build(b: *Builder) void {
 
     const check_exe = exe.checkObject(.macho);
     check_exe.check("cmd LOAD_DYLIB");
-    check_exe.checkNext("path @rpath/liba.dylib");
+    check_exe.checkNext("name @rpath/liba.dylib");
     check_exe.checkNext("timestamp 2");
     check_exe.checkNext("current version 10000");
     check_exe.checkNext("compatibility version 10000");
test/link/macho/frameworks/build.zig
@@ -11,10 +11,14 @@ pub fn build(b: *Builder) void {
     exe.addCSourceFile("main.c", &[0][]const u8{});
     exe.setBuildMode(mode);
     exe.linkLibC();
-    // TODO when we figure out how to ship framework stubs for cross-compilation,
-    // populate paths to the sysroot here.
     exe.linkFramework("Cocoa");
 
+    const check = exe.checkObject(.macho);
+    check.check("cmd LOAD_DYLIB");
+    check.checkNext("name /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa");
+
+    test_step.dependOn(&check.step);
+
     const run_cmd = exe.run();
     test_step.dependOn(&run_cmd.step);
 }