[llvm-commits] [llvm] r83127 - /llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Chris Lattner clattner at apple.com
Tue Sep 29 18:14:20 PDT 2009


On Sep 29, 2009, at 5:23 PM, Bob Wilson wrote:

> Author: bwilson
> Date: Tue Sep 29 19:23:42 2009
> New Revision: 83127
>
> URL: http://llvm.org/viewvc/llvm-project?rev=83127&view=rev
> Log:
> For Darwin, emit all the text section directives together before the  
> dwarf
> section directives.  This causes the assembler to put the text  
> sections at
> the beginning of the object file, which helps work around a  
> limitation of the
> Darwin ARM relocations.  Radar 7255355.

Hi Bob,

Please follow the lead of PPCDarwinAsmPrinter::doInitialization, which  
has to do a similar thing for PPC.  Specifically, please switch  
sections with OutStreamer.SwitchSection instead of textually.

Thanks,

-Chris

>
> Modified:
>    llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
>
> Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=83127&r1=83126&r2=83127&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Sep  
> 29 19:23:42 2009
> @@ -1046,6 +1046,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>();
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list