authorgravatar for shritesh@shritesh.comShritesh Bhattarai <shritesh@shritesh.com> 2019-04-15 17:00:04-05:00
committergravatar for shritesh@shritesh.comShritesh Bhattarai <shritesh@shritesh.com> 2019-04-15 17:00:04-05:00
loga0d2185199e7723aabc38cacd83d6a140f12e01d
tree73cb0f562a778c58ff3e3fff7b6544b6ad4dd414
parent9465c6d5385dff70d41142f509fcdf074269a905

wasm: add wasm-import-module attr to extern


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

src/codegen.cpp+8
......@@ -495,6 +495,14 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, ZigFn *fn_table_entry) {
495495 auto entry = g->exported_symbol_names.maybe_get(symbol_name);
496496 if (entry == nullptr) {
497497 fn_table_entry->llvm_value = LLVMAddFunction(g->module, buf_ptr(symbol_name), fn_llvm_type);
498
499 if (target_is_wasm(g->zig_target)) {
500 assert(fn_table_entry->proto_node->type == NodeTypeFnProto);
501 AstNodeFnProto *fn_proto = &fn_table_entry->proto_node->data.fn_proto;
502 if (fn_proto-> is_extern && fn_proto->lib_name != nullptr ) {
503 addLLVMFnAttrStr(fn_table_entry->llvm_value, "wasm-import-module", buf_ptr(fn_proto->lib_name));
504 }
505 }
498506 } else {
499507 assert(entry->value->id == TldIdFn);
500508 TldFn *tld_fn = reinterpret_cast<TldFn *>(entry->value);