[Orc] Fix local-linkage handling in the CompileOnDemand layer.

llvm-svn: 233895
This commit is contained in:
Lang Hames 2015-04-02 05:28:10 +00:00
parent b965ac5dc9
commit 2f50744fe7
2 changed files with 14 additions and 2 deletions

View File

@ -54,7 +54,7 @@ void partition(Module &M, const ModulePartitionMap &PMap) {
if (KVPair.second.count(&Orig)) { if (KVPair.second.count(&Orig)) {
copyGVInitializer(New, Orig, VMap); copyGVInitializer(New, Orig, VMap);
} }
if (New.getLinkage() == GlobalValue::PrivateLinkage) { if (New.hasLocalLinkage()) {
New.setLinkage(GlobalValue::ExternalLinkage); New.setLinkage(GlobalValue::ExternalLinkage);
New.setVisibility(GlobalValue::HiddenVisibility); New.setVisibility(GlobalValue::HiddenVisibility);
} }
@ -64,7 +64,7 @@ void partition(Module &M, const ModulePartitionMap &PMap) {
[&](Function &New, const Function &Orig, ValueToValueMapTy &VMap) { [&](Function &New, const Function &Orig, ValueToValueMapTy &VMap) {
if (KVPair.second.count(&Orig)) if (KVPair.second.count(&Orig))
copyFunctionBody(New, Orig, VMap); copyFunctionBody(New, Orig, VMap);
if (New.getLinkage() == GlobalValue::InternalLinkage) { if (New.hasLocalLinkage()) {
New.setLinkage(GlobalValue::ExternalLinkage); New.setLinkage(GlobalValue::ExternalLinkage);
New.setVisibility(GlobalValue::HiddenVisibility); New.setVisibility(GlobalValue::HiddenVisibility);
} }

View File

@ -0,0 +1,12 @@
; RUN: lli -jit-kind=orc-lazy %s
define private void @_ZL3foov() {
entry:
ret void
}
define i32 @main(i32 %argc, i8** nocapture readnone %argv) {
entry:
tail call void @_ZL3foov()
ret i32 0
}