diff options
Diffstat (limited to 'lib/Target/XCore/XCoreTargetObjectFile.cpp')
-rw-r--r-- | lib/Target/XCore/XCoreTargetObjectFile.cpp | 107 |
1 files changed, 42 insertions, 65 deletions
diff --git a/lib/Target/XCore/XCoreTargetObjectFile.cpp b/lib/Target/XCore/XCoreTargetObjectFile.cpp index 86d0de654e440..b5a99058f46e9 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 @@ -118,7 +95,7 @@ static unsigned getXCoreSectionFlags(SectionKind K, bool IsCPRel) { return Flags; } -const MCSection * +MCSection * XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const { @@ -128,12 +105,13 @@ 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:: -SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, - const TargetMachine &TM) const{ +MCSection * +XCoreTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV, + SectionKind Kind, Mangler &Mang, + const TargetMachine &TM) const { bool UseCPRel = GV->isLocalLinkage(GV->getLinkage()); @@ -146,8 +124,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; @@ -165,7 +142,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, report_fatal_error("Target does not support TLS or Common sections"); } -const MCSection * +MCSection * XCoreTargetObjectFile::getSectionForConstant(SectionKind Kind, const Constant *C) const { if (Kind.isMergeableConst4()) return MergeableConst4Section; |