From cb8c7c43106f63212ac984053b0c6ca370bde2db Mon Sep 17 00:00:00 2001 From: Richard Osborne Date: Sat, 4 May 2013 16:40:58 +0000 Subject: [PATCH] [XCore] Use static relocation model by default. This allows us to get get rid of a hack in XCoreTargetObjectFile where the the DataRel* sections were overridden. llvm-svn: 181116 --- lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp | 3 +++ lib/Target/XCore/XCoreISelLowering.cpp | 6 ++++++ lib/Target/XCore/XCoreISelLowering.h | 2 ++ lib/Target/XCore/XCoreTargetObjectFile.cpp | 5 ----- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp b/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp index b5b072dcbda..c1773653f5f 100644 --- a/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp +++ b/lib/Target/XCore/MCTargetDesc/XCoreMCTargetDesc.cpp @@ -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; } diff --git a/lib/Target/XCore/XCoreISelLowering.cpp b/lib/Target/XCore/XCoreISelLowering.cpp index a5d2be88db7..f0346f6715c 100644 --- a/lib/Target/XCore/XCoreISelLowering.cpp +++ b/lib/Target/XCore/XCoreISelLowering.cpp @@ -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 //===----------------------------------------------------------------------===// diff --git a/lib/Target/XCore/XCoreISelLowering.h b/lib/Target/XCore/XCoreISelLowering.h index 8d258f5054c..7362b0c44ac 100644 --- a/lib/Target/XCore/XCoreISelLowering.h +++ b/lib/Target/XCore/XCoreISelLowering.h @@ -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; diff --git a/lib/Target/XCore/XCoreTargetObjectFile.cpp b/lib/Target/XCore/XCoreTargetObjectFile.cpp index 820389935b3..88e3bfd7b81 100644 --- a/lib/Target/XCore/XCoreTargetObjectFile.cpp +++ b/lib/Target/XCore/XCoreTargetObjectFile.cpp @@ -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; }