diff options
| author | gingerBill <bill@gingerbill.org> | 2020-06-04 00:30:44 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-06-04 00:30:44 +0100 |
| commit | 15c4077806d3d0c05973cfb653fce80c74a01d57 (patch) | |
| tree | c8ebc4428c9037687007ebd1bcae3dadc9fe09ad /src/llvm_backend.cpp | |
| parent | 37a3abdaaa0daa3fca0f8b649f67f069ca54443a (diff) | |
Fix WASM foreign import names
Diffstat (limited to 'src/llvm_backend.cpp')
| -rw-r--r-- | src/llvm_backend.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index e5058983f..875c01354 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -2045,10 +2045,7 @@ lbProcedure *lb_create_procedure(lbModule *m, Entity *entity) { if (build_context.metrics.os == TargetOs_js) { char const *export_name = alloc_cstring(heap_allocator(), p->name); - LLVMAddTargetDependentFunctionAttr(p->value, "export", export_name); - LLVMAddTargetDependentFunctionAttr(p->value, "export-name", export_name); LLVMAddTargetDependentFunctionAttr(p->value, "wasm-export-name", export_name); - LLVMAddTargetDependentFunctionAttr(p->value, "wasm-exported", nullptr); } } if (p->is_foreign) { @@ -2056,7 +2053,11 @@ lbProcedure *lb_create_procedure(lbModule *m, Entity *entity) { char const *import_name = alloc_cstring(heap_allocator(), p->name); char const *module_name = "env"; if (entity->Procedure.foreign_library != nullptr) { - module_name = alloc_cstring(heap_allocator(), entity->Procedure.foreign_library->token.string); + Entity *foreign_library = entity->Procedure.foreign_library; + GB_ASSERT(foreign_library->kind == Entity_LibraryName); + if (foreign_library->LibraryName.paths.count > 0) { + module_name = alloc_cstring(heap_allocator(), foreign_library->LibraryName.paths[0]); + } } LLVMAddTargetDependentFunctionAttr(p->value, "wasm-import-name", import_name); LLVMAddTargetDependentFunctionAttr(p->value, "wasm-import-module", module_name); |