authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-05-18 09:27:41+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-05-18 09:28:00+02:00
logcb45c5521ab5360e2b8c5d1ce16d351d526a3fe5
tree5f2a7bf072f90ee1e95e508307642a97a9e172c0
parentdaaec68aec6e78999a0066621dfd382025505918

zld: refactor warnings


1 files changed, 7 insertions(+), 2 deletions(-)

src/link/MachO.zig+7-2
...@@ -681,12 +681,15 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {...@@ -681,12 +681,15 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
681 var positionals = std.ArrayList([]const u8).init(arena);681 var positionals = std.ArrayList([]const u8).init(arena);
682682
683 try positionals.appendSlice(self.base.options.objects);683 try positionals.appendSlice(self.base.options.objects);
684
684 for (comp.c_object_table.items()) |entry| {685 for (comp.c_object_table.items()) |entry| {
685 try positionals.append(entry.key.status.success.object_path);686 try positionals.append(entry.key.status.success.object_path);
686 }687 }
688
687 if (module_obj_path) |p| {689 if (module_obj_path) |p| {
688 try positionals.append(p);690 try positionals.append(p);
689 }691 }
692
690 try positionals.append(comp.compiler_rt_static_lib.?.full_object_path);693 try positionals.append(comp.compiler_rt_static_lib.?.full_object_path);
691694
692 // libc++ dep695 // libc++ dep
...@@ -705,7 +708,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {...@@ -705,7 +708,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
705 // By this time, we depend on these libs being dynamically linked libraries and not static libraries708 // By this time, we depend on these libs being dynamically linked libraries and not static libraries
706 // (the check for that needs to be earlier), but they could be full paths to .dylib files, in which709 // (the check for that needs to be earlier), but they could be full paths to .dylib files, in which
707 // case we want to avoid prepending "-l".710 // case we want to avoid prepending "-l".
708 // TODO I think then they should go as an input file instead of via shared_libs.711 // TODO I think they should go as an input file instead of via shared_libs.
709 if (Compilation.classifyFileExt(link_lib) == .shared_library) {712 if (Compilation.classifyFileExt(link_lib) == .shared_library) {
710 try shared_libs.append(link_lib);713 try shared_libs.append(link_lib);
711 continue;714 continue;
...@@ -764,6 +767,8 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {...@@ -764,6 +767,8 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
764 var found = false;767 var found = false;
765 for (search_lib_dirs.items) |lib_dir| {768 for (search_lib_dirs.items) |lib_dir| {
766 const full_path = try fs.path.join(arena, &[_][]const u8{ lib_dir, l_name_ext });769 const full_path = try fs.path.join(arena, &[_][]const u8{ lib_dir, l_name_ext });
770
771 // Check if the dylib file exists.
767 const tmp = fs.cwd().openFile(full_path, .{}) catch |err| switch (err) {772 const tmp = fs.cwd().openFile(full_path, .{}) catch |err| switch (err) {
768 error.FileNotFound => continue,773 error.FileNotFound => continue,
769 else => |e| return e,774 else => |e| return e,
...@@ -776,7 +781,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {...@@ -776,7 +781,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
776 }781 }
777782
778 if (!found) {783 if (!found) {
779 log.warn("library '-l{s}' not found", .{l_name});784 log.warn("library not found for '-l{s}'", .{l_name});
780 log.warn("Library search paths:", .{});785 log.warn("Library search paths:", .{});
781 for (search_lib_dirs.items) |lib_dir| {786 for (search_lib_dirs.items) |lib_dir| {
782 log.warn(" {s}", .{lib_dir});787 log.warn(" {s}", .{lib_dir});