aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-02-07 07:28:18 +0000
committerGitHub <noreply@github.com>2025-02-07 07:28:18 +0000
commita9cd70a9133676eaa6a605c1938286404f045a24 (patch)
tree94b7fdf399df1a7c80bf2055121db860c21fc0e0 /src/llvm_backend.cpp
parent80d09774b428f1201f550dee16d3104010260fc5 (diff)
parent1053ec30518486e3feb523d1a37e814ce992e79c (diff)
Merge pull request #4800 from laytan/make-use-separate-modules-corrected-linkage-hidden
make corrected linkage with -use-separate-modules apply hidden visibility
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index 29fa67f3f..0896ea8c7 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -169,11 +169,17 @@ 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) {
+ LLVMSetVisibility(other_global, LLVMHiddenVisibility);
+ }
}
} else if (ec.e->kind == Entity_Procedure) {
other_global = LLVMGetNamedFunction(ec.other_module->mod, ec.cname);
if (other_global) {
LLVMSetLinkage(other_global, LLVMWeakAnyLinkage);
+ if (!ec.e->Procedure.is_export) {
+ LLVMSetVisibility(other_global, LLVMHiddenVisibility);
+ }
}
}
}