diff options
Diffstat (limited to 'lib/Target/XCore/XCoreTargetObjectFile.cpp')
-rw-r--r-- | lib/Target/XCore/XCoreTargetObjectFile.cpp | 96 |
1 files changed, 36 insertions, 60 deletions
diff --git a/lib/Target/XCore/XCoreTargetObjectFile.cpp b/lib/Target/XCore/XCoreTargetObjectFile.cpp index 86d0de6..c435b36 100644 --- a/lib/Target/XCore/XCoreTargetObjectFile.cpp +++ b/lib/Target/XCore/XCoreTargetObjectFile.cpp @@ -21,66 +21,43 @@ using namespace llvm; void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){ TargetLoweringObjectFileELF::Initialize(Ctx, TM); - BSSSection = - Ctx.getELFSection(".dp.bss", ELF::SHT_NOBITS, - ELF::SHF_ALLOC | ELF::SHF_WRITE | - ELF::XCORE_SHF_DP_SECTION, - SectionKind::getBSS()); - BSSSectionLarge = - Ctx.getELFSection(".dp.bss.large", ELF::SHT_NOBITS, - ELF::SHF_ALLOC | ELF::SHF_WRITE | - ELF::XCORE_SHF_DP_SECTION, - SectionKind::getBSS()); - DataSection = - Ctx.getELFSection(".dp.data", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | ELF::SHF_WRITE | - ELF::XCORE_SHF_DP_SECTION, - SectionKind::getDataRel()); - DataSectionLarge = - Ctx.getELFSection(".dp.data.large", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | ELF::SHF_WRITE | - ELF::XCORE_SHF_DP_SECTION, - SectionKind::getDataRel()); - DataRelROSection = - Ctx.getELFSection(".dp.rodata", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | ELF::SHF_WRITE | - ELF::XCORE_SHF_DP_SECTION, - SectionKind::getReadOnlyWithRel()); - DataRelROSectionLarge = - Ctx.getELFSection(".dp.rodata.large", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | ELF::SHF_WRITE | - ELF::XCORE_SHF_DP_SECTION, - SectionKind::getReadOnlyWithRel()); + BSSSection = Ctx.getELFSection(".dp.bss", ELF::SHT_NOBITS, + ELF::SHF_ALLOC | ELF::SHF_WRITE | + ELF::XCORE_SHF_DP_SECTION); + BSSSectionLarge = Ctx.getELFSection(".dp.bss.large", ELF::SHT_NOBITS, + ELF::SHF_ALLOC | ELF::SHF_WRITE | + ELF::XCORE_SHF_DP_SECTION); + DataSection = Ctx.getELFSection(".dp.data", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::SHF_WRITE | + ELF::XCORE_SHF_DP_SECTION); + DataSectionLarge = Ctx.getELFSection(".dp.data.large", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::SHF_WRITE | + ELF::XCORE_SHF_DP_SECTION); + DataRelROSection = Ctx.getELFSection(".dp.rodata", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::SHF_WRITE | + ELF::XCORE_SHF_DP_SECTION); + DataRelROSectionLarge = Ctx.getELFSection( + ".dp.rodata.large", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::XCORE_SHF_DP_SECTION); ReadOnlySection = - Ctx.getELFSection(".cp.rodata", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | - ELF::XCORE_SHF_CP_SECTION, - SectionKind::getReadOnlyWithRel()); + Ctx.getELFSection(".cp.rodata", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::XCORE_SHF_CP_SECTION); ReadOnlySectionLarge = - Ctx.getELFSection(".cp.rodata.large", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | - ELF::XCORE_SHF_CP_SECTION, - SectionKind::getReadOnlyWithRel()); - MergeableConst4Section = - Ctx.getELFSection(".cp.rodata.cst4", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | ELF::SHF_MERGE | - ELF::XCORE_SHF_CP_SECTION, - SectionKind::getMergeableConst4()); - MergeableConst8Section = - Ctx.getELFSection(".cp.rodata.cst8", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | ELF::SHF_MERGE | - ELF::XCORE_SHF_CP_SECTION, - SectionKind::getMergeableConst8()); - MergeableConst16Section = - Ctx.getELFSection(".cp.rodata.cst16", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | ELF::SHF_MERGE | - ELF::XCORE_SHF_CP_SECTION, - SectionKind::getMergeableConst16()); + Ctx.getELFSection(".cp.rodata.large", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::XCORE_SHF_CP_SECTION); + MergeableConst4Section = Ctx.getELFSection( + ".cp.rodata.cst4", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::XCORE_SHF_CP_SECTION, 4, ""); + MergeableConst8Section = Ctx.getELFSection( + ".cp.rodata.cst8", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::XCORE_SHF_CP_SECTION, 8, ""); + MergeableConst16Section = Ctx.getELFSection( + ".cp.rodata.cst16", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::XCORE_SHF_CP_SECTION, 16, ""); CStringSection = - Ctx.getELFSection(".cp.rodata.string", ELF::SHT_PROGBITS, - ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::SHF_STRINGS | - ELF::XCORE_SHF_CP_SECTION, - SectionKind::getReadOnlyWithRel()); + Ctx.getELFSection(".cp.rodata.string", ELF::SHT_PROGBITS, + ELF::SHF_ALLOC | ELF::SHF_MERGE | ELF::SHF_STRINGS | + ELF::XCORE_SHF_CP_SECTION); // TextSection - see MObjectFileInfo.cpp // StaticCtorSection - see MObjectFileInfo.cpp // StaticDtorSection - see MObjectFileInfo.cpp @@ -128,7 +105,7 @@ XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV, if (IsCPRel && !Kind.isReadOnly()) report_fatal_error("Using .cp. section for writeable object."); return getContext().getELFSection(SectionName, getXCoreSectionType(Kind), - getXCoreSectionFlags(Kind, IsCPRel), Kind); + getXCoreSectionFlags(Kind, IsCPRel)); } const MCSection *XCoreTargetObjectFile:: @@ -146,8 +123,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, } Type *ObjType = GV->getType()->getPointerElementType(); if (TM.getCodeModel() == CodeModel::Small || !ObjType->isSized() || - TM.getSubtargetImpl()->getDataLayout()->getTypeAllocSize(ObjType) < - CodeModelLargeSize) { + TM.getDataLayout()->getTypeAllocSize(ObjType) < CodeModelLargeSize) { if (Kind.isReadOnly()) return UseCPRel? ReadOnlySection : DataRelROSection; if (Kind.isBSS() || Kind.isCommon())return BSSSection; |