From: Rafael Espindola Date: Tue, 9 Sep 2014 14:52:27 +0000 (+0000) Subject: Fix a use of an undefined value (the linkage). X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c787184012dc0cbadbe7ccdc12ad318daa0f168e;p=oota-llvm.git Fix a use of an undefined value (the linkage). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217445 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 14c6a10c339..6e425992393 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -705,6 +705,9 @@ bool ModuleLinker::getLinkageResult(GlobalValue *Dest, const GlobalValue *Src, if (DestIsDeclaration) { LinkFromSrc = true; LT = Src->getLinkage(); + } else { + LinkFromSrc = false; + LT = Dest->getLinkage(); } } else if (Dest->hasExternalWeakLinkage()) { // If the Dest is weak, use the source linkage. diff --git a/test/Linker/Inputs/linkage2.ll b/test/Linker/Inputs/linkage2.ll index 3f6963ec4c7..6ecaeb55a0f 100644 --- a/test/Linker/Inputs/linkage2.ll +++ b/test/Linker/Inputs/linkage2.ll @@ -1 +1,3 @@ @test1_a = weak global i8 1 + +@test2_a = external dllimport global i8 diff --git a/test/Linker/linkage2.ll b/test/Linker/linkage2.ll index 2ecdc1ff30a..99cb22c05c2 100644 --- a/test/Linker/linkage2.ll +++ b/test/Linker/linkage2.ll @@ -2,5 +2,7 @@ ; RUN: llvm-link %p/Inputs/linkage2.ll %s -S | FileCheck %s @test1_a = common global i8 0 - ; CHECK: @test1_a = common global i8 0 + +@test2_a = global i8 0 +; CHECK: @test2_a = global i8 0