[llvm-commits] [llvm] r77334 - in /llvm/trunk: include/llvm/Target/TargetLoweringObjectFile.h lib/Target/ARM/ARMISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/TargetLoweringObjectFile.cpp lib/Target/X86/X86ISelLowering.cpp

Chris Lattner sabre at nondot.org
Tue Jul 28 10:50:29 PDT 2009


Author: lattner
Date: Tue Jul 28 12:50:28 2009
New Revision: 77334

URL: http://llvm.org/viewvc/llvm-project?rev=77334&view=rev
Log:
the apple "ld_classic" linker doesn't support .literal16 in 32-bit
mode, and "ld64" (the default linker) falls back to it in -static
mode.

Modified:
    llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
    llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
    llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=77334&r1=77333&r2=77334&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Tue Jul 28 12:50:28 2009
@@ -160,7 +160,7 @@
   const Section *EightByteConstantSection;
   const Section *SixteenByteConstantSection;
 public:
-  TargetLoweringObjectFileMachO();
+  TargetLoweringObjectFileMachO(const TargetMachine &TM);
   virtual const Section *SelectSectionForGlobal(const GlobalValue *GV,
                                                 SectionKind Kind,
                                                 const TargetMachine &TM) const;

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=77334&r1=77333&r2=77334&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Jul 28 12:50:28 2009
@@ -106,7 +106,7 @@
 
 static TargetLoweringObjectFile *createTLOF(TargetMachine &TM) {
   if (TM.getSubtarget<ARMSubtarget>().isTargetDarwin())
-    return new TargetLoweringObjectFileMachO();
+    return new TargetLoweringObjectFileMachO(TM);
   return new TargetLoweringObjectFileELF(true);
 }
 

Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=77334&r1=77333&r2=77334&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Jul 28 12:50:28 2009
@@ -59,7 +59,7 @@
 
 static TargetLoweringObjectFile *CreateTLOF(const PPCTargetMachine &TM) {
   if (TM.getSubtargetImpl()->isDarwin())
-    return new TargetLoweringObjectFileMachO();
+    return new TargetLoweringObjectFileMachO(TM);
   return new TargetLoweringObjectFileELF(false, true);
 }
 

Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=77334&r1=77333&r2=77334&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Jul 28 12:50:28 2009
@@ -486,7 +486,7 @@
 //===----------------------------------------------------------------------===//
 
 TargetLoweringObjectFileMachO::
-TargetLoweringObjectFileMachO() {
+TargetLoweringObjectFileMachO(const TargetMachine &TM) {
   TextSection = getOrCreateSection("\t.text", true, SectionKind::Text);
   DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel);
   
@@ -496,8 +496,15 @@
                                                SectionKind::MergeableConst4);
   EightByteConstantSection = getOrCreateSection("\t.literal8\n", true,
                                                 SectionKind::MergeableConst8);
-  SixteenByteConstantSection = 
-  getOrCreateSection("\t.literal16\n", true, SectionKind::MergeableConst16);
+  
+  // ld_classic doesn't support .literal16 in 32-bit mode, and ld64 falls back
+  // to using it in -static mode.
+  if (TM.getRelocationModel() != Reloc::Static &&
+      TM.getTargetData()->getPointerSize() == 32)
+    SixteenByteConstantSection = 
+      getOrCreateSection("\t.literal16\n", true, SectionKind::MergeableConst16);
+  else
+    SixteenByteConstantSection = 0;
   
   ReadOnlySection = getOrCreateSection("\t.const", true, SectionKind::ReadOnly);
   
@@ -551,7 +558,7 @@
       return FourByteConstantSection;
     if (Kind.isMergeableConst8())
       return EightByteConstantSection;
-    if (Kind.isMergeableConst16())
+    if (Kind.isMergeableConst16() && SixteenByteConstantSection)
       return SixteenByteConstantSection;
     return ReadOnlySection;  // .const
   }
@@ -582,7 +589,7 @@
     return FourByteConstantSection;
   if (Kind.isMergeableConst8())
     return EightByteConstantSection;
-  if (Kind.isMergeableConst16())
+  if (Kind.isMergeableConst16() && SixteenByteConstantSection)
     return SixteenByteConstantSection;
   return ReadOnlySection;  // .const
 }

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=77334&r1=77333&r2=77334&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jul 28 12:50:28 2009
@@ -55,7 +55,7 @@
   switch (TM.getSubtarget<X86Subtarget>().TargetType) {
   default: llvm_unreachable("unknown subtarget type");
   case X86Subtarget::isDarwin:
-    return new TargetLoweringObjectFileMachO();
+    return new TargetLoweringObjectFileMachO(TM);
   case X86Subtarget::isELF:
     return new TargetLoweringObjectFileELF();
   case X86Subtarget::isMingw:





More information about the llvm-commits mailing list