aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorLauro Ramos Venancio <lauro.venancio@gmail.com>2008-02-19 00:04:15 +0000
committerLauro Ramos Venancio <lauro.venancio@gmail.com>2008-02-19 00:04:15 +0000
commit95050fa665c51a29249725101a476de685f43a11 (patch)
tree2271f00ba0da7b3769e7d74648641a65a1e238b7 /CodeGen/CodeGenModule.cpp
parent39b4c6c98d391b25c376782cf92346aa88c96f7e (diff)
A global without initializer must be emitted as weak.
Fix Olden/bh test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47292 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenModule.cpp')
-rw-r--r--CodeGen/CodeGenModule.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/CodeGen/CodeGenModule.cpp b/CodeGen/CodeGenModule.cpp
index ef05586fcc..d68fbe616d 100644
--- a/CodeGen/CodeGenModule.cpp
+++ b/CodeGen/CodeGenModule.cpp
@@ -244,6 +244,9 @@ void CodeGenModule::EmitGlobalVar(const FileVarDecl *D) {
case VarDecl::Register:
assert(0 && "Can't have auto or register globals");
case VarDecl::None:
+ if (!D->getInit())
+ GV->setLinkage(llvm::GlobalVariable::WeakLinkage);
+ break;
case VarDecl::Extern:
case VarDecl::PrivateExtern:
// todo: common