Fix test/Regression/CodeGen/CBackend/2004-12-03-ExternStatics.ll and
authorChris Lattner <sabre@nondot.org>
Fri, 3 Dec 2004 17:19:10 +0000 (17:19 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 3 Dec 2004 17:19:10 +0000 (17:19 +0000)
PR472

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18459 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp

index 45a29b0a4934d9be06d8d671d197ce8babbdb7bf..d71a568d288a848e46adbb0a00f4f81971c6b591 100644 (file)
@@ -858,7 +858,10 @@ bool CWriter::doInitialization(Module &M) {
     Out << "\n\n/* Global Variable Declarations */\n";
     for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
       if (!I->isExternal()) {
-        Out << "extern ";
+        if (I->hasInternalLinkage())
+          Out << "static ";
+        else
+          Out << "extern ";
         printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
 
         if (I->hasLinkOnceLinkage())
index 45a29b0a4934d9be06d8d671d197ce8babbdb7bf..d71a568d288a848e46adbb0a00f4f81971c6b591 100644 (file)
@@ -858,7 +858,10 @@ bool CWriter::doInitialization(Module &M) {
     Out << "\n\n/* Global Variable Declarations */\n";
     for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
       if (!I->isExternal()) {
-        Out << "extern ";
+        if (I->hasInternalLinkage())
+          Out << "static ";
+        else
+          Out << "extern ";
         printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
 
         if (I->hasLinkOnceLinkage())