aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-10-31 16:31:20 +0000
committergingerBill <bill@gingerbill.org>2021-10-31 16:31:20 +0000
commitfca7142a3c5f942235580aec9661003727601fd3 (patch)
treee70e569e391c4b6f4694d701aaa4af0356bd7a3f /src
parentbfa33bf5d37b8ee5494f65dcb1d5b224a574f532 (diff)
Correct `_start` export for wasm* targets
Diffstat (limited to 'src')
-rw-r--r--src/llvm_backend.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index ef764372b..1d382aa6d 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -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);
}