[XCore] Use static relocation model by default.
authorRichard Osborne <richard@xmos.com>
Sat, 4 May 2013 16:40:58 +0000 (16:40 +0000)
committerRichard Osborne <richard@xmos.com>
Sat, 4 May 2013 16:40:58 +0000 (16:40 +0000)
This allows us to get get rid of a hack in XCoreTargetObjectFile where the
the DataRel* sections were overridden.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181116 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp
lib/Target/XCore/XCoreISelLowering.cpp
lib/Target/XCore/XCoreISelLowering.h
lib/Target/XCore/XCoreTargetObjectFile.cpp

index b5b072dcbda6fe203017f5905557e33d0082ef28..c1773653f5fb5831ee4a30ef6740a0c65851e85d 100644 (file)
@@ -66,6 +66,9 @@ static MCCodeGenInfo *createXCoreMCCodeGenInfo(StringRef TT, Reloc::Model RM,
                                                CodeModel::Model CM,
                                                CodeGenOpt::Level OL) {
   MCCodeGenInfo *X = new MCCodeGenInfo();
+  if (RM == Reloc::Default) {
+    RM = Reloc::Static;
+  }
   X->InitMCCodeGenInfo(RM, CM, OL);
   return X;
 }
index a5d2be88db7d28629ce3340a4948700dade8b313..f0346f6715c53d2f1f1b1a292ae836d47c453d15 100644 (file)
@@ -1623,6 +1623,12 @@ XCoreTargetLowering::isLegalAddressingMode(const AddrMode &AM,
   }
 }
 
+bool XCoreTargetLowering::
+isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const {
+  // The XCore target isn't yet aware of offsets.
+  return false;
+}
+
 //===----------------------------------------------------------------------===//
 //                           XCore Inline Assembly Support
 //===----------------------------------------------------------------------===//
index 8d258f5054c1b2d1f63600fdacccb5effae6b7d9..7362b0c44ac79673e05b55197ef1638051a69f78 100644 (file)
@@ -106,6 +106,8 @@ namespace llvm {
     virtual bool isLegalAddressingMode(const AddrMode &AM,
                                        Type *Ty) const;
 
+    virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
+
   private:
     const XCoreTargetMachine &TM;
     const XCoreSubtarget &Subtarget;
index 820389935b3836209ca03983c2dd56d83f0837e1..88e3bfd7b81c83fa47a2fb23f859e3a172f64d9b 100644 (file)
@@ -57,9 +57,4 @@ void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
                       ELF::SHF_ALLOC |
                       ELF::XCORE_SHF_CP_SECTION,
                       SectionKind::getReadOnlyWithRel());
-
-  // Dynamic linking is not supported. Data with relocations is placed in the
-  // same section as data without relocations.
-  DataRelSection = DataRelLocalSection = DataSection;
-  DataRelROSection = DataRelROLocalSection = ReadOnlySection;
 }