A global without initializer must be emitted as weak.

Fix Olden/bh test.

llvm-svn: 47292
This commit is contained in:
Lauro Ramos Venancio 2008-02-19 00:04:15 +00:00
parent 6200c225e0
commit c58fc4052e
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,3 @@
// RUN: clang -emit-llvm < %s | grep weak
int i;