don't call SectionForGlobal on declarations, you can't tell the section a
authorChris Lattner <sabre@nondot.org>
Sun, 2 Aug 2009 01:02:43 +0000 (01:02 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 2 Aug 2009 01:02:43 +0000 (01:02 +0000)
declaration will end up in.

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

lib/Target/PIC16/PIC16AsmPrinter.cpp

index ea4515696a5e92e6eca9eaf39acbd573ba1cfefe..f0e4cbaae6ab7c1f60d667959022565ee471f51f 100644 (file)
@@ -238,7 +238,9 @@ bool PIC16AsmPrinter::doInitialization(Module &M) {
   // Set the section names for all globals.
   for (Module::global_iterator I = M.global_begin(), E = M.global_end();
        I != E; ++I)
-    I->setSection(getObjFileLowering().SectionForGlobal(I, Mang,TM)->getName());
+    if (!I->isDeclaration())
+      I->setSection(getObjFileLowering().
+                    SectionForGlobal(I, Mang,TM)->getName());
 
   DbgInfo.BeginModule(M);
   EmitFunctionDecls(M);