move elf section uniquing to MCContext. Along the way

merge XCore's section into MCSectionELF

llvm-svn: 100812
This commit is contained in:
Chris Lattner 2010-04-08 21:26:26 +00:00
parent 75f82345c4
commit 5418dd5fda
18 changed files with 165 additions and 268 deletions

View File

@ -33,7 +33,6 @@ namespace llvm {
class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
mutable void *UniquingMap;
protected:
/// TLSDataSection - Section directive for Thread Local data.
///
@ -58,8 +57,8 @@ protected:
unsigned Flags, SectionKind Kind,
bool IsExplicit = false) const;
public:
TargetLoweringObjectFileELF() : UniquingMap(0) {}
~TargetLoweringObjectFileELF();
TargetLoweringObjectFileELF() {}
~TargetLoweringObjectFileELF() {}
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);

View File

@ -280,7 +280,7 @@ namespace llvm {
/// getNonexecutableStackSection - Targets can implement this method to
/// specify a section to switch to if the translation unit doesn't have any
/// trampolines that require an executable stack.
virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const {
virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const{
return 0;
}

View File

@ -50,7 +50,7 @@ namespace llvm {
/// objects.
BumpPtrAllocator Allocator;
void *MachOUniquingMap;
void *MachOUniquingMap, *ELFUniquingMap;
public:
explicit MCContext(const MCAsmInfo &MAI);
~MCContext();
@ -94,6 +94,10 @@ namespace llvm {
return getMachOSection(Segment, Section, TypeAndAttributes, 0, K);
}
const MCSection *getELFSection(StringRef Section, unsigned Type,
unsigned Flags, SectionKind Kind,
bool IsExplicit);
/// @}
void *Allocate(unsigned Size, unsigned Align = 8) {

View File

@ -36,16 +36,14 @@ class MCSectionELF : public MCSection {
/// explicit section specified.
bool IsExplicit;
protected:
private:
friend class MCContext;
MCSectionELF(StringRef Section, unsigned type, unsigned flags,
SectionKind K, bool isExplicit)
: MCSection(K), SectionName(Section), Type(type), Flags(flags),
IsExplicit(isExplicit) {}
~MCSectionELF();
public:
static MCSectionELF *Create(StringRef Section, unsigned Type,
unsigned Flags, SectionKind K, bool isExplicit,
MCContext &Ctx);
/// ShouldOmitSectionDirective - Decides whether a '.section' directive
/// should be printed before the section name
@ -153,40 +151,33 @@ public:
// This section holds Thread-Local Storage.
SHF_TLS = 0x400U,
/// FIRST_TARGET_DEP_FLAG - This is the first flag that subclasses are
/// allowed to specify.
FIRST_TARGET_DEP_FLAG = 0x800U,
/// TARGET_INDEP_SHF - This is the bitmask for all the target independent
/// section flags. Targets can define their own target flags above these.
/// If they do that, they should implement their own MCSectionELF subclasses
/// and implement the virtual method hooks below to handle printing needs.
TARGET_INDEP_SHF = FIRST_TARGET_DEP_FLAG-1U
// Start of target-specific flags.
/// XCORE_SHF_CP_SECTION - All sections with the "c" flag are grouped
/// together by the linker to form the constant pool and the cp register is
/// set to the start of the constant pool by the boot code.
XCORE_SHF_CP_SECTION = 0x800U,
/// XCORE_SHF_DP_SECTION - All sections with the "d" flag are grouped
/// together by the linker to form the data section and the dp register is
/// set to the start of the section by the boot code.
XCORE_SHF_DP_SECTION = 0x1000U
};
StringRef getSectionName() const { return SectionName; }
unsigned getType() const { return Type; }
unsigned getFlags() const { return Flags; }
virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const;
void PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const;
/// isBaseAddressKnownZero - We know that non-allocatable sections (like
/// debug info) have a base of zero.
virtual bool isBaseAddressKnownZero() const {
return (getFlags() & SHF_ALLOC) == 0;
}
/// PrintTargetSpecificSectionFlags - Targets that define their own
/// MCSectionELF subclasses with target specific section flags should
/// implement this method if they end up adding letters to the attributes
/// list.
virtual void PrintTargetSpecificSectionFlags(const MCAsmInfo &MAI,
raw_ostream &OS) const {
}
};
} // end namespace llvm

View File

@ -34,29 +34,7 @@ class MCSectionMachO : public MCSection {
unsigned Reserved2;
MCSectionMachO(StringRef Segment, StringRef Section,
unsigned TAA, unsigned reserved2, SectionKind K)
: MCSection(K), TypeAndAttributes(TAA), Reserved2(reserved2) {
assert(Segment.size() <= 16 && Section.size() <= 16 &&
"Segment or section string too long");
for (unsigned i = 0; i != 16; ++i) {
if (i < Segment.size())
SegmentName[i] = Segment[i];
else
SegmentName[i] = 0;
if (i < Section.size())
SectionName[i] = Section[i];
else
SectionName[i] = 0;
}
}
static MCSectionMachO *Create(StringRef Segment,
StringRef Section,
unsigned TypeAndAttributes,
unsigned Reserved2,
SectionKind K, MCContext &Ctx);
unsigned TAA, unsigned reserved2, SectionKind K);
friend class MCContext;
public:

View File

@ -705,7 +705,7 @@ bool AsmPrinter::doFinalization(Module &M) {
// to be executable. Some targets have a directive to declare this.
Function *InitTrampolineIntrinsic = M.getFunction("llvm.init.trampoline");
if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty())
if (MCSection *S = MAI->getNonexecutableStackSection(OutContext))
if (const MCSection *S = MAI->getNonexecutableStackSection(OutContext))
OutStreamer.SwitchSection(S);
// Allow the target to emit any magic that it wants at the end of the file,

View File

@ -38,34 +38,16 @@ using namespace dwarf;
//===----------------------------------------------------------------------===//
// ELF
//===----------------------------------------------------------------------===//
typedef StringMap<const MCSectionELF*> ELFUniqueMapTy;
TargetLoweringObjectFileELF::~TargetLoweringObjectFileELF() {
// If we have the section uniquing map, free it.
delete (ELFUniqueMapTy*)UniquingMap;
}
const MCSection *TargetLoweringObjectFileELF::
getELFSection(StringRef Section, unsigned Type, unsigned Flags,
SectionKind Kind, bool IsExplicit) const {
if (UniquingMap == 0)
UniquingMap = new ELFUniqueMapTy();
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)UniquingMap;
return getContext().getELFSection(Section, Type, Flags, Kind, IsExplicit);
// Do the lookup, if we have a hit, return it.
StringMapEntry<const MCSectionELF*> &Entry = Map.GetOrCreateValue(Section);
if (Entry.getValue()) return Entry.getValue();
MCSectionELF *Result = MCSectionELF::Create(Entry.getKey(), Type, Flags, Kind,
IsExplicit, getContext());
Entry.setValue(Result);
return Result;
}
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
const TargetMachine &TM) {
if (UniquingMap != 0)
((ELFUniqueMapTy*)UniquingMap)->clear();
TargetLoweringObjectFile::Initialize(Ctx, TM);
BSSSection =

View File

@ -10,16 +10,19 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
using namespace llvm;
typedef StringMap<const MCSectionMachO*> MachOUniqueMapTy;
typedef StringMap<const MCSectionELF*> ELFUniqueMapTy;
MCContext::MCContext(const MCAsmInfo &mai) : MAI(mai), NextUniqueID(0) {
MachOUniquingMap = 0;
ELFUniquingMap = 0;
}
MCContext::~MCContext() {
@ -28,6 +31,7 @@ MCContext::~MCContext() {
// If we have the MachO uniquing map, free it.
delete (MachOUniqueMapTy*)MachOUniquingMap;
delete (ELFUniqueMapTy*)ELFUniquingMap;
}
//===----------------------------------------------------------------------===//
@ -96,6 +100,26 @@ getMachOSection(StringRef Segment, StringRef Section,
if (Entry) return Entry;
// Otherwise, return a new section.
return Entry = MCSectionMachO::Create(Segment, Section, TypeAndAttributes,
Reserved2, Kind, *this);
return Entry = new (*this) MCSectionMachO(Segment, Section, TypeAndAttributes,
Reserved2, Kind);
}
const MCSection *MCContext::
getELFSection(StringRef Section, unsigned Type, unsigned Flags,
SectionKind Kind, bool IsExplicit) {
if (ELFUniquingMap == 0)
ELFUniquingMap = new ELFUniqueMapTy();
ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)ELFUniquingMap;
// Do the lookup, if we have a hit, return it.
StringMapEntry<const MCSectionELF*> &Entry = Map.GetOrCreateValue(Section);
if (Entry.getValue()) return Entry.getValue();
MCSectionELF *Result = new (*this) MCSectionELF(Entry.getKey(), Type, Flags,
Kind, IsExplicit);
Entry.setValue(Result);
return Result;
}

View File

@ -14,11 +14,7 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
MCSectionELF *MCSectionELF::
Create(StringRef Section, unsigned Type, unsigned Flags,
SectionKind K, bool isExplicit, MCContext &Ctx) {
return new (Ctx) MCSectionELF(Section, Type, Flags, K, isExplicit);
}
MCSectionELF::~MCSectionELF() {} // anchor.
// ShouldOmitSectionDirective - Decides whether a '.section' directive
// should be printed before the section name
@ -62,59 +58,63 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
OS << ",#write";
if (Flags & MCSectionELF::SHF_TLS)
OS << ",#tls";
} else {
OS << ",\"";
if (Flags & MCSectionELF::SHF_ALLOC)
OS << 'a';
if (Flags & MCSectionELF::SHF_EXECINSTR)
OS << 'x';
if (Flags & MCSectionELF::SHF_WRITE)
OS << 'w';
if (Flags & MCSectionELF::SHF_MERGE)
OS << 'M';
if (Flags & MCSectionELF::SHF_STRINGS)
OS << 'S';
if (Flags & MCSectionELF::SHF_TLS)
OS << 'T';
// If there are target-specific flags, print them.
if (Flags & ~MCSectionELF::TARGET_INDEP_SHF)
PrintTargetSpecificSectionFlags(MAI, OS);
OS << '"';
OS << '\n';
return;
}
OS << ",\"";
if (Flags & MCSectionELF::SHF_ALLOC)
OS << 'a';
if (Flags & MCSectionELF::SHF_EXECINSTR)
OS << 'x';
if (Flags & MCSectionELF::SHF_WRITE)
OS << 'w';
if (Flags & MCSectionELF::SHF_MERGE)
OS << 'M';
if (Flags & MCSectionELF::SHF_STRINGS)
OS << 'S';
if (Flags & MCSectionELF::SHF_TLS)
OS << 'T';
// If there are target-specific flags, print them.
if (Flags & MCSectionELF::XCORE_SHF_CP_SECTION)
OS << 'c';
if (Flags & MCSectionELF::XCORE_SHF_DP_SECTION)
OS << 'd';
OS << '"';
if (ShouldPrintSectionType(Type)) {
OS << ',';
// If comment string is '@', e.g. as on ARM - use '%' instead
if (MAI.getCommentString()[0] == '@')
OS << '%';
else
OS << '@';
if (Type == MCSectionELF::SHT_INIT_ARRAY)
OS << "init_array";
else if (Type == MCSectionELF::SHT_FINI_ARRAY)
OS << "fini_array";
else if (Type == MCSectionELF::SHT_PREINIT_ARRAY)
OS << "preinit_array";
else if (Type == MCSectionELF::SHT_NOBITS)
OS << "nobits";
else if (Type == MCSectionELF::SHT_PROGBITS)
OS << "progbits";
if (getKind().isMergeable1ByteCString()) {
OS << ",1";
} else if (getKind().isMergeable2ByteCString()) {
OS << ",2";
} else if (getKind().isMergeable4ByteCString() ||
getKind().isMergeableConst4()) {
OS << ",4";
} else if (getKind().isMergeableConst8()) {
OS << ",8";
} else if (getKind().isMergeableConst16()) {
OS << ",16";
}
if (ShouldPrintSectionType(Type)) {
OS << ',';
// If comment string is '@', e.g. as on ARM - use '%' instead
if (MAI.getCommentString()[0] == '@')
OS << '%';
else
OS << '@';
if (Type == MCSectionELF::SHT_INIT_ARRAY)
OS << "init_array";
else if (Type == MCSectionELF::SHT_FINI_ARRAY)
OS << "fini_array";
else if (Type == MCSectionELF::SHT_PREINIT_ARRAY)
OS << "preinit_array";
else if (Type == MCSectionELF::SHT_NOBITS)
OS << "nobits";
else if (Type == MCSectionELF::SHT_PROGBITS)
OS << "progbits";
if (getKind().isMergeable1ByteCString()) {
OS << ",1";
} else if (getKind().isMergeable2ByteCString()) {
OS << ",2";
} else if (getKind().isMergeable4ByteCString() ||
getKind().isMergeableConst4()) {
OS << ",4";
} else if (getKind().isMergeableConst8()) {
OS << ",8";
} else if (getKind().isMergeableConst16()) {
OS << ",16";
}
}

View File

@ -64,14 +64,22 @@ ENTRY(0 /*FIXME*/, S_ATTR_LOC_RELOC)
{ AttrFlagEnd, 0, 0 }
};
MCSectionMachO *MCSectionMachO::
Create(StringRef Segment, StringRef Section,
unsigned TypeAndAttributes, unsigned Reserved2,
SectionKind K, MCContext &Ctx) {
// S_SYMBOL_STUBS must be set for Reserved2 to be non-zero.
return new (Ctx) MCSectionMachO(Segment, Section, TypeAndAttributes,
Reserved2, K);
MCSectionMachO::MCSectionMachO(StringRef Segment, StringRef Section,
unsigned TAA, unsigned reserved2, SectionKind K)
: MCSection(K), TypeAndAttributes(TAA), Reserved2(reserved2) {
assert(Segment.size() <= 16 && Section.size() <= 16 &&
"Segment or section string too long");
for (unsigned i = 0; i != 16; ++i) {
if (i < Segment.size())
SegmentName[i] = Segment[i];
else
SegmentName[i] = 0;
if (i < Section.size())
SectionName[i] = Section[i];
else
SectionName[i] = 0;
}
}
void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI,

View File

@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "SystemZMCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
using namespace llvm;
@ -21,7 +22,8 @@ SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, const StringRef &TT) {
PCSymbol = ".";
}
MCSection *SystemZMCAsmInfo::getNonexecutableStackSection(MCContext &Ctx) const{
return MCSectionELF::Create(".note.GNU-stack", MCSectionELF::SHT_PROGBITS,
0, SectionKind::getMetadata(), false, Ctx);
const MCSection *SystemZMCAsmInfo::
getNonexecutableStackSection(MCContext &Ctx) const{
return Ctx.getELFSection(".note.GNU-stack", MCSectionELF::SHT_PROGBITS,
0, SectionKind::getMetadata(), false);
}

View File

@ -22,7 +22,7 @@ namespace llvm {
struct SystemZMCAsmInfo : public MCAsmInfo {
explicit SystemZMCAsmInfo(const Target &T, const StringRef &TT);
virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const;
virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const;
};
} // namespace llvm

View File

@ -14,6 +14,7 @@
#include "X86MCAsmInfo.h"
#include "X86TargetMachine.h"
#include "llvm/ADT/Triple.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
@ -95,9 +96,10 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) {
Data64bitsDirective = 0;
}
MCSection *X86ELFMCAsmInfo::getNonexecutableStackSection(MCContext &Ctx) const {
return MCSectionELF::Create(".note.GNU-stack", MCSectionELF::SHT_PROGBITS,
0, SectionKind::getMetadata(), false, Ctx);
const MCSection *X86ELFMCAsmInfo::
getNonexecutableStackSection(MCContext &Ctx) const {
return Ctx.getELFSection(".note.GNU-stack", MCSectionELF::SHT_PROGBITS,
0, SectionKind::getMetadata(), false);
}
X86MCAsmInfoCOFF::X86MCAsmInfoCOFF(const Triple &Triple) {

View File

@ -27,7 +27,7 @@ namespace llvm {
struct X86ELFMCAsmInfo : public MCAsmInfo {
explicit X86ELFMCAsmInfo(const Triple &Triple);
virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const;
virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const;
};
struct X86MCAsmInfoCOFF : public MCAsmInfoCOFF {

View File

@ -11,7 +11,6 @@ tablegen(XCoreGenCallingConv.inc -gen-callingconv)
tablegen(XCoreGenSubtarget.inc -gen-subtarget)
add_llvm_target(XCore
MCSectionXCore.cpp
XCoreFrameInfo.cpp
XCoreInstrInfo.cpp
XCoreISelDAGToDAG.cpp

View File

@ -1,35 +0,0 @@
//===- MCSectionXCore.cpp - XCore-specific section representation ---------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the MCSectionXCore class.
//
//===----------------------------------------------------------------------===//
#include "MCSectionXCore.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
MCSectionXCore *
MCSectionXCore::Create(const StringRef &Section, unsigned Type,
unsigned Flags, SectionKind K,
bool isExplicit, MCContext &Ctx) {
return new (Ctx) MCSectionXCore(Section, Type, Flags, K, isExplicit);
}
/// PrintTargetSpecificSectionFlags - This handles the XCore-specific cp/dp
/// section flags.
void MCSectionXCore::PrintTargetSpecificSectionFlags(const MCAsmInfo &MAI,
raw_ostream &OS) const {
if (getFlags() & MCSectionXCore::SHF_CP_SECTION)
OS << 'c';
if (getFlags() & MCSectionXCore::SHF_DP_SECTION)
OS << 'd';
}

View File

@ -1,54 +0,0 @@
//===- MCSectionXCore.h - XCore-specific section representation -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the MCSectionXCore class.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_MCSECTION_XCORE_H
#define LLVM_MCSECTION_XCORE_H
#include "llvm/MC/MCSectionELF.h"
namespace llvm {
class MCSectionXCore : public MCSectionELF {
MCSectionXCore(const StringRef &Section, unsigned Type, unsigned Flags,
SectionKind K, bool isExplicit)
: MCSectionELF(Section, Type, Flags, K, isExplicit) {}
public:
enum {
/// SHF_CP_SECTION - All sections with the "c" flag are grouped together
/// by the linker to form the constant pool and the cp register is set to
/// the start of the constant pool by the boot code.
SHF_CP_SECTION = FIRST_TARGET_DEP_FLAG,
/// SHF_DP_SECTION - All sections with the "d" flag are grouped together
/// by the linker to form the data section and the dp register is set to
/// the start of the section by the boot code.
SHF_DP_SECTION = FIRST_TARGET_DEP_FLAG << 1
};
static MCSectionXCore *Create(const StringRef &Section, unsigned Type,
unsigned Flags, SectionKind K,
bool isExplicit, MCContext &Ctx);
/// PrintTargetSpecificSectionFlags - This handles the XCore-specific cp/dp
/// section flags.
virtual void PrintTargetSpecificSectionFlags(const MCAsmInfo &MAI,
raw_ostream &OS) const;
};
} // end namespace llvm
#endif

View File

@ -9,7 +9,8 @@
#include "XCoreTargetObjectFile.h"
#include "XCoreSubtarget.h"
#include "MCSectionXCore.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
@ -18,34 +19,31 @@ void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
DataSection =
MCSectionXCore::Create(".dp.data", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
MCSectionXCore::SHF_DP_SECTION,
SectionKind::getDataRel(), false, getContext());
Ctx.getELFSection(".dp.data", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
MCSectionELF::XCORE_SHF_DP_SECTION,
SectionKind::getDataRel(), false);
BSSSection =
MCSectionXCore::Create(".dp.bss", MCSectionELF::SHT_NOBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
MCSectionXCore::SHF_DP_SECTION,
SectionKind::getBSS(), false, getContext());
Ctx.getELFSection(".dp.bss", MCSectionELF::SHT_NOBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
MCSectionELF::XCORE_SHF_DP_SECTION,
SectionKind::getBSS(), false);
MergeableConst4Section =
MCSectionXCore::Create(".cp.rodata.cst4", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
MCSectionXCore::SHF_CP_SECTION,
SectionKind::getMergeableConst4(), false,
getContext());
Ctx.getELFSection(".cp.rodata.cst4", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
MCSectionELF::XCORE_SHF_CP_SECTION,
SectionKind::getMergeableConst4(), false);
MergeableConst8Section =
MCSectionXCore::Create(".cp.rodata.cst8", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
MCSectionXCore::SHF_CP_SECTION,
SectionKind::getMergeableConst8(), false,
getContext());
Ctx.getELFSection(".cp.rodata.cst8", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
MCSectionELF::XCORE_SHF_CP_SECTION,
SectionKind::getMergeableConst8(), false);
MergeableConst16Section =
MCSectionXCore::Create(".cp.rodata.cst16", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
MCSectionXCore::SHF_CP_SECTION,
SectionKind::getMergeableConst16(), false,
getContext());
Ctx.getELFSection(".cp.rodata.cst16", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
MCSectionELF::XCORE_SHF_CP_SECTION,
SectionKind::getMergeableConst16(), false);
// TLS globals are lowered in the backend to arrays indexed by the current
// thread id. After lowering they require no special handling by the linker
@ -54,11 +52,10 @@ void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
TLSBSSSection = BSSSection;
ReadOnlySection =
MCSectionXCore::Create(".cp.rodata", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |
MCSectionXCore::SHF_CP_SECTION,
SectionKind::getReadOnlyWithRel(), false,
getContext());
Ctx.getELFSection(".cp.rodata", MCSectionELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |
MCSectionELF::XCORE_SHF_CP_SECTION,
SectionKind::getReadOnlyWithRel(), false);
// Dynamic linking is not supported. Data with relocations is placed in the
// same section as data without relocations.