[llvm-branch-commits] [llvm-branch] r83129 - /llvm/branches/Apple/Leela/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Bob Wilson bob.wilson at apple.com
Tue Sep 29 17:25:18 PDT 2009


Author: bwilson
Date: Tue Sep 29 19:25:18 2009
New Revision: 83129

URL: http://llvm.org/viewvc/llvm-project?rev=83129&view=rev
Log:
$ svn merge -c 83127 https://bwilson@llvm.org/svn/llvm-project/llvm/trunk
--- Merging r83127 into '.':
U    lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Modified:
    llvm/branches/Apple/Leela/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Modified: llvm/branches/Apple/Leela/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=83129&r1=83128&r2=83129&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Leela/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Sep 29 19:25:18 2009
@@ -1038,6 +1038,25 @@
 
 bool ARMAsmPrinter::doInitialization(Module &M) {
 
+  if (Subtarget->isTargetDarwin()) {
+    Reloc::Model RelocM = TM.getRelocationModel();
+    if (RelocM == Reloc::PIC_ || RelocM == Reloc::DynamicNoPIC) {
+      // Declare all the text sections up front (before the DWARF sections
+      // emitted by AsmPrinter::doInitialization) so the assembler will keep
+      // them together at the beginning of the object file.  This helps
+      // avoid out-of-range branches that are due a fundamental limitation of
+      // the way symbol offsets are encoded with the current Darwin ARM
+      // relocations.
+      O << "\t.section __TEXT,__text,regular\n"
+        << "\t.section __TEXT,__textcoal_nt,coalesced\n"
+        << "\t.section __TEXT,__const_coal,coalesced\n";
+      if (RelocM == Reloc::DynamicNoPIC)
+        O << "\t.section __TEXT,__symbol_stub4,symbol_stubs,none,12\n";
+      else
+        O << "\t.section __TEXT,__picsymbolstub4,symbol_stubs,none,16\n";
+    }
+  }
+
   bool Result = AsmPrinter::doInitialization(M);
   DW = getAnalysisIfAvailable<DwarfWriter>();
 





More information about the llvm-branch-commits mailing list