Switch wasm export-all to only values marked exports

This commit is contained in:
Benjamin Feng 2019-04-27 09:52:58 -05:00 committed by Andrew Kelley
parent fca3e3a73f
commit 8d58dc715b

View File

@ -1096,10 +1096,16 @@ static void construct_linker_job_wasm(LinkJob *lj) {
lj->args.append("--no-entry"); // So lld doesn't look for _start.
}
lj->args.append("--allow-undefined");
lj->args.append("--export-all");
lj->args.append("-o");
lj->args.append(buf_ptr(&g->output_file_path));
auto export_it = g->exported_symbol_names.entry_iterator();
decltype(g->exported_symbol_names)::Entry *curr_entry = nullptr;
while ((curr_entry = export_it.next()) != nullptr) {
Buf *arg = buf_sprintf("--export=%s", buf_ptr(curr_entry->key));
lj->args.append(buf_ptr(arg));
}
// .o files
for (size_t i = 0; i < g->link_objects.length; i += 1) {
lj->args.append((const char *)buf_ptr(g->link_objects.at(i)));