diff --git a/lib/IR/Globals.cpp b/lib/IR/Globals.cpp index cecd999657e..e181d623b85 100644 --- a/lib/IR/Globals.cpp +++ b/lib/IR/Globals.cpp @@ -246,6 +246,7 @@ void GlobalVariable::copyAttributesFrom(const GlobalValue *Src) { GlobalObject::copyAttributesFrom(Src); const GlobalVariable *SrcVar = cast(Src); setThreadLocalMode(SrcVar->getThreadLocalMode()); + setExternallyInitialized(SrcVar->isExternallyInitialized()); } diff --git a/test/Linker/lto-attributes.ll b/test/Linker/lto-attributes.ll new file mode 100644 index 00000000000..0dc78ad159b --- /dev/null +++ b/test/Linker/lto-attributes.ll @@ -0,0 +1,7 @@ +; RUN: llvm-link -S %s -o - | FileCheck %s + +; CHECK: @foo = private externally_initialized global i8* null +@foo = private externally_initialized global i8* null +; CHECK: @array = appending global [7 x i8] c"abcdefg", align 1 +@array = appending global [7 x i8] c"abcdefg", align 1 +