From b3da08deb30e59c27a94b83c4690787807713182 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 10 Nov 2014 18:41:59 +0000 Subject: [PATCH] Copy externally_initialized in GlobalVariable::copyAttributesFrom. Patch by Kevin Frei! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221620 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Globals.cpp | 1 + test/Linker/lto-attributes.ll | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 test/Linker/lto-attributes.ll 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 + -- 2.34.1