@@ -1183,9 +1183,9 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
1183
1183
};
1184
1184
// This can happen when using --enable-cache and using the stage1 backend. In this case
1185
1185
// we can skip the file copy.
1186
- if (! mem .eql (u8 , the_object_path , full_out_path )) {
1187
- try fs .cwd ().copyFile (the_object_path , fs .cwd (), full_out_path , .{});
1188
- }
1186
+ // if (!mem.eql(u8, the_object_path, full_out_path)) {
1187
+ // try fs.cwd().copyFile(the_object_path, fs.cwd(), full_out_path, .{});
1188
+ // }
1189
1189
} else {
1190
1190
// Create an LLD command line and invoke it.
1191
1191
var argv = std .ArrayList ([]const u8 ).init (self .base .allocator );
@@ -1256,8 +1256,15 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
1256
1256
try argv .append (try std .fmt .allocPrint (arena , "--export={s}" , .{symbol_name }));
1257
1257
}
1258
1258
} else {
1259
+ const skip_export_non_fn = target .os .tag == .wasi and
1260
+ self .base .options .wasi_exec_model == .command ;
1259
1261
for (module .decl_exports .values ()) | exports | {
1260
1262
for (exports ) | exprt | {
1263
+ if (skip_export_non_fn and exprt .exported_decl .ty .zigTypeTag () != .Fn ) {
1264
+ // skip exporting symbols when we're building a WASI command
1265
+ // and the symbol is not a function
1266
+ continue ;
1267
+ }
1261
1268
const symbol_name = exprt .exported_decl .name ;
1262
1269
const arg = try std .fmt .allocPrint (arena , "--export={s}" , .{symbol_name });
1263
1270
try argv .append (arg );
0 commit comments