diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-28 17:50:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-28 17:50:28 +0000 |
commit | 4bb253c60f895131371aa2ad1bfa5a2bea213f78 (patch) | |
tree | 5a397006142f6cbd094cfcf9a6af277b8e2a140c | |
parent | a02446a9d5cea82553717d20230a46c808893bfc (diff) | |
download | external_llvm-4bb253c60f895131371aa2ad1bfa5a2bea213f78.zip external_llvm-4bb253c60f895131371aa2ad1bfa5a2bea213f78.tar.gz external_llvm-4bb253c60f895131371aa2ad1bfa5a2bea213f78.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77334 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Target/TargetLoweringObjectFile.h | 2 | ||||
-rw-r--r-- | lib/Target/ARM/ARMISelLowering.cpp | 2 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCISelLowering.cpp | 2 | ||||
-rw-r--r-- | lib/Target/TargetLoweringObjectFile.cpp | 17 | ||||
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 2 |
5 files changed, 16 insertions, 9 deletions
diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h index 18ce1de..03bc5a0 100644 --- a/include/llvm/Target/TargetLoweringObjectFile.h +++ b/include/llvm/Target/TargetLoweringObjectFile.h @@ -160,7 +160,7 @@ class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile { 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; diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 3b1be76..afb0b69 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -106,7 +106,7 @@ void ARMTargetLowering::addQRTypeForNEON(MVT VT) { static TargetLoweringObjectFile *createTLOF(TargetMachine &TM) { if (TM.getSubtarget<ARMSubtarget>().isTargetDarwin()) - return new TargetLoweringObjectFileMachO(); + return new TargetLoweringObjectFileMachO(TM); return new TargetLoweringObjectFileELF(true); } diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index fa1989b..df71838 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -59,7 +59,7 @@ cl::desc("enable preincrement load/store generation on PPC (experimental)"), static TargetLoweringObjectFile *CreateTLOF(const PPCTargetMachine &TM) { if (TM.getSubtargetImpl()->isDarwin()) - return new TargetLoweringObjectFileMachO(); + return new TargetLoweringObjectFileMachO(TM); return new TargetLoweringObjectFileELF(false, true); } diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index e3c0dfa..2074b6c 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -486,7 +486,7 @@ getSectionForMergeableConstant(SectionKind Kind) const { //===----------------------------------------------------------------------===// TargetLoweringObjectFileMachO:: -TargetLoweringObjectFileMachO() { +TargetLoweringObjectFileMachO(const TargetMachine &TM) { TextSection = getOrCreateSection("\t.text", true, SectionKind::Text); DataSection = getOrCreateSection("\t.data", true, SectionKind::DataRel); @@ -496,8 +496,15 @@ TargetLoweringObjectFileMachO() { 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 @@ TargetLoweringObjectFileMachO::SelectSectionForGlobal(const GlobalValue *GV, return FourByteConstantSection; if (Kind.isMergeableConst8()) return EightByteConstantSection; - if (Kind.isMergeableConst16()) + if (Kind.isMergeableConst16() && SixteenByteConstantSection) return SixteenByteConstantSection; return ReadOnlySection; // .const } @@ -582,7 +589,7 @@ getSectionForMergeableConstant(SectionKind Kind) const { return FourByteConstantSection; if (Kind.isMergeableConst8()) return EightByteConstantSection; - if (Kind.isMergeableConst16()) + if (Kind.isMergeableConst16() && SixteenByteConstantSection) return SixteenByteConstantSection; return ReadOnlySection; // .const } diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 29f5765..f34deb1 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -55,7 +55,7 @@ static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) { 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: |