Correct _start export for wasm* targets

This commit is contained in:
gingerBill
2021-10-31 16:31:20 +00:00
parent bfa33bf5d3
commit fca7142a3c

View File

@@ -897,6 +897,11 @@ lbProcedure *lb_create_main_procedure(lbModule *m, lbProcedure *startup_runtime)
if (is_arch_wasm()) {
LLVMSetLinkage(p->value, LLVMDLLExportLinkage);
LLVMSetDLLStorageClass(p->value, LLVMDLLExportStorageClass);
LLVMSetVisibility(p->value, LLVMDefaultVisibility);
char const *export_name = alloc_cstring(permanent_allocator(), p->name);
LLVMAddTargetDependentFunctionAttr(p->value, "wasm-export-name", export_name);
} else {
LLVMSetLinkage(p->value, LLVMExternalLinkage);
}