From 66540b75f50315e372a74545de7fe91d04b1be62 Mon Sep 17 00:00:00 2001 From: Laytan Laats Date: Sat, 1 Mar 2025 16:06:32 +0100 Subject: [PATCH] fix hidden linkage applied to foreign symbols --- src/llvm_backend.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index 9cf996e84..f21ca9f75 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -169,7 +169,7 @@ gb_internal void lb_correct_entity_linkage(lbGenerator *gen) { other_global = LLVMGetNamedGlobal(ec.other_module->mod, ec.cname); if (other_global) { LLVMSetLinkage(other_global, LLVMWeakAnyLinkage); - if (!ec.e->Variable.is_export) { + if (!ec.e->Variable.is_export && !ec.e->Variable.is_foreign) { LLVMSetVisibility(other_global, LLVMHiddenVisibility); } } @@ -177,7 +177,7 @@ gb_internal void lb_correct_entity_linkage(lbGenerator *gen) { other_global = LLVMGetNamedFunction(ec.other_module->mod, ec.cname); if (other_global) { LLVMSetLinkage(other_global, LLVMWeakAnyLinkage); - if (!ec.e->Procedure.is_export) { + if (!ec.e->Procedure.is_export && !ec.e->Procedure.is_foreign) { LLVMSetVisibility(other_global, LLVMHiddenVisibility); } }