Skip to content

Commit

Permalink
Merge branch 'motiejus-framework-not-found'
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Dec 12, 2021
2 parents dbfcebf + 4ce6208 commit a76910b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/link/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,9 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
try self.populateMissingMetadata();
}

var lib_not_found = false;
var framework_not_found = false;

if (needs_full_relink) {
for (self.objects.items) |*object| {
object.free(self.base.allocator, self);
Expand Down Expand Up @@ -688,7 +691,6 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
}

var libs = std.ArrayList([]const u8).init(arena);
var lib_not_found = false;
for (search_lib_names.items) |lib_name| {
// Assume ld64 default: -search_paths_first
// Look in each directory for a dylib (stub first), and then for archive
Expand Down Expand Up @@ -752,7 +754,6 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
}
}

var framework_not_found = false;
for (self.base.options.frameworks) |framework| {
for (&[_][]const u8{ ".tbd", ".dylib", "" }) |ext| {
if (try resolveFramework(arena, framework_dirs.items, framework, ext)) |full_path| {
Expand Down Expand Up @@ -928,6 +929,12 @@ pub fn flushModule(self: *MachO, comp: *Compilation) !void {
if (self.unresolved.count() > 0) {
return error.UndefinedSymbolReference;
}
if (lib_not_found) {
return error.LibraryNotFound;
}
if (framework_not_found) {
return error.FrameworkNotFound;
}

try self.createTentativeDefAtoms();
try self.parseObjectsIntoAtoms();
Expand Down

0 comments on commit a76910b

Please sign in to comment.