authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-12-23 18:29:16-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-01-15 15:11:36-08:00
logaebccb06e774107d18c4259eafbf5eb3c642237a
treec39e9e4a53bf0b2764fa39443b873c3c35f36a31
parent1a4c5837fedcad57f6c81301672e6246e0f0a8c1

fix missing missing entry symbol error when no zcu


1 files changed, 8 insertions(+), 8 deletions(-)

src/link/Wasm/Flush.zig+8-8
...@@ -69,6 +69,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {...@@ -69,6 +69,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {
69 const is_obj = comp.config.output_mode == .Obj;69 const is_obj = comp.config.output_mode == .Obj;
70 const allow_undefined = is_obj or wasm.import_symbols;70 const allow_undefined = is_obj or wasm.import_symbols;
7171
72 const entry_name = if (wasm.entry_resolution.isNavOrUnresolved(wasm)) wasm.entry_name else .none;
73
72 if (comp.zcu) |zcu| {74 if (comp.zcu) |zcu| {
73 const ip: *const InternPool = &zcu.intern_pool; // No mutations allowed!75 const ip: *const InternPool = &zcu.intern_pool; // No mutations allowed!
7476
...@@ -88,8 +90,6 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {...@@ -88,8 +90,6 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {
88 }90 }
89 }91 }
9092
91 const entry_name = if (wasm.entry_resolution.isNavOrUnresolved(wasm)) wasm.entry_name else .none;
92
93 for (wasm.nav_exports.keys()) |*nav_export| {93 for (wasm.nav_exports.keys()) |*nav_export| {
94 if (ip.isFunctionType(ip.getNav(nav_export.nav_index).typeOf(ip))) {94 if (ip.isFunctionType(ip.getNav(nav_export.nav_index).typeOf(ip))) {
95 log.debug("flush export '{s}' nav={d}", .{ nav_export.name.slice(wasm), nav_export.nav_index });95 log.debug("flush export '{s}' nav={d}", .{ nav_export.name.slice(wasm), nav_export.nav_index });
...@@ -115,13 +115,13 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {...@@ -115,13 +115,13 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {
115 for (f.missing_exports.keys()) |exp_name| {115 for (f.missing_exports.keys()) |exp_name| {
116 diags.addError("manually specified export name '{s}' undefined", .{exp_name.slice(wasm)});116 diags.addError("manually specified export name '{s}' undefined", .{exp_name.slice(wasm)});
117 }117 }
118 }
118119
119 if (entry_name.unwrap()) |name| {120 if (entry_name.unwrap()) |name| {
120 if (wasm.entry_resolution == .unresolved) {121 if (wasm.entry_resolution == .unresolved) {
121 var err = try diags.addErrorWithNotes(1);122 var err = try diags.addErrorWithNotes(1);
122 try err.addMsg("entry symbol '{s}' missing", .{name.slice(wasm)});123 try err.addMsg("entry symbol '{s}' missing", .{name.slice(wasm)});
123 err.addNote("'-fno-entry' suppresses this error", .{});124 err.addNote("'-fno-entry' suppresses this error", .{});
124 }
125 }125 }
126 }126 }
127127