[llvm] r221620 - Copy externally_initialized in GlobalVariable::copyAttributesFrom.

Rafael Espindola rafael.espindola at gmail.com
Mon Nov 10 10:41:59 PST 2014


Author: rafael
Date: Mon Nov 10 12:41:59 2014
New Revision: 221620

URL: http://llvm.org/viewvc/llvm-project?rev=221620&view=rev
Log:
Copy externally_initialized in GlobalVariable::copyAttributesFrom.

Patch by Kevin Frei!

Added:
    llvm/trunk/test/Linker/lto-attributes.ll
Modified:
    llvm/trunk/lib/IR/Globals.cpp

Modified: llvm/trunk/lib/IR/Globals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Globals.cpp?rev=221620&r1=221619&r2=221620&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Globals.cpp (original)
+++ llvm/trunk/lib/IR/Globals.cpp Mon Nov 10 12:41:59 2014
@@ -246,6 +246,7 @@ void GlobalVariable::copyAttributesFrom(
   GlobalObject::copyAttributesFrom(Src);
   const GlobalVariable *SrcVar = cast<GlobalVariable>(Src);
   setThreadLocalMode(SrcVar->getThreadLocalMode());
+  setExternallyInitialized(SrcVar->isExternallyInitialized());
 }
 
 

Added: llvm/trunk/test/Linker/lto-attributes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/lto-attributes.ll?rev=221620&view=auto
==============================================================================
--- llvm/trunk/test/Linker/lto-attributes.ll (added)
+++ llvm/trunk/test/Linker/lto-attributes.ll Mon Nov 10 12:41:59 2014
@@ -0,0 +1,7 @@
+; RUN: llvm-link -S %s -o - | FileCheck %s
+
+; CHECK: @foo = private externally_initialized global i8* null
+ at foo = private externally_initialized global i8* null
+; CHECK: @array = appending global [7 x i8] c"abcdefg", align 1
+ at array = appending global [7 x i8] c"abcdefg", align 1
+





More information about the llvm-commits mailing list