Skip to content

Commit 1053ec3

Browse files
committed
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.
1 parent 80d0977 commit 1053ec3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/llvm_backend.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,17 @@ gb_internal void lb_correct_entity_linkage(lbGenerator *gen) {
169169
other_global = LLVMGetNamedGlobal(ec.other_module->mod, ec.cname);
170170
if (other_global) {
171171
LLVMSetLinkage(other_global, LLVMWeakAnyLinkage);
172+
if (!ec.e->Variable.is_export) {
173+
LLVMSetVisibility(other_global, LLVMHiddenVisibility);
174+
}
172175
}
173176
} else if (ec.e->kind == Entity_Procedure) {
174177
other_global = LLVMGetNamedFunction(ec.other_module->mod, ec.cname);
175178
if (other_global) {
176179
LLVMSetLinkage(other_global, LLVMWeakAnyLinkage);
180+
if (!ec.e->Procedure.is_export) {
181+
LLVMSetVisibility(other_global, LLVMHiddenVisibility);
182+
}
177183
}
178184
}
179185
}

0 commit comments

Comments
 (0)