Skip to content

Commit 8d58dc7

Browse files
Benjamin Fengandrewrk
Benjamin Feng
authored andcommitted
Switch wasm export-all to only values marked exports
1 parent fca3e3a commit 8d58dc7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/link.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,10 +1096,16 @@ static void construct_linker_job_wasm(LinkJob *lj) {
10961096
lj->args.append("--no-entry"); // So lld doesn't look for _start.
10971097
}
10981098
lj->args.append("--allow-undefined");
1099-
lj->args.append("--export-all");
11001099
lj->args.append("-o");
11011100
lj->args.append(buf_ptr(&g->output_file_path));
11021101

1102+
auto export_it = g->exported_symbol_names.entry_iterator();
1103+
decltype(g->exported_symbol_names)::Entry *curr_entry = nullptr;
1104+
while ((curr_entry = export_it.next()) != nullptr) {
1105+
Buf *arg = buf_sprintf("--export=%s", buf_ptr(curr_entry->key));
1106+
lj->args.append(buf_ptr(arg));
1107+
}
1108+
11031109
// .o files
11041110
for (size_t i = 0; i < g->link_objects.length; i += 1) {
11051111
lj->args.append((const char *)buf_ptr(g->link_objects.at(i)));

0 commit comments

Comments
 (0)