Print blank line and clear stubs vector.
authorBill Wendling <isanbard@gmail.com>
Tue, 9 Mar 2010 00:43:34 +0000 (00:43 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 9 Mar 2010 00:43:34 +0000 (00:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98019 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

index 0d52a0c703ad7d65d43dd408e0aba4681baf1c1f..a18008e97c420e76ecd6b069de3fadd23b85b1a3 100644 (file)
@@ -1132,8 +1132,16 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
         // L_foo$stub:
         OutStreamer.EmitLabel(Stubs[i].first);
         //   .indirect_symbol _foo
-        OutStreamer.EmitSymbolAttribute(Stubs[i].second, MCSA_IndirectSymbol);
-        OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
+        MCSymbol *MCSym = Stubs[i].second;
+        OutStreamer.EmitSymbolAttribute(MCSym, MCSA_IndirectSymbol);
+
+        if (MCSym->isUndefined())
+          // External to current translation unit.
+          OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
+        else
+          // Internal to current translation unit.
+          OutStreamer.EmitValue(MCSymbolRefExpr::Create(MCSym, OutContext),
+                                4/*size*/, 0/*addrspace*/);
       }
 
       Stubs.clear();
@@ -1152,6 +1160,9 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
                                                       OutContext),
                               4/*size*/, 0/*addrspace*/);
       }
+
+      Stubs.clear();
+      OutStreamer.AddBlankLine();
     }
 
     // Funny Darwin hack: This flag tells the linker that no global symbols