aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2025-02-06 20:42:41 +0100
committerLaytan Laats <laytanlaats@hotmail.com>2025-02-06 20:45:58 +0100
commit1053ec30518486e3feb523d1a37e814ce992e79c (patch)
tree94b7fdf399df1a7c80bf2055121db860c21fc0e0 /src/llvm_backend.cpp
parent80d09774b428f1201f550dee16d3104010260fc5 (diff)
make corrected linkage with -use-separate-modules apply hidden visibility
Fixes #4798 The DLL was using the type info of the host/exe, causing crashes. This PR tries fixing by applying hidden visibility to these corrected symbols which makes sure that the DLL can't see the type table of the host/exe.
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);
+ }
}
}
}