mirror of
https://github.com/ziglang/zig.git
synced 2026-02-04 05:33:39 +00:00
macho: remove all rpath parsing from the linker
This commit is contained in:
parent
b1cf6d3103
commit
8105390fff
@ -114,8 +114,6 @@ compatibility_version: ?std.SemanticVersion,
|
||||
entry_name: ?[]const u8,
|
||||
platform: Platform,
|
||||
sdk_version: ?std.SemanticVersion,
|
||||
/// Rpath table
|
||||
rpath_table: std.StringArrayHashMapUnmanaged(void) = .{},
|
||||
/// When set to true, the linker will hoist all dylibs including system dependent dylibs.
|
||||
no_implicit_dylibs: bool = false,
|
||||
|
||||
@ -210,12 +208,6 @@ pub fn createEmpty(
|
||||
.mode = link.File.determineMode(false, output_mode, link_mode),
|
||||
});
|
||||
|
||||
// Filter rpaths
|
||||
try self.rpath_table.ensureUnusedCapacity(gpa, self.base.rpath_list.len);
|
||||
for (options.rpath_list) |rpath| {
|
||||
_ = self.rpath_table.putAssumeCapacity(rpath, {});
|
||||
}
|
||||
|
||||
// Append null file
|
||||
try self.files.append(gpa, .null);
|
||||
// Atom at index 0 is reserved as null atom
|
||||
@ -333,7 +325,6 @@ pub fn deinit(self: *MachO) void {
|
||||
}
|
||||
self.thunks.deinit(gpa);
|
||||
self.unwind_records.deinit(gpa);
|
||||
self.rpath_table.deinit(gpa);
|
||||
}
|
||||
|
||||
pub fn flush(self: *MachO, arena: Allocator, prog_node: *std.Progress.Node) link.File.FlushError!void {
|
||||
@ -701,7 +692,7 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {
|
||||
try argv.append(syslibroot);
|
||||
}
|
||||
|
||||
for (self.rpath_table.keys()) |rpath| {
|
||||
for (self.base.rpath_list) |rpath| {
|
||||
try argv.append("-rpath");
|
||||
try argv.append(rpath);
|
||||
}
|
||||
@ -2812,8 +2803,8 @@ fn writeLoadCommands(self: *MachO) !struct { usize, usize, usize } {
|
||||
ncmds += 1;
|
||||
}
|
||||
|
||||
try load_commands.writeRpathLCs(self.rpath_table.keys(), writer);
|
||||
ncmds += self.rpath_table.keys().len;
|
||||
try load_commands.writeRpathLCs(self.base.rpath_list, writer);
|
||||
ncmds += self.base.rpath_list.len;
|
||||
|
||||
try writer.writeStruct(macho.source_version_command{ .version = 0 });
|
||||
ncmds += 1;
|
||||
|
||||
@ -59,7 +59,7 @@ pub fn calcLoadCommandsSize(macho_file: *MachO, assume_max_path_len: bool) u32 {
|
||||
}
|
||||
// LC_RPATH
|
||||
{
|
||||
for (macho_file.rpath_table.keys()) |rpath| {
|
||||
for (macho_file.base.rpath_list) |rpath| {
|
||||
sizeofcmds += calcInstallNameLen(
|
||||
@sizeOf(macho.rpath_command),
|
||||
rpath,
|
||||
|
||||
@ -662,7 +662,7 @@ fn testRelocatableZig(b: *Build, opts: Options) *Step {
|
||||
|
||||
const run = addRunArtifact(exe);
|
||||
run.addCheck(.{ .expect_stderr_match = b.dupe("incrFoo=1") });
|
||||
run.addCheck(.{ .expect_stderr_match = b.dupe("decrFoo=1") });
|
||||
run.addCheck(.{ .expect_stderr_match = b.dupe("decrFoo=0") });
|
||||
run.addCheck(.{ .expect_stderr_match = b.dupe("panic: Oh no!") });
|
||||
test_step.dependOn(&run.step);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user