[llvm-commits] [llvm] r75881 - /llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp

Chris Lattner sabre at nondot.org
Wed Jul 15 18:23:28 PDT 2009


Author: lattner
Date: Wed Jul 15 20:23:26 2009
New Revision: 75881

URL: http://llvm.org/viewvc/llvm-project?rev=75881&view=rev
Log:
fix section switching to ensure that stubs are emitted to the right
section on ppc.

Modified:
    llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=75881&r1=75880&r2=75881&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Wed Jul 15 20:23:26 2009
@@ -984,10 +984,10 @@
 
   // Output stubs for dynamically-linked functions
   if (TM.getRelocationModel() == Reloc::PIC_ && !FnStubs.empty()) {
-    SwitchToTextSection("\t.section __TEXT,__picsymbolstub1,symbol_stubs,"
-                        "pure_instructions,32");
     for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end();
          I != E; ++I) {
+      SwitchToTextSection("\t.section __TEXT,__picsymbolstub1,symbol_stubs,"
+                          "pure_instructions,32");
       EmitAlignment(4);
       const FnStubInfo &Info = I->second;
       O << Info.Stub << ":\n";
@@ -1003,16 +1003,17 @@
       O << Info.LazyPtr << "-" << Info.AnonSymbol << ")(r11)\n";
       O << "\tmtctr r12\n";
       O << "\tbctr\n";
+      
       SwitchToDataSection(".lazy_symbol_pointer");
       O << Info.LazyPtr << ":\n";
       O << "\t.indirect_symbol " << I->getKeyData() << '\n';
       O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
     }
   } else if (!FnStubs.empty()) {
-    SwitchToTextSection("\t.section __TEXT,__symbol_stub1,symbol_stubs,"
-                        "pure_instructions,16");
     for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end();
          I != E; ++I) {
+      SwitchToTextSection("\t.section __TEXT,__symbol_stub1,symbol_stubs,"
+                          "pure_instructions,16");
       EmitAlignment(4);
       const FnStubInfo &Info = I->second;
       O << Info.Stub << ":\n";





More information about the llvm-commits mailing list