authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-25 11:52:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-02-02 21:47:28-07:00
loge37c55bae0f154ca2e5ce375fe695f707853fce3
tree518b48097844139515b73100e341ab42ab89bacd
parent93545fe74fadf92d07e19ca81f46db9bf800a993

link: Elf, Wasm: forward strip flag when linking with LLD


3 files changed, 11 insertions(+), 0 deletions(-)

src/link/Coff.zig+1
......@@ -949,6 +949,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void {
949949 man.hash.add(self.base.options.tsaware);
950950 man.hash.add(self.base.options.nxcompat);
951951 man.hash.add(self.base.options.dynamicbase);
952 // strip does not need to go into the linker hash because it is part of the hash namespace
952953 man.hash.addOptional(self.base.options.major_subsystem_version);
953954 man.hash.addOptional(self.base.options.minor_subsystem_version);
954955
src/link/Elf.zig+5
......@@ -1337,6 +1337,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
13371337 man.hash.add(self.base.options.z_noexecstack);
13381338 man.hash.add(self.base.options.z_now);
13391339 man.hash.add(self.base.options.z_relro);
1340 // strip does not need to go into the linker hash because it is part of the hash namespace
13401341 if (self.base.options.link_libc) {
13411342 man.hash.add(self.base.options.libc_installation != null);
13421343 if (self.base.options.libc_installation) |libc_installation| {
......@@ -1477,6 +1478,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
14771478 try argv.append("--export-dynamic");
14781479 }
14791480
1481 if (self.base.options.strip) {
1482 try argv.append("-s");
1483 }
1484
14801485 if (self.base.options.z_nodelete) {
14811486 try argv.append("-z");
14821487 try argv.append("nodelete");
src/link/Wasm.zig+5
......@@ -1028,6 +1028,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
10281028 man.hash.addOptional(self.base.options.max_memory);
10291029 man.hash.addOptional(self.base.options.global_base);
10301030 man.hash.add(self.base.options.export_symbol_names.len);
1031 // strip does not need to go into the linker hash because it is part of the hash namespace
10311032 for (self.base.options.export_symbol_names) |symbol_name| {
10321033 man.hash.addBytes(symbol_name);
10331034 }
......@@ -1107,6 +1108,10 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
11071108 try argv.append("--import-memory");
11081109 }
11091110
1111 if (self.base.options.strip) {
1112 try argv.append("-s");
1113 }
1114
11101115 if (self.base.options.initial_memory) |initial_memory| {
11111116 const arg = try std.fmt.allocPrint(arena, "--initial-memory={d}", .{initial_memory});
11121117 try argv.append(arg);