mirror of
https://github.com/ziglang/zig.git
synced 2025-12-29 17:43:17 +00:00
link/macho: make --verbose-link represent the actual linker line
This commit is contained in:
parent
eb5d67b146
commit
8e0a802ea1
@ -797,6 +797,14 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {
|
||||
try argv.appendSlice(&.{ "-e", entry_name });
|
||||
}
|
||||
|
||||
try argv.append("-o");
|
||||
try argv.append(full_out_path);
|
||||
|
||||
if (self.base.isDynLib() and self.base.allow_shlib_undefined) {
|
||||
try argv.append("-undefined");
|
||||
try argv.append("dynamic_lookup");
|
||||
}
|
||||
|
||||
for (comp.objects) |obj| {
|
||||
// TODO: verify this
|
||||
if (obj.must_link) {
|
||||
@ -813,19 +821,11 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {
|
||||
try argv.append(p);
|
||||
}
|
||||
|
||||
if (comp.compiler_rt_lib) |lib| try argv.append(lib.full_object_path);
|
||||
if (comp.compiler_rt_obj) |obj| try argv.append(obj.full_object_path);
|
||||
|
||||
if (comp.config.link_libcpp) {
|
||||
try argv.append(comp.libcxxabi_static_lib.?.full_object_path);
|
||||
try argv.append(comp.libcxx_static_lib.?.full_object_path);
|
||||
for (self.lib_dirs) |lib_dir| {
|
||||
const arg = try std.fmt.allocPrint(arena, "-L{s}", .{lib_dir});
|
||||
try argv.append(arg);
|
||||
}
|
||||
|
||||
try argv.append("-o");
|
||||
try argv.append(full_out_path);
|
||||
|
||||
try argv.append("-lSystem");
|
||||
|
||||
for (comp.system_libs.keys()) |l_name| {
|
||||
const info = comp.system_libs.get(l_name).?;
|
||||
const arg = if (info.needed)
|
||||
@ -837,9 +837,9 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {
|
||||
try argv.append(arg);
|
||||
}
|
||||
|
||||
for (self.lib_dirs) |lib_dir| {
|
||||
const arg = try std.fmt.allocPrint(arena, "-L{s}", .{lib_dir});
|
||||
try argv.append(arg);
|
||||
for (self.framework_dirs) |f_dir| {
|
||||
try argv.append("-F");
|
||||
try argv.append(f_dir);
|
||||
}
|
||||
|
||||
for (self.frameworks) |framework| {
|
||||
@ -853,15 +853,15 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {
|
||||
try argv.append(arg);
|
||||
}
|
||||
|
||||
for (self.framework_dirs) |f_dir| {
|
||||
try argv.append("-F");
|
||||
try argv.append(f_dir);
|
||||
if (comp.config.link_libcpp) {
|
||||
try argv.append(comp.libcxxabi_static_lib.?.full_object_path);
|
||||
try argv.append(comp.libcxx_static_lib.?.full_object_path);
|
||||
}
|
||||
|
||||
if (self.base.isDynLib() and self.base.allow_shlib_undefined) {
|
||||
try argv.append("-undefined");
|
||||
try argv.append("dynamic_lookup");
|
||||
}
|
||||
try argv.append("-lSystem");
|
||||
|
||||
if (comp.compiler_rt_lib) |lib| try argv.append(lib.full_object_path);
|
||||
if (comp.compiler_rt_obj) |obj| try argv.append(obj.full_object_path);
|
||||
}
|
||||
|
||||
Compilation.dump_argv(argv.items);
|
||||
|
||||
@ -1385,7 +1385,6 @@ pub fn calcSymtabSize(self: *Object, macho_file: *MachO) !void {
|
||||
|
||||
pub fn calcStabsSize(self: *Object, macho_file: *MachO) error{Overflow}!void {
|
||||
if (self.dwarf_info) |dw| {
|
||||
// TODO handle multiple CUs
|
||||
const cu = dw.compile_units.items[0];
|
||||
const comp_dir = try cu.getCompileDir(dw) orelse return;
|
||||
const tu_name = try cu.getSourceFile(dw) orelse return;
|
||||
@ -1504,7 +1503,6 @@ pub fn writeStabs(self: *const Object, macho_file: *MachO, ctx: anytype) error{O
|
||||
var index = self.output_symtab_ctx.istab;
|
||||
|
||||
if (self.dwarf_info) |dw| {
|
||||
// TODO handle multiple CUs
|
||||
const cu = dw.compile_units.items[0];
|
||||
const comp_dir = try cu.getCompileDir(dw) orelse return;
|
||||
const tu_name = try cu.getSourceFile(dw) orelse return;
|
||||
@ -1750,7 +1748,6 @@ pub fn hasEhFrameRecords(self: Object) bool {
|
||||
return self.cies.items.len > 0;
|
||||
}
|
||||
|
||||
/// TODO handle multiple CUs
|
||||
pub fn hasDebugInfo(self: Object) bool {
|
||||
if (self.dwarf_info) |dw| {
|
||||
return dw.compile_units.items.len > 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user