authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-05-21 22:25:29+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-05-21 22:29:36+02:00
logbd325d1bd94361024f755c8bac3011a5cdffe573
tree810449ab0769c475151d0c4f9fa191a2dc03c569
parentfbd96907c9f53f01c211e6e3bbf15e53aaeb79f0

wasm: fix object extension to standard .o from .o.wasm

This should offer more compatibility with external tooling when cross-compiling to wasm with zig.

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

lib/std/target.zig-6
...@@ -1259,9 +1259,6 @@ pub const Target = struct {...@@ -1259,9 +1259,6 @@ pub const Target = struct {
1259 }1259 }
12601260
1261 pub fn oFileExt_cpu_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) [:0]const u8 {1261 pub fn oFileExt_cpu_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) [:0]const u8 {
1262 if (cpu_arch.isWasm()) {
1263 return ".o.wasm";
1264 }
1265 switch (abi) {1262 switch (abi) {
1266 .msvc => return ".obj",1263 .msvc => return ".obj",
1267 else => return ".o",1264 else => return ".o",
...@@ -1289,9 +1286,6 @@ pub const Target = struct {...@@ -1289,9 +1286,6 @@ pub const Target = struct {
1289 }1286 }
12901287
1291 pub fn staticLibSuffix_cpu_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) [:0]const u8 {1288 pub fn staticLibSuffix_cpu_arch_abi(cpu_arch: Cpu.Arch, abi: Abi) [:0]const u8 {
1292 if (cpu_arch.isWasm()) {
1293 return ".wasm";
1294 }
1295 switch (abi) {1289 switch (abi) {
1296 .msvc => return ".lib",1290 .msvc => return ".lib",
1297 else => return ".a",1291 else => return ".a",
src/link/Wasm.zig+1-1
...@@ -698,7 +698,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {...@@ -698,7 +698,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
698698
699 if (link_in_crt) {699 if (link_in_crt) {
700 // TODO work out if we want standard crt, a reactor or a command700 // TODO work out if we want standard crt, a reactor or a command
701 try argv.append(try comp.get_libc_crt_file(arena, "crt.o.wasm"));701 try argv.append(try comp.get_libc_crt_file(arena, "crt.o"));
702 }702 }
703703
704 if (!is_obj and self.base.options.link_libc) {704 if (!is_obj and self.base.options.link_libc) {