summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-05-21 19:20:38 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-05-21 19:20:38 +0000
commit0709a7bd1a75191a13580ca2a505fa0f7c4326bd (patch)
treed77dc6bcc145992fbd6a9deebe5e82c4aa553cae /llvm/lib
parent85d1965abd5e1d452e68e70473d856373c6ca845 (diff)
downloadbcm5719-llvm-0709a7bd1a75191a13580ca2a505fa0f7c4326bd.tar.gz
bcm5719-llvm-0709a7bd1a75191a13580ca2a505fa0f7c4326bd.zip
Move alignment from MCSectionData to MCSection.
This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. llvm-svn: 237936
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AddressPool.h2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp28
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp25
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp7
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfFile.h5
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp2
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h6
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp2
-rw-r--r--llvm/lib/CodeGen/StackMaps.cpp4
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp69
-rw-r--r--llvm/lib/MC/ConstantPools.cpp13
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp34
-rw-r--r--llvm/lib/MC/MCAsmInfoELF.cpp3
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp17
-rw-r--r--llvm/lib/MC/MCAssembler.cpp10
-rw-r--r--llvm/lib/MC/MCContext.cpp70
-rw-r--r--llvm/lib/MC/MCDwarf.cpp18
-rw-r--r--llvm/lib/MC/MCELFStreamer.cpp12
-rw-r--r--llvm/lib/MC/MCExpr.cpp6
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp12
-rw-r--r--llvm/lib/MC/MCNullStreamer.cpp2
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp2
-rw-r--r--llvm/lib/MC/MCObjectStreamer.cpp4
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp2
-rw-r--r--llvm/lib/MC/MCParser/ELFAsmParser.cpp6
-rw-r--r--llvm/lib/MC/MCSection.cpp2
-rw-r--r--llvm/lib/MC/MCStreamer.cpp11
-rw-r--r--llvm/lib/MC/MCSymbol.cpp3
-rw-r--r--llvm/lib/MC/MCWin64EH.cpp9
-rw-r--r--llvm/lib/MC/MCWinEH.cpp19
-rw-r--r--llvm/lib/MC/WinCOFFStreamer.cpp12
-rw-r--r--llvm/lib/Object/RecordStreamer.cpp2
-rw-r--r--llvm/lib/Object/RecordStreamer.h2
-rw-r--r--llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp3
-rw-r--r--llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp2
-rw-r--r--llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h2
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp7
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h4
-rw-r--r--llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp2
-rw-r--r--llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h11
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp2
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h2
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h2
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp6
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp6
-rw-r--r--llvm/lib/Target/Mips/MipsAsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/Mips/MipsTargetObjectFile.cpp12
-rw-r--r--llvm/lib/Target/Mips/MipsTargetObjectFile.h14
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp2
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXMCExpr.h8
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXTargetObjectFile.h16
-rw-r--r--llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h2
-rw-r--r--llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp30
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp2
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetObjectFile.h6
-rw-r--r--llvm/lib/Target/R600/AMDGPUAsmPrinter.cpp6
-rw-r--r--llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h2
-rw-r--r--llvm/lib/Target/TargetLoweringObjectFile.cpp22
-rw-r--r--llvm/lib/Target/X86/X86AsmPrinter.cpp25
-rw-r--r--llvm/lib/Target/X86/X86TargetObjectFile.cpp2
-rw-r--r--llvm/lib/Target/X86/X86TargetObjectFile.h4
-rw-r--r--llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp11
-rw-r--r--llvm/lib/Target/XCore/XCoreTargetObjectFile.h27
67 files changed, 326 insertions, 351 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
index 4dc5e9f66b6..2487aba448c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
@@ -24,7 +24,7 @@ unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) {
}
// Emit addresses into the section given.
-void AddressPool::emit(AsmPrinter &Asm, const MCSection *AddrSection) {
+void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
if (Pool.empty())
return;
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
index 802e050cdf6..211fc98c7f6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
@@ -40,7 +40,7 @@ public:
/// label/symbol.
unsigned getIndex(const MCSymbol *Sym, bool TLS = false);
- void emit(AsmPrinter &Asm, const MCSection *AddrSection);
+ void emit(AsmPrinter &Asm, MCSection *AddrSection);
bool isEmpty() { return Pool.empty(); }
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 17bbf01c43f..206be702e72 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -405,8 +405,8 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
// Handle local BSS symbols.
if (MAI->hasMachoZeroFillDirective()) {
- const MCSection *TheSection =
- getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
+ MCSection *TheSection =
+ getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
// .zerofill __DATA, __bss, _foo, 400, 5
OutStreamer->EmitZerofill(TheSection, GVSym, Size, Align);
return;
@@ -434,8 +434,8 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
return;
}
- const MCSection *TheSection =
- getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
+ MCSection *TheSection =
+ getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
// Handle the zerofill directive on darwin, which is a special form of BSS
// emission.
@@ -479,8 +479,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
OutStreamer->AddBlankLine();
// Emit the variable struct for the runtime.
- const MCSection *TLVSect
- = getObjFileLowering().getTLSExtraDataSection();
+ MCSection *TLVSect = getObjFileLowering().getTLSExtraDataSection();
OutStreamer->SwitchSection(TLVSect);
// Emit the linkage here.
@@ -1122,7 +1121,7 @@ bool AsmPrinter::doFinalization(Module &M) {
// Emit __morestack address if needed for indirect calls.
if (MMI->usesMorestackAddr()) {
- const MCSection *ReadOnlySection =
+ MCSection *ReadOnlySection =
getObjFileLowering().getSectionForConstant(SectionKind::getReadOnly(),
/*C=*/nullptr);
OutStreamer->SwitchSection(ReadOnlySection);
@@ -1140,7 +1139,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 (const MCSection *S = MAI->getNonexecutableStackSection(OutContext))
+ if (MCSection *S = MAI->getNonexecutableStackSection(OutContext))
OutStreamer->SwitchSection(S);
// Allow the target to emit any magic that it wants at the end of the file,
@@ -1182,12 +1181,12 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
}
namespace {
- // SectionCPs - Keep track the alignment, constpool entries per Section.
+// Keep track the alignment, constpool entries per Section.
struct SectionCPs {
- const MCSection *S;
+ MCSection *S;
unsigned Alignment;
SmallVector<unsigned, 4> CPEs;
- SectionCPs(const MCSection *s, unsigned a) : S(s), Alignment(a) {}
+ SectionCPs(MCSection *s, unsigned a) : S(s), Alignment(a) {}
};
}
@@ -1215,7 +1214,7 @@ void AsmPrinter::EmitConstantPool() {
if (!CPE.isMachineConstantPoolEntry())
C = CPE.Val.ConstVal;
- const MCSection *S = getObjFileLowering().getSectionForConstant(Kind, C);
+ MCSection *S = getObjFileLowering().getSectionForConstant(Kind, C);
// The number of sections are small, just do a linear search from the
// last section to the first.
@@ -1294,8 +1293,7 @@ void AsmPrinter::EmitJumpTableInfo() {
*F);
if (JTInDiffSection) {
// Drop it in the readonly section.
- const MCSection *ReadOnlySection =
- TLOF.getSectionForJumpTable(*F, *Mang, TM);
+ MCSection *ReadOnlySection = TLOF.getSectionForJumpTable(*F, *Mang, TM);
OutStreamer->SwitchSection(ReadOnlySection);
}
@@ -1539,7 +1537,7 @@ void AsmPrinter::EmitXXStructorList(const Constant *List, bool isCtor) {
KeySym = getSymbol(GV);
}
- const MCSection *OutputSection =
+ MCSection *OutputSection =
(isCtor ? Obj.getStaticCtorSection(S.Priority, KeySym)
: Obj.getStaticDtorSection(S.Priority, KeySym));
OutStreamer->SwitchSection(OutputSection);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 7b7c8be372a..bc2917d42b3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1285,7 +1285,7 @@ void DwarfDebug::emitAbbreviations() {
Holder.emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection());
}
-void DwarfDebug::emitAccel(DwarfAccelTable &Accel, const MCSection *Section,
+void DwarfDebug::emitAccel(DwarfAccelTable &Accel, MCSection *Section,
StringRef TableName) {
Accel.FinalizeTable(Asm, TableName);
Asm->OutStreamer->SwitchSection(Section);
@@ -1379,16 +1379,16 @@ static dwarf::PubIndexEntryDescriptor computeIndexValue(DwarfUnit *CU,
/// emitDebugPubNames - Emit visible names into a debug pubnames section.
///
void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
- const MCSection *PSec =
- GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
- : Asm->getObjFileLowering().getDwarfPubNamesSection();
+ MCSection *PSec = GnuStyle
+ ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
+ : Asm->getObjFileLowering().getDwarfPubNamesSection();
emitDebugPubSection(GnuStyle, PSec, "Names",
&DwarfCompileUnit::getGlobalNames);
}
void DwarfDebug::emitDebugPubSection(
- bool GnuStyle, const MCSection *PSec, StringRef Name,
+ bool GnuStyle, MCSection *PSec, StringRef Name,
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const) {
for (const auto &NU : CUMap) {
DwarfCompileUnit *TheU = NU.second;
@@ -1448,9 +1448,9 @@ void DwarfDebug::emitDebugPubSection(
}
void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
- const MCSection *PSec =
- GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
- : Asm->getObjFileLowering().getDwarfPubTypesSection();
+ MCSection *PSec = GnuStyle
+ ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
+ : Asm->getObjFileLowering().getDwarfPubTypesSection();
emitDebugPubSection(GnuStyle, PSec, "Types",
&DwarfCompileUnit::getGlobalTypes);
@@ -1611,13 +1611,13 @@ struct ArangeSpan {
// address we can tie back to a CU.
void DwarfDebug::emitDebugARanges() {
// Provides a unique id per text section.
- MapVector<const MCSection *, SmallVector<SymbolCU, 8>> SectionMap;
+ MapVector<MCSection *, SmallVector<SymbolCU, 8>> SectionMap;
// Filter labels by section.
for (const SymbolCU &SCU : ArangeLabels) {
if (SCU.Sym->isInSection()) {
// Make a note of this symbol and it's section.
- const MCSection *Section = &SCU.Sym->getSection();
+ MCSection *Section = &SCU.Sym->getSection();
if (!Section->getKind().isMetadata())
SectionMap[Section].push_back(SCU);
} else {
@@ -1630,7 +1630,7 @@ void DwarfDebug::emitDebugARanges() {
// Add terminating symbols for each section.
for (const auto &I : SectionMap) {
- const MCSection *Section = I.first;
+ MCSection *Section = I.first;
MCSymbol *Sym = nullptr;
if (Section)
@@ -1873,8 +1873,7 @@ void DwarfDebug::emitDebugLineDWO() {
// sections.
void DwarfDebug::emitDebugStrDWO() {
assert(useSplitDwarf() && "No split dwarf?");
- const MCSection *OffSec =
- Asm->getObjFileLowering().getDwarfStrOffDWOSection();
+ MCSection *OffSec = Asm->getObjFileLowering().getDwarfStrOffDWOSection();
InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
OffSec);
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 59024a78a7c..700f736009c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -371,7 +371,7 @@ class DwarfDebug : public AsmPrinterHandler {
void emitAbbreviations();
/// \brief Emit a specified accelerator table.
- void emitAccel(DwarfAccelTable &Accel, const MCSection *Section,
+ void emitAccel(DwarfAccelTable &Accel, MCSection *Section,
StringRef TableName);
/// \brief Emit visible names into a hashed accelerator table section.
@@ -400,7 +400,7 @@ class DwarfDebug : public AsmPrinterHandler {
void emitDebugPubTypes(bool GnuStyle = false);
void emitDebugPubSection(
- bool GnuStyle, const MCSection *PSec, StringRef Name,
+ bool GnuStyle, MCSection *PSec, StringRef Name,
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const);
/// \brief Emit visible names into a debug str section.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
index 1d6298c228a..10b58d4e86a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp
@@ -50,7 +50,7 @@ void DwarfFile::addUnit(std::unique_ptr<DwarfUnit> U) {
void DwarfFile::emitUnits(bool UseOffsets) {
for (const auto &TheU : CUs) {
DIE &Die = TheU->getUnitDie();
- const MCSection *USection = TheU->getSection();
+ MCSection *USection = TheU->getSection();
Asm->OutStreamer->SwitchSection(USection);
TheU->emitHeader(UseOffsets);
@@ -120,7 +120,7 @@ unsigned DwarfFile::computeSizeAndOffset(DIE &Die, unsigned Offset) {
return Offset;
}
-void DwarfFile::emitAbbrevs(const MCSection *Section) {
+void DwarfFile::emitAbbrevs(MCSection *Section) {
// Check to see if it is worth the effort.
if (!Abbreviations.empty()) {
// Start the debug abbrev section.
@@ -130,8 +130,7 @@ void DwarfFile::emitAbbrevs(const MCSection *Section) {
}
// Emit strings into a string section.
-void DwarfFile::emitStrings(const MCSection *StrSection,
- const MCSection *OffsetSection) {
+void DwarfFile::emitStrings(MCSection *StrSection, MCSection *OffsetSection) {
StrPool.emit(*Asm, StrSection, OffsetSection);
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
index a3a5e99e3a8..27e6ff6036d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
@@ -82,11 +82,10 @@ public:
void emitUnits(bool UseOffsets);
/// \brief Emit a set of abbreviations to the specific section.
- void emitAbbrevs(const MCSection *);
+ void emitAbbrevs(MCSection *);
/// \brief Emit all of the strings to the section given.
- void emitStrings(const MCSection *StrSection,
- const MCSection *OffsetSection = nullptr);
+ void emitStrings(MCSection *StrSection, MCSection *OffsetSection = nullptr);
/// \brief Returns the string pool.
DwarfStringPool &getStringPool() { return StrPool; }
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
index ee224f8b4d9..b7a421f5a1b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
@@ -32,8 +32,8 @@ unsigned DwarfStringPool::getIndex(AsmPrinter &Asm, StringRef Str) {
return getEntry(Asm, Pool, Prefix, Str).second;
}
-void DwarfStringPool::emit(AsmPrinter &Asm, const MCSection *StrSection,
- const MCSection *OffsetSection) {
+void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection,
+ MCSection *OffsetSection) {
if (Pool.empty())
return;
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
index 63e34123d85..9f32b98e2b3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.h
@@ -32,8 +32,8 @@ public:
DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
: Pool(A), Prefix(Prefix) {}
- void emit(AsmPrinter &Asm, const MCSection *StrSection,
- const MCSection *OffsetSection = nullptr);
+ void emit(AsmPrinter &Asm, MCSection *StrSection,
+ MCSection *OffsetSection = nullptr);
/// \brief Returns an entry into the string pool with the given
/// string text.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index ee233f710f2..47a8c6d8264 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1513,7 +1513,7 @@ void DwarfUnit::emitHeader(bool UseOffsets) {
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
}
-void DwarfUnit::initSection(const MCSection *Section) {
+void DwarfUnit::initSection(MCSection *Section) {
assert(!this->Section);
this->Section = Section;
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index a0ea3c870c3..0d01a9e9fb3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -115,7 +115,7 @@ protected:
DIEInteger *DIEIntegerOne;
/// The section this unit will be emitted in.
- const MCSection *Section;
+ MCSection *Section;
DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU);
@@ -132,9 +132,9 @@ protected:
public:
virtual ~DwarfUnit();
- void initSection(const MCSection *Section);
+ void initSection(MCSection *Section);
- const MCSection *getSection() const {
+ MCSection *getSection() const {
assert(Section);
return Section;
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
index 6fd332cba54..1be3fd74d60 100644
--- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
@@ -388,7 +388,7 @@ void EHStreamer::emitExceptionTable() {
}
// Type infos.
- const MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
+ MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
unsigned TTypeEncoding;
unsigned TypeFormatSize;
diff --git a/llvm/lib/CodeGen/StackMaps.cpp b/llvm/lib/CodeGen/StackMaps.cpp
index c1aa8c1d2a6..ffe59c19d3e 100644
--- a/llvm/lib/CodeGen/StackMaps.cpp
+++ b/llvm/lib/CodeGen/StackMaps.cpp
@@ -524,8 +524,8 @@ void StackMaps::serializeToStackMapSection() {
MCStreamer &OS = *AP.OutStreamer;
// Create the section.
- const MCSection *StackMapSection =
- OutContext.getObjectFileInfo()->getStackMapSection();
+ MCSection *StackMapSection =
+ OutContext.getObjectFileInfo()->getStackMapSection();
OS.SwitchSection(StackMapSection);
// Emit a dummy symbol to force section inclusion.
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 69142d7902e..a32bdf8955c 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -69,10 +69,8 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer,
StringRef Prefix = ".data.";
NameData.insert(NameData.begin(), Prefix.begin(), Prefix.end());
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_GROUP;
- const MCSection *Sec = getContext().getELFSection(NameData,
- ELF::SHT_PROGBITS,
- Flags,
- 0, Label->getName());
+ MCSection *Sec = getContext().getELFSection(NameData, ELF::SHT_PROGBITS,
+ Flags, 0, Label->getName());
unsigned Size = TM.getDataLayout()->getPointerSize();
Streamer.SwitchSection(Sec);
Streamer.EmitValueToAlignment(TM.getDataLayout()->getPointerABIAlignment());
@@ -201,7 +199,7 @@ static const Comdat *getELFComdat(const GlobalValue *GV) {
return C;
}
-const MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
+MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
StringRef SectionName = GV->getSection();
@@ -245,7 +243,7 @@ static StringRef getSectionPrefixForGlobal(SectionKind Kind) {
return ".data.rel.ro";
}
-static const MCSectionELF *
+static MCSectionELF *
selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
SectionKind Kind, Mangler &Mang,
const TargetMachine &TM, bool EmitUniqueSection,
@@ -308,7 +306,7 @@ selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
EntrySize, Group, UniqueID);
}
-const MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
+MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
unsigned Flags = getELFSectionFlags(Kind);
@@ -328,7 +326,7 @@ const MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
EmitUniqueSection, Flags, &NextUniqueID);
}
-const MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
+MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
// If the function can be removed, produce a unique section so that
// the table doesn't prevent the removal.
@@ -349,10 +347,9 @@ bool TargetLoweringObjectFileELF::shouldPutJumpTableInFunctionSection(
return false;
}
-/// getSectionForConstant - Given a mergeable constant with the
-/// specified size and relocation information, return a section that it
-/// should be placed in.
-const MCSection *
+/// Given a mergeable constant with the specified size and relocation
+/// information, return a section that it should be placed in.
+MCSection *
TargetLoweringObjectFileELF::getSectionForConstant(SectionKind Kind,
const Constant *C) const {
if (Kind.isMergeableConst4() && MergeableConst4Section)
@@ -369,11 +366,9 @@ TargetLoweringObjectFileELF::getSectionForConstant(SectionKind Kind,
return DataRelROSection;
}
-static const MCSectionELF *getStaticStructorSection(MCContext &Ctx,
- bool UseInitArray,
- bool IsCtor,
- unsigned Priority,
- const MCSymbol *KeySym) {
+static MCSectionELF *getStaticStructorSection(MCContext &Ctx, bool UseInitArray,
+ bool IsCtor, unsigned Priority,
+ const MCSymbol *KeySym) {
std::string Name;
unsigned Type;
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE;
@@ -411,13 +406,13 @@ static const MCSectionELF *getStaticStructorSection(MCContext &Ctx,
return Ctx.getELFSection(Name, Type, Flags, 0, COMDAT);
}
-const MCSection *TargetLoweringObjectFileELF::getStaticCtorSection(
+MCSection *TargetLoweringObjectFileELF::getStaticCtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
return getStaticStructorSection(getContext(), UseInitArray, true, Priority,
KeySym);
}
-const MCSection *TargetLoweringObjectFileELF::getStaticDtorSection(
+MCSection *TargetLoweringObjectFileELF::getStaticDtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
return getStaticStructorSection(getContext(), UseInitArray, false, Priority,
KeySym);
@@ -520,9 +515,8 @@ emitModuleFlags(MCStreamer &Streamer,
ErrorCode + ".");
// Get the section.
- const MCSectionMachO *S =
- getContext().getMachOSection(Segment, Section, TAA, StubSize,
- SectionKind::getDataNoRel());
+ MCSectionMachO *S = getContext().getMachOSection(
+ Segment, Section, TAA, StubSize, SectionKind::getDataNoRel());
Streamer.SwitchSection(S);
Streamer.EmitLabel(getContext().
getOrCreateSymbol(StringRef("L_OBJC_IMAGE_INFO")));
@@ -540,7 +534,7 @@ static void checkMachOComdat(const GlobalValue *GV) {
"' cannot be lowered.");
}
-const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
+MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
// Parse the section specifier and create it if valid.
@@ -561,8 +555,8 @@ const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
}
// Get the section.
- const MCSectionMachO *S =
- getContext().getMachOSection(Segment, Section, TAA, StubSize, Kind);
+ MCSectionMachO *S =
+ getContext().getMachOSection(Segment, Section, TAA, StubSize, Kind);
// If TAA wasn't set by ParseSectionSpecifier() above,
// use the value returned by getMachOSection() as a default.
@@ -582,9 +576,9 @@ const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
return S;
}
-const MCSection *TargetLoweringObjectFileMachO::
-SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler &Mang, const TargetMachine &TM) const {
+MCSection *TargetLoweringObjectFileMachO::SelectSectionForGlobal(
+ const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
+ const TargetMachine &TM) const {
checkMachOComdat(GV);
// Handle thread local data.
@@ -649,7 +643,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
return DataSection;
}
-const MCSection *
+MCSection *
TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind,
const Constant *C) const {
// If this constant requires a relocation, we have to put it in the data
@@ -861,7 +855,7 @@ static int getSelectionForCOFF(const GlobalValue *GV) {
return 0;
}
-const MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
+MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
int Selection = 0;
@@ -903,10 +897,9 @@ static const char *getCOFFSectionNameForUniqueGlobal(SectionKind Kind) {
return ".data";
}
-
-const MCSection *TargetLoweringObjectFileCOFF::
-SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler &Mang, const TargetMachine &TM) const {
+MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
+ const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
+ const TargetMachine &TM) const {
// If we have -ffunction-sections then we should emit the global value to a
// uniqued section specifically for it.
bool EmitUniquedSection;
@@ -971,7 +964,7 @@ void TargetLoweringObjectFileCOFF::getNameWithPrefix(
Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
}
-const MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
+MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
// If the function can be removed, produce a unique section so that
// the table doesn't prevent the removal.
@@ -1026,7 +1019,7 @@ emitModuleFlags(MCStreamer &Streamer,
// Emit the linker options to the linker .drectve section. According to the
// spec, this section is a space-separated string containing flags for linker.
- const MCSection *Sec = getDrectveSection();
+ MCSection *Sec = getDrectveSection();
Streamer.SwitchSection(Sec);
for (unsigned i = 0, e = LinkerOptions->getNumOperands(); i != e; ++i) {
MDNode *MDOptions = cast<MDNode>(LinkerOptions->getOperand(i));
@@ -1040,13 +1033,13 @@ emitModuleFlags(MCStreamer &Streamer,
}
}
-const MCSection *TargetLoweringObjectFileCOFF::getStaticCtorSection(
+MCSection *TargetLoweringObjectFileCOFF::getStaticCtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
return getContext().getAssociativeCOFFSection(
cast<MCSectionCOFF>(StaticCtorSection), KeySym);
}
-const MCSection *TargetLoweringObjectFileCOFF::getStaticDtorSection(
+MCSection *TargetLoweringObjectFileCOFF::getStaticDtorSection(
unsigned Priority, const MCSymbol *KeySym) const {
return getContext().getAssociativeCOFFSection(
cast<MCSectionCOFF>(StaticDtorSection), KeySym);
diff --git a/llvm/lib/MC/ConstantPools.cpp b/llvm/lib/MC/ConstantPools.cpp
index 8011c799750..a723aa8fa40 100644
--- a/llvm/lib/MC/ConstantPools.cpp
+++ b/llvm/lib/MC/ConstantPools.cpp
@@ -48,8 +48,7 @@ bool ConstantPool::empty() { return Entries.empty(); }
//
// AssemblerConstantPools implementation
//
-ConstantPool *
-AssemblerConstantPools::getConstantPool(const MCSection *Section) {
+ConstantPool *AssemblerConstantPools::getConstantPool(MCSection *Section) {
ConstantPoolMapTy::iterator CP = ConstantPools.find(Section);
if (CP == ConstantPools.end())
return nullptr;
@@ -58,11 +57,11 @@ AssemblerConstantPools::getConstantPool(const MCSection *Section) {
}
ConstantPool &
-AssemblerConstantPools::getOrCreateConstantPool(const MCSection *Section) {
+AssemblerConstantPools::getOrCreateConstantPool(MCSection *Section) {
return ConstantPools[Section];
}
-static void emitConstantPool(MCStreamer &Streamer, const MCSection *Section,
+static void emitConstantPool(MCStreamer &Streamer, MCSection *Section,
ConstantPool &CP) {
if (!CP.empty()) {
Streamer.SwitchSection(Section);
@@ -75,7 +74,7 @@ void AssemblerConstantPools::emitAll(MCStreamer &Streamer) {
for (ConstantPoolMapTy::iterator CPI = ConstantPools.begin(),
CPE = ConstantPools.end();
CPI != CPE; ++CPI) {
- const MCSection *Section = CPI->first;
+ MCSection *Section = CPI->first;
ConstantPool &CP = CPI->second;
emitConstantPool(Streamer, Section, CP);
@@ -83,7 +82,7 @@ void AssemblerConstantPools::emitAll(MCStreamer &Streamer) {
}
void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
- const MCSection *Section = Streamer.getCurrentSection().first;
+ MCSection *Section = Streamer.getCurrentSection().first;
if (ConstantPool *CP = getConstantPool(Section)) {
emitConstantPool(Streamer, Section, *CP);
}
@@ -92,7 +91,7 @@ void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
const MCExpr *AssemblerConstantPools::addEntry(MCStreamer &Streamer,
const MCExpr *Expr,
unsigned Size) {
- const MCSection *Section = Streamer.getCurrentSection().first;
+ MCSection *Section = Streamer.getCurrentSection().first;
return getOrCreateConstantPool(Section).addEntry(Expr, Streamer.getContext(),
Size);
}
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index c36da56f0ce..ff1c2a9ecc1 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -133,8 +133,8 @@ class ELFObjectWriter : public MCObjectWriter {
unsigned ShstrtabIndex;
// Sections in the order they are to be output in the section table.
- std::vector<const MCSectionELF *> SectionTable;
- unsigned addToSectionTable(const MCSectionELF *Sec);
+ std::vector<MCSectionELF *> SectionTable;
+ unsigned addToSectionTable(MCSectionELF *Sec);
// TargetObjectWriter wrappers.
bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
@@ -221,8 +221,8 @@ class ELFObjectWriter : public MCObjectWriter {
const SectionIndexMapTy &SectionIndexMap,
const RevGroupMapTy &RevGroupMap);
- const MCSectionELF *createRelocationSection(MCAssembler &Asm,
- const MCSectionELF &Sec);
+ MCSectionELF *createRelocationSection(MCAssembler &Asm,
+ const MCSectionELF &Sec);
const MCSectionELF *createSectionHeaderStringTable();
const MCSectionELF *createStringTable(MCContext &Ctx);
@@ -261,7 +261,7 @@ class ELFObjectWriter : public MCObjectWriter {
};
}
-unsigned ELFObjectWriter::addToSectionTable(const MCSectionELF *Sec) {
+unsigned ELFObjectWriter::addToSectionTable(MCSectionELF *Sec) {
SectionTable.push_back(Sec);
ShStrTabBuilder.add(Sec->getSectionName());
return SectionTable.size();
@@ -549,7 +549,7 @@ void ELFObjectWriter::WriteSymbolTable(MCAssembler &Asm,
unsigned EntrySize = is64Bit() ? ELF::SYMENTRY_SIZE64 : ELF::SYMENTRY_SIZE32;
// Symbol table
- const MCSectionELF *SymtabSection =
+ MCSectionELF *SymtabSection =
Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0, EntrySize, "");
MCSectionData &SymtabSD = Asm.getOrCreateSectionData(*SymtabSection);
SymtabSD.setAlignment(is64Bit() ? 8 : 4);
@@ -608,7 +608,7 @@ void ELFObjectWriter::WriteSymbolTable(MCAssembler &Asm,
return;
SecStart = OS.tell();
- const MCSectionELF *SymtabShndxSection =
+ MCSectionELF *SymtabShndxSection =
Ctx.getELFSection(".symtab_shndxr", ELF::SHT_SYMTAB_SHNDX, 0, 4, "");
addToSectionTable(SymtabShndxSection);
MCSectionData *SymtabShndxSD =
@@ -1064,7 +1064,7 @@ void ELFObjectWriter::computeSymbolTable(
UndefinedSymbolData[i].Symbol->getData().setIndex(Index++);
}
-const MCSectionELF *
+MCSectionELF *
ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
const MCSectionELF &Sec) {
if (Relocations[&Sec].empty())
@@ -1085,7 +1085,7 @@ ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
if (Sec.getFlags() & ELF::SHF_GROUP)
Flags = ELF::SHF_GROUP;
- const MCSectionELF *RelaSection = Ctx.createELFRelSection(
+ MCSectionELF *RelaSection = Ctx.createELFRelSection(
RelaSectionName, hasRelocationAddend() ? ELF::SHT_RELA : ELF::SHT_REL,
Flags, EntrySize, Sec.getGroup(), &Sec);
MCSectionData &RelSD = Asm.getOrCreateSectionData(*RelaSection);
@@ -1141,8 +1141,7 @@ prependCompressionHeader(uint64_t Size,
void ELFObjectWriter::writeSectionData(const MCAssembler &Asm,
const MCSectionData &SD,
const MCAsmLayout &Layout) {
- const MCSectionELF &Section =
- static_cast<const MCSectionELF &>(SD.getSection());
+ MCSectionELF &Section = static_cast<MCSectionELF &>(SD.getSection());
StringRef SectionName = Section.getSectionName();
// Compressing debug_frame requires handling alignment fragments which is
@@ -1245,7 +1244,7 @@ const MCSectionELF *ELFObjectWriter::createSectionHeaderStringTable() {
}
const MCSectionELF *ELFObjectWriter::createStringTable(MCContext &Ctx) {
- const MCSectionELF *StrtabSection =
+ MCSectionELF *StrtabSection =
Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0);
StringTableIndex = addToSectionTable(StrtabSection);
OS << StrTabBuilder.data();
@@ -1315,7 +1314,7 @@ void ELFObjectWriter::writeSectionHeader(
(NumSections + 1) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0;
WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, 0, 0);
- for (const MCSectionELF *Section : SectionTable) {
+ for (MCSectionELF *Section : SectionTable) {
const MCSectionData &SD = Asm.getOrCreateSectionData(*Section);
uint32_t GroupSymbolIndex;
unsigned Type = Section->getType();
@@ -1337,7 +1336,7 @@ void ELFObjectWriter::writeSectionHeader(
void ELFObjectWriter::WriteObject(MCAssembler &Asm,
const MCAsmLayout &Layout) {
MCContext &Ctx = Asm.getContext();
- const MCSectionELF *ShstrtabSection =
+ MCSectionELF *ShstrtabSection =
Ctx.getELFSection(".shstrtab", ELF::SHT_STRTAB, 0);
ShstrtabIndex = addToSectionTable(ShstrtabSection);
@@ -1353,8 +1352,7 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
SectionOffsetsTy SectionOffsets;
bool ComputedSymtab = false;
for (const MCSectionData &SD : Asm) {
- const MCSectionELF &Section =
- static_cast<const MCSectionELF &>(SD.getSection());
+ MCSectionELF &Section = static_cast<MCSectionELF &>(SD.getSection());
uint64_t Padding = OffsetToAlignment(OS.tell(), SD.getAlignment());
WriteZeros(Padding);
@@ -1388,13 +1386,13 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
if (Type == ELF::SHT_GROUP || Type == ELF::SHT_REL || Type == ELF::SHT_RELA)
continue;
- const MCSectionELF *RelSection = createRelocationSection(Asm, Section);
+ MCSectionELF *RelSection = createRelocationSection(Asm, Section);
if (SignatureSymbol) {
Asm.getOrCreateSymbolData(*SignatureSymbol);
unsigned &GroupIdx = RevGroupMap[SignatureSymbol];
if (!GroupIdx) {
- const MCSectionELF *Group = Ctx.createELFGroupSection(SignatureSymbol);
+ MCSectionELF *Group = Ctx.createELFGroupSection(SignatureSymbol);
GroupIdx = addToSectionTable(Group);
MCSectionData *GroupD = &Asm.getOrCreateSectionData(*Group);
GroupD->setAlignment(4);
diff --git a/llvm/lib/MC/MCAsmInfoELF.cpp b/llvm/lib/MC/MCAsmInfoELF.cpp
index cd61a43afc4..2bff6e05966 100644
--- a/llvm/lib/MC/MCAsmInfoELF.cpp
+++ b/llvm/lib/MC/MCAsmInfoELF.cpp
@@ -20,8 +20,7 @@ using namespace llvm;
void MCAsmInfoELF::anchor() { }
-const MCSection *
-MCAsmInfoELF::getNonexecutableStackSection(MCContext &Ctx) const {
+MCSection *MCAsmInfoELF::getNonexecutableStackSection(MCContext &Ctx) const {
return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS, 0);
}
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 2602718e615..e51cec1dad2 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -114,8 +114,7 @@ public:
/// @name MCStreamer Interface
/// @{
- void ChangeSection(const MCSection *Section,
- const MCExpr *Subsection) override;
+ void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override;
void EmitLabel(MCSymbol *Symbol) override;
@@ -150,11 +149,11 @@ public:
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override;
- void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
+ void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
- void EmitTBSSSymbol (const MCSection *Section, MCSymbol *Symbol,
- uint64_t Size, unsigned ByteAlignment = 0) override;
+ void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
+ unsigned ByteAlignment = 0) override;
void EmitBytes(StringRef Data) override;
@@ -297,7 +296,7 @@ void MCAsmStreamer::emitRawComment(const Twine &T, bool TabPrefix) {
EmitEOL();
}
-void MCAsmStreamer::ChangeSection(const MCSection *Section,
+void MCAsmStreamer::ChangeSection(MCSection *Section,
const MCExpr *Subsection) {
assert(Section && "Cannot switch to a null section!");
Section->PrintSwitchToSection(*MAI, OS, Subsection);
@@ -542,7 +541,7 @@ void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
EmitEOL();
}
-void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
+void MCAsmStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
if (Symbol)
AssignSection(Symbol, Section);
@@ -565,7 +564,7 @@ void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
// .tbss sym, size, align
// This depends that the symbol has already been mangled from the original,
// e.g. _a.
-void MCAsmStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
+void MCAsmStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
AssignSection(Symbol, Section);
@@ -1102,7 +1101,7 @@ void MCAsmStreamer::EmitWinEHHandlerData() {
// We only do this so the section switch that terminates the handler
// data block is visible.
WinEH::FrameInfo *CurFrame = getCurrentWinFrameInfo();
- if (const MCSection *XData = WinEH::UnwindEmitter::getXDataSection(
+ if (MCSection *XData = WinEH::UnwindEmitter::getXDataSection(
CurFrame->Function, getContext()))
SwitchSectionNoChange(XData);
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 8f9320af2b1..c2ddb93880e 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -292,14 +292,20 @@ MCEncodedFragmentWithFixups::~MCEncodedFragmentWithFixups() {
MCSectionData::MCSectionData() : Section(nullptr) {}
-MCSectionData::MCSectionData(const MCSection &Section, MCAssembler *A)
- : Section(&Section), Ordinal(~UINT32_C(0)), Alignment(1),
+MCSectionData::MCSectionData(MCSection &Section, MCAssembler *A)
+ : Section(&Section), Ordinal(~UINT32_C(0)),
BundleLockState(NotBundleLocked), BundleLockNestingDepth(0),
BundleGroupBeforeFirstInst(false), HasInstructions(false) {
if (A)
A->getSectionList().push_back(this);
}
+unsigned MCSectionData::getAlignment() const { return Section->getAlignment(); }
+
+void MCSectionData::setAlignment(unsigned Value) {
+ Section->setAlignment(Value);
+}
+
MCSectionData::iterator
MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {
if (Subsection == 0 && SubsectionFragmentMap.empty())
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index cbc130f6bfa..f3ea3cc1691 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -241,10 +241,10 @@ MCSymbol *MCContext::lookupSymbol(const Twine &Name) const {
// Section Management
//===----------------------------------------------------------------------===//
-const MCSectionMachO *
-MCContext::getMachOSection(StringRef Segment, StringRef Section,
- unsigned TypeAndAttributes, unsigned Reserved2,
- SectionKind Kind, const char *BeginSymName) {
+MCSectionMachO *MCContext::getMachOSection(StringRef Segment, StringRef Section,
+ unsigned TypeAndAttributes,
+ unsigned Reserved2, SectionKind Kind,
+ const char *BeginSymName) {
// We unique sections by their segment/section pair. The returned section
// may not have the same flags as the requested section, if so this should be
@@ -257,7 +257,7 @@ MCContext::getMachOSection(StringRef Segment, StringRef Section,
Name += Section;
// Do the lookup, if we have a hit, return it.
- const MCSectionMachO *&Entry = MachOUniquingMap[Name];
+ MCSectionMachO *&Entry = MachOUniquingMap[Name];
if (Entry)
return Entry;
@@ -270,7 +270,7 @@ MCContext::getMachOSection(StringRef Segment, StringRef Section,
Reserved2, Kind, Begin);
}
-void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) {
+void MCContext::renameELFSection(MCSectionELF *Section, StringRef Name) {
StringRef GroupName;
if (const MCSymbol *Group = Section->getGroup())
GroupName = Group->getName();
@@ -286,10 +286,10 @@ void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) {
const_cast<MCSectionELF *>(Section)->setSectionName(CachedName);
}
-const MCSectionELF *
-MCContext::createELFRelSection(StringRef Name, unsigned Type, unsigned Flags,
- unsigned EntrySize, const MCSymbol *Group,
- const MCSectionELF *Associated) {
+MCSectionELF *MCContext::createELFRelSection(StringRef Name, unsigned Type,
+ unsigned Flags, unsigned EntrySize,
+ const MCSymbol *Group,
+ const MCSectionELF *Associated) {
StringMap<bool>::iterator I;
bool Inserted;
std::tie(I, Inserted) = ELFRelSecNames.insert(std::make_pair(Name, true));
@@ -299,10 +299,10 @@ MCContext::createELFRelSection(StringRef Name, unsigned Type, unsigned Flags,
EntrySize, Group, true, nullptr, Associated);
}
-const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
- unsigned Flags, unsigned EntrySize,
- StringRef Group, unsigned UniqueID,
- const char *BeginSymName) {
+MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
+ unsigned Flags, unsigned EntrySize,
+ StringRef Group, unsigned UniqueID,
+ const char *BeginSymName) {
MCSymbol *GroupSym = nullptr;
if (!Group.empty())
GroupSym = getOrCreateSymbol(Group);
@@ -311,12 +311,12 @@ const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
BeginSymName, nullptr);
}
-const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
- unsigned Flags, unsigned EntrySize,
- const MCSymbol *GroupSym,
- unsigned UniqueID,
- const char *BeginSymName,
- const MCSectionELF *Associated) {
+MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
+ unsigned Flags, unsigned EntrySize,
+ const MCSymbol *GroupSym,
+ unsigned UniqueID,
+ const char *BeginSymName,
+ const MCSectionELF *Associated) {
StringRef Group = "";
if (GroupSym)
Group = GroupSym->getName();
@@ -346,17 +346,18 @@ const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
return Result;
}
-const MCSectionELF *MCContext::createELFGroupSection(const MCSymbol *Group) {
+MCSectionELF *MCContext::createELFGroupSection(const MCSymbol *Group) {
MCSectionELF *Result = new (*this)
MCSectionELF(".group", ELF::SHT_GROUP, 0, SectionKind::getReadOnly(), 4,
Group, ~0, nullptr, nullptr);
return Result;
}
-const MCSectionCOFF *
-MCContext::getCOFFSection(StringRef Section, unsigned Characteristics,
- SectionKind Kind, StringRef COMDATSymName,
- int Selection, const char *BeginSymName) {
+MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
+ unsigned Characteristics,
+ SectionKind Kind,
+ StringRef COMDATSymName, int Selection,
+ const char *BeginSymName) {
MCSymbol *COMDATSymbol = nullptr;
if (!COMDATSymName.empty()) {
COMDATSymbol = getOrCreateSymbol(COMDATSymName);
@@ -382,14 +383,14 @@ MCContext::getCOFFSection(StringRef Section, unsigned Characteristics,
return Result;
}
-const MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
- unsigned Characteristics,
- SectionKind Kind,
- const char *BeginSymName) {
+MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
+ unsigned Characteristics,
+ SectionKind Kind,
+ const char *BeginSymName) {
return getCOFFSection(Section, Characteristics, Kind, "", 0, BeginSymName);
}
-const MCSectionCOFF *MCContext::getCOFFSection(StringRef Section) {
+MCSectionCOFF *MCContext::getCOFFSection(StringRef Section) {
COFFSectionKey T{Section, "", 0};
auto Iter = COFFUniquingMap.find(T);
if (Iter == COFFUniquingMap.end())
@@ -397,9 +398,8 @@ const MCSectionCOFF *MCContext::getCOFFSection(StringRef Section) {
return Iter->second;
}
-const MCSectionCOFF *
-MCContext::getAssociativeCOFFSection(const MCSectionCOFF *Sec,
- const MCSymbol *KeySym) {
+MCSectionCOFF *MCContext::getAssociativeCOFFSection(MCSectionCOFF *Sec,
+ const MCSymbol *KeySym) {
// Return the normal section if we don't have to be associative.
if (!KeySym)
return Sec;
@@ -440,8 +440,8 @@ bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
/// Remove empty sections from SectionStartEndSyms, to avoid generating
/// useless debug info for them.
void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
- std::vector<const MCSection *> Keep;
- for (const MCSection *Sec : SectionsForRanges) {
+ std::vector<MCSection *> Keep;
+ for (MCSection *Sec : SectionsForRanges) {
if (MCOS.mayHaveInstructions(*Sec))
Keep.push_back(Sec);
}
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index ad70d61dccb..a7e83f61708 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -64,7 +64,7 @@ static inline uint64_t ScaleAddrDelta(MCContext &Context, uint64_t AddrDelta) {
// and if there is information from the last .loc directive that has yet to have
// a line entry made for it is made.
//
-void MCLineEntry::Make(MCObjectStreamer *MCOS, const MCSection *Section) {
+void MCLineEntry::Make(MCObjectStreamer *MCOS, MCSection *Section) {
if (!MCOS->getContext().getDwarfLocSeen())
return;
@@ -115,7 +115,7 @@ static inline const MCExpr *MakeStartMinusEndExpr(const MCStreamer &MCOS,
// in the LineSection.
//
static inline void
-EmitDwarfLineTable(MCObjectStreamer *MCOS, const MCSection *Section,
+EmitDwarfLineTable(MCObjectStreamer *MCOS, MCSection *Section,
const MCLineSection::MCLineEntryCollection &LineEntries) {
unsigned FileNum = 1;
unsigned LastLine = 1;
@@ -610,8 +610,8 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS,
// Now emit the table of pairs of PointerSize'ed values for the section
// addresses and sizes.
- for (const MCSection *Sec : Sections) {
- MCSymbol *StartSymbol = Sec->getBeginSymbol();
+ for (MCSection *Sec : Sections) {
+ const MCSymbol *StartSymbol = Sec->getBeginSymbol();
MCSymbol *EndSymbol = Sec->getEndSymbol(context);
assert(StartSymbol && "StartSymbol must not be NULL");
assert(EndSymbol && "EndSymbol must not be NULL");
@@ -805,8 +805,8 @@ static void EmitGenDwarfRanges(MCStreamer *MCOS) {
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfRangesSection());
- for (const MCSection *Sec : Sections) {
- MCSymbol *StartSymbol = Sec->getBeginSymbol();
+ for (MCSection *Sec : Sections) {
+ const MCSymbol *StartSymbol = Sec->getBeginSymbol();
MCSymbol *EndSymbol = Sec->getEndSymbol(context);
assert(StartSymbol && "StartSymbol must not be NULL");
assert(EndSymbol && "EndSymbol must not be NULL");
@@ -1520,9 +1520,9 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
if (!NeedsEHFrameSection) return;
- const MCSection &Section =
- IsEH ? *const_cast<MCObjectFileInfo*>(MOFI)->getEHFrameSection() :
- *MOFI->getDwarfFrameSection();
+ MCSection &Section =
+ IsEH ? *const_cast<MCObjectFileInfo *>(MOFI)->getEHFrameSection()
+ : *MOFI->getDwarfFrameSection();
Streamer.SwitchSection(&Section);
MCSymbol *SectionStart = Context.createTempSymbol();
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index fe54dcbd83c..7b02f1a4528 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -141,7 +141,7 @@ static void setSectionAlignmentForBundling(
Section->setAlignment(Assembler.getBundleAlignSize());
}
-void MCELFStreamer::ChangeSection(const MCSection *Section,
+void MCELFStreamer::ChangeSection(MCSection *Section,
const MCExpr *Subsection) {
MCSectionData *CurSection = getCurrentSectionData();
if (CurSection && CurSection->isBundleLocked())
@@ -314,7 +314,7 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
MCELF::SetType(SD, ELF::STT_OBJECT);
if (MCELF::GetBinding(SD) == ELF_STB_Local) {
- const MCSection *Section = getAssembler().getContext().getELFSection(
+ MCSection *Section = getAssembler().getContext().getELFSection(
".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
AssignSection(Symbol, Section);
@@ -369,7 +369,7 @@ void MCELFStreamer::EmitFileDirective(StringRef Filename) {
}
void MCELFStreamer::EmitIdent(StringRef IdentString) {
- const MCSection *Comment = getAssembler().getContext().getELFSection(
+ MCSection *Comment = getAssembler().getContext().getELFSection(
".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS, 1, "");
PushSection();
SwitchSection(Comment);
@@ -633,7 +633,7 @@ void MCELFStreamer::Flush() {
const MCSymbol &Symbol = *i->Symbol;
uint64_t Size = i->Size;
unsigned ByteAlignment = i->ByteAlignment;
- const MCSection &Section = Symbol.getSection();
+ MCSection &Section = Symbol.getSection();
MCSectionData &SectData = getAssembler().getOrCreateSectionData(Section);
new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment, &SectData);
@@ -693,12 +693,12 @@ void MCELFStreamer::EndCOFFSymbolDef() {
llvm_unreachable("ELF doesn't support this directive");
}
-void MCELFStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
+void MCELFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
llvm_unreachable("ELF doesn't support this directive");
}
-void MCELFStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
+void MCELFStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
llvm_unreachable("ELF doesn't support this directive");
}
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 3bb8d2f358e..b2c6965319f 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -755,7 +755,7 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
llvm_unreachable("Invalid assembly expression kind!");
}
-const MCSection *MCExpr::FindAssociatedSection() const {
+MCSection *MCExpr::FindAssociatedSection() const {
switch (getKind()) {
case Target:
// We never look through target specific expressions.
@@ -779,8 +779,8 @@ const MCSection *MCExpr::FindAssociatedSection() const {
case Binary: {
const MCBinaryExpr *BE = cast<MCBinaryExpr>(this);
- const MCSection *LHS_S = BE->getLHS()->FindAssociatedSection();
- const MCSection *RHS_S = BE->getRHS()->FindAssociatedSection();
+ MCSection *LHS_S = BE->getLHS()->FindAssociatedSection();
+ MCSection *RHS_S = BE->getRHS()->FindAssociatedSection();
// If either section is absolute, return the other.
if (LHS_S == MCSymbol::AbsolutePseudoSection)
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index c0efc8e17bd..c9777809a7f 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -68,7 +68,7 @@ public:
/// @name MCStreamer Interface
/// @{
- void ChangeSection(const MCSection *Sect, const MCExpr *Subsect) override;
+ void ChangeSection(MCSection *Sect, const MCExpr *Subsect) override;
void EmitLabel(MCSymbol *Symbol) override;
void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol) override;
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
@@ -98,9 +98,9 @@ public:
}
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override;
- void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
+ void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
- void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, uint64_t Size,
+ void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment = 0) override;
void EmitFileDirective(StringRef Filename) override {
@@ -149,7 +149,7 @@ static bool canGoAfterDWARF(const MCSectionMachO &MSec) {
return false;
}
-void MCMachOStreamer::ChangeSection(const MCSection *Section,
+void MCMachOStreamer::ChangeSection(MCSection *Section,
const MCExpr *Subsection) {
// Change the section normally.
bool Created = MCObjectStreamer::changeSectionImpl(Section, Subsection);
@@ -401,7 +401,7 @@ void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
Symbol, Size, ByteAlignment);
}
-void MCMachOStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
+void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
MCSectionData &SectData = getAssembler().getOrCreateSectionData(*Section);
@@ -432,7 +432,7 @@ void MCMachOStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
// This should always be called with the thread local bss section. Like the
// .zerofill directive this doesn't actually switch sections on us.
-void MCMachOStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
+void MCMachOStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
EmitZerofill(Section, Symbol, Size, ByteAlignment);
return;
diff --git a/llvm/lib/MC/MCNullStreamer.cpp b/llvm/lib/MC/MCNullStreamer.cpp
index fc56728f635..eb2d91254b3 100644
--- a/llvm/lib/MC/MCNullStreamer.cpp
+++ b/llvm/lib/MC/MCNullStreamer.cpp
@@ -31,7 +31,7 @@ namespace {
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override {}
- void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
+ void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
uint64_t Size = 0, unsigned ByteAlignment = 0) override {}
void EmitGPRel32Value(const MCExpr *Value) override {}
};
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 29f5a1d3752..e99f036af16 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -768,7 +768,7 @@ void MCObjectFileInfo::InitMCObjectFileInfo(StringRef T, Reloc::Model relocm,
}
}
-const MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const {
+MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const {
return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
0, utostr(Hash));
}
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 836b1ced5c5..b6d67a81771 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -201,12 +201,12 @@ void MCObjectStreamer::EmitWeakReference(MCSymbol *Alias,
report_fatal_error("This file format doesn't support weak aliases.");
}
-void MCObjectStreamer::ChangeSection(const MCSection *Section,
+void MCObjectStreamer::ChangeSection(MCSection *Section,
const MCExpr *Subsection) {
changeSectionImpl(Section, Subsection);
}
-bool MCObjectStreamer::changeSectionImpl(const MCSection *Section,
+bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
const MCExpr *Subsection) {
assert(Section && "Cannot switch to a null section!");
flushPendingLabels(nullptr);
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 85f463c2bd5..1e805fdfcf1 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -632,7 +632,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
if (getContext().getGenDwarfForAssembly()) {
MCSymbol *SectionStartSym = getContext().createTempSymbol();
getStreamer().EmitLabel(SectionStartSym);
- const MCSection *Sec = getStreamer().getCurrentSection().first;
+ MCSection *Sec = getStreamer().getCurrentSection().first;
bool InsertResult = getContext().addGenDwarfSection(Sec);
assert(InsertResult && ".text section should not have debug info yet");
(void)InsertResult;
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index 6b0a7785517..87b15ffe739 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -527,8 +527,8 @@ EndStmt:
}
}
- const MCSection *ELFSection = getContext().getELFSection(
- SectionName, Type, Flags, Size, GroupName, UniqueID);
+ MCSection *ELFSection = getContext().getELFSection(SectionName, Type, Flags,
+ Size, GroupName, UniqueID);
getStreamer().SwitchSection(ELFSection, Subsection);
if (getContext().getGenDwarfForAssembly()) {
@@ -677,7 +677,7 @@ bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
Lex();
- const MCSection *Note = getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
+ MCSection *Note = getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
getStreamer().PushSection();
getStreamer().SwitchSection(Note);
diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp
index 7889f837b11..7204e6cba1f 100644
--- a/llvm/lib/MC/MCSection.cpp
+++ b/llvm/lib/MC/MCSection.cpp
@@ -18,7 +18,7 @@ using namespace llvm;
// MCSection
//===----------------------------------------------------------------------===//
-MCSymbol *MCSection::getEndSymbol(MCContext &Ctx) const {
+MCSymbol *MCSection::getEndSymbol(MCContext &Ctx) {
if (!End)
End = Ctx.createTempSymbol("sec_end", true);
return End;
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 31e93209842..9e0cc6b534c 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -188,7 +188,7 @@ void MCStreamer::InitSections(bool NoExecStack) {
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
}
-void MCStreamer::AssignSection(MCSymbol *Symbol, const MCSection *Section) {
+void MCStreamer::AssignSection(MCSymbol *Symbol, MCSection *Section) {
if (Section)
Symbol->setSection(*Section);
else
@@ -640,9 +640,9 @@ void MCStreamer::EmitCOFFSymbolType(int Type) {}
void MCStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
void MCStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {}
-void MCStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
+void MCStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {}
-void MCStreamer::ChangeSection(const MCSection *, const MCExpr *) {}
+void MCStreamer::ChangeSection(MCSection *, const MCExpr *) {}
void MCStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
void MCStreamer::EmitBytes(StringRef Data) {}
void MCStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
@@ -664,8 +664,7 @@ void MCStreamer::EmitBundleLock(bool AlignToEnd) {}
void MCStreamer::FinishImpl() {}
void MCStreamer::EmitBundleUnlock() {}
-void MCStreamer::SwitchSection(const MCSection *Section,
- const MCExpr *Subsection) {
+void MCStreamer::SwitchSection(MCSection *Section, const MCExpr *Subsection) {
assert(Section && "Cannot switch to a null section!");
MCSectionSubPair curSection = SectionStack.back().first;
SectionStack.back().second = curSection;
@@ -679,7 +678,7 @@ void MCStreamer::SwitchSection(const MCSection *Section,
}
}
-MCSymbol *MCStreamer::endSection(const MCSection *Section) {
+MCSymbol *MCStreamer::endSection(MCSection *Section) {
// TODO: keep track of the last subsection so that this symbol appears in the
// correct place.
MCSymbol *Sym = Section->getEndSymbol(Context);
diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp
index ccb9f8def9e..0009decef9b 100644
--- a/llvm/lib/MC/MCSymbol.cpp
+++ b/llvm/lib/MC/MCSymbol.cpp
@@ -14,8 +14,7 @@
using namespace llvm;
// Sentinel value for the absolute pseudo section.
-const MCSection *MCSymbol::AbsolutePseudoSection =
- reinterpret_cast<const MCSection *>(1);
+MCSection *MCSymbol::AbsolutePseudoSection = reinterpret_cast<MCSection *>(1);
static bool isAcceptableChar(char C) {
if ((C < 'a' || C > 'z') &&
diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index 7d38427e7c2..f87ea67ee46 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -224,16 +224,14 @@ void UnwindEmitter::Emit(MCStreamer &Streamer) const {
// Emit the unwind info structs first.
for (const auto &CFI : Streamer.getWinFrameInfos()) {
- const MCSection *XData =
- getXDataSection(CFI->Function, Context);
+ MCSection *XData = getXDataSection(CFI->Function, Context);
Streamer.SwitchSection(XData);
EmitUnwindInfo(Streamer, CFI);
}
// Now emit RUNTIME_FUNCTION entries.
for (const auto &CFI : Streamer.getWinFrameInfos()) {
- const MCSection *PData =
- getPDataSection(CFI->Function, Context);
+ MCSection *PData = getPDataSection(CFI->Function, Context);
Streamer.SwitchSection(PData);
EmitRuntimeFunction(Streamer, CFI);
}
@@ -244,8 +242,7 @@ void UnwindEmitter::EmitUnwindInfo(MCStreamer &Streamer,
// Switch sections (the static function above is meant to be called from
// here and from Emit().
MCContext &context = Streamer.getContext();
- const MCSection *xdataSect =
- getXDataSection(info->Function, context);
+ MCSection *xdataSect = getXDataSection(info->Function, context);
Streamer.SwitchSection(xdataSect);
llvm::EmitUnwindInfo(Streamer, info);
diff --git a/llvm/lib/MC/MCWinEH.cpp b/llvm/lib/MC/MCWinEH.cpp
index b1c95f800cf..d5d9eadf39a 100644
--- a/llvm/lib/MC/MCWinEH.cpp
+++ b/llvm/lib/MC/MCWinEH.cpp
@@ -25,9 +25,10 @@ namespace WinEH {
/// associated with that comdat. If the code described is not in the main .text
/// section, make a new section for it. Otherwise use the main unwind info
/// section.
-static const MCSection *getUnwindInfoSection(
- StringRef SecName, const MCSectionCOFF *UnwindSec, const MCSymbol *Function,
- MCContext &Context) {
+static MCSection *getUnwindInfoSection(StringRef SecName,
+ MCSectionCOFF *UnwindSec,
+ const MCSymbol *Function,
+ MCContext &Context) {
if (Function && Function->isInSection()) {
// If Function is in a COMDAT, get or create an unwind info section in that
// COMDAT group.
@@ -59,16 +60,16 @@ static const MCSection *getUnwindInfoSection(
}
-const MCSection *UnwindEmitter::getPDataSection(const MCSymbol *Function,
- MCContext &Context) {
- const MCSectionCOFF *PData =
+MCSection *UnwindEmitter::getPDataSection(const MCSymbol *Function,
+ MCContext &Context) {
+ MCSectionCOFF *PData =
cast<MCSectionCOFF>(Context.getObjectFileInfo()->getPDataSection());
return getUnwindInfoSection(".pdata", PData, Function, Context);
}
-const MCSection *UnwindEmitter::getXDataSection(const MCSymbol *Function,
- MCContext &Context) {
- const MCSectionCOFF *XData =
+MCSection *UnwindEmitter::getXDataSection(const MCSymbol *Function,
+ MCContext &Context) {
+ MCSectionCOFF *XData =
cast<MCSectionCOFF>(Context.getObjectFileInfo()->getXDataSection());
return getUnwindInfoSection(".xdata", XData, Function, Context);
}
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp
index eaddfa49832..d048f287593 100644
--- a/llvm/lib/MC/WinCOFFStreamer.cpp
+++ b/llvm/lib/MC/WinCOFFStreamer.cpp
@@ -219,7 +219,7 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
assert(!Symbol->isInSection() && "Symbol must not already have a section!");
- const MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
+ MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
if (SectionData.getAlignment() < ByteAlignment)
SectionData.setAlignment(ByteAlignment);
@@ -238,15 +238,13 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
SD.setFragment(Fragment);
}
-void MCWinCOFFStreamer::EmitZerofill(const MCSection *Section,
- MCSymbol *Symbol, uint64_t Size,
- unsigned ByteAlignment) {
+void MCWinCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
+ uint64_t Size, unsigned ByteAlignment) {
llvm_unreachable("not implemented");
}
-void MCWinCOFFStreamer::EmitTBSSSymbol(const MCSection *Section,
- MCSymbol *Symbol, uint64_t Size,
- unsigned ByteAlignment) {
+void MCWinCOFFStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
+ uint64_t Size, unsigned ByteAlignment) {
llvm_unreachable("not implemented");
}
diff --git a/llvm/lib/Object/RecordStreamer.cpp b/llvm/lib/Object/RecordStreamer.cpp
index 081faddc214..42dbd3e0c2d 100644
--- a/llvm/lib/Object/RecordStreamer.cpp
+++ b/llvm/lib/Object/RecordStreamer.cpp
@@ -89,7 +89,7 @@ bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
return true;
}
-void RecordStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
+void RecordStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
markDefined(*Symbol);
}
diff --git a/llvm/lib/Object/RecordStreamer.h b/llvm/lib/Object/RecordStreamer.h
index 7dacbdfbfd6..d8610610c33 100644
--- a/llvm/lib/Object/RecordStreamer.h
+++ b/llvm/lib/Object/RecordStreamer.h
@@ -33,7 +33,7 @@ public:
void EmitLabel(MCSymbol *Symbol) override;
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
- void EmitZerofill(const MCSection *Section, MCSymbol *Symbol, uint64_t Size,
+ void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override;
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) override;
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
index 38c859bc1b3..473ffbe6bce 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
@@ -96,8 +96,7 @@ public:
~AArch64ELFStreamer() override {}
- void ChangeSection(const MCSection *Section,
- const MCExpr *Subsection) override {
+ void ChangeSection(MCSection *Section, const MCExpr *Subsection) override {
// We have to keep track of the mapping symbol state of any sections we
// use. Each one should start off as EMS_None, which is provided as the
// default constructor by DenseMap::lookup.
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
index 9e31508bfb0..74b81af2cb4 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
@@ -86,7 +86,7 @@ void AArch64MCExpr::visitUsedExpr(MCStreamer &Streamer) const {
Streamer.visitUsedExpr(*getSubExpr());
}
-const MCSection *AArch64MCExpr::FindAssociatedSection() const {
+MCSection *AArch64MCExpr::FindAssociatedSection() const {
llvm_unreachable("FIXME: what goes here?");
}
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h
index 499b3f50354..95d22775736 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h
@@ -149,7 +149,7 @@ public:
void visitUsedExpr(MCStreamer &Streamer) const override;
- const MCSection *FindAssociatedSection() const override;
+ MCSection *FindAssociatedSection() const override;
bool EvaluateAsRelocatableImpl(MCValue &Res,
const MCAsmLayout *Layout,
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
index 2f5559a16b2..71cc516237f 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -275,7 +275,7 @@ private:
unsigned EmittedArch;
SmallVector<AttributeItem, 64> Contents;
- const MCSection *AttributeSection;
+ MCSection *AttributeSection;
AttributeItem *getAttributeItem(unsigned Attribute) {
for (size_t i = 0; i < Contents.size(); ++i)
@@ -431,8 +431,7 @@ public:
void emitRegSave(const SmallVectorImpl<unsigned> &RegList, bool isVector);
void emitUnwindRaw(int64_t Offset, const SmallVectorImpl<uint8_t> &Opcodes);
- void ChangeSection(const MCSection *Section,
- const MCExpr *Subsection) override {
+ void ChangeSection(MCSection *Section, const MCExpr *Subsection) override {
// We have to keep track of the mapping symbol state of any sections we
// use. Each one should start off as EMS_None, which is provided as the
// default constructor by DenseMap::lookup.
@@ -1028,7 +1027,7 @@ inline void ARMELFStreamer::SwitchToEHSection(const char *Prefix,
const MCSymbol *Group = FnSection.getGroup();
if (Group)
Flags |= ELF::SHF_GROUP;
- const MCSectionELF *EHSection =
+ MCSectionELF *EHSection =
getContext().getELFSection(EHSecName, Type, Flags, 0, Group,
FnSection.getUniqueID(), nullptr, &FnSection);
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h
index 2be98d2e9e7..a52abe7760d 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h
@@ -62,8 +62,8 @@ public:
const MCFixup *Fixup) const override {
return false;
}
- void visitUsedExpr(MCStreamer &Streamer) const override;
- const MCSection *FindAssociatedSection() const override {
+ void visitUsedExpr(MCStreamer &Streamer) const override;
+ MCSection *FindAssociatedSection() const override {
return getSubExpr()->FindAssociatedSection();
}
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp b/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
index d8660d3138e..4ea0e0d1199 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
@@ -81,7 +81,7 @@ IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM,
return false;
}
-const MCSection *
+MCSection *
HexagonTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h b/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h
index c9742042724..da0eeeb3fd2 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h
+++ b/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h
@@ -16,8 +16,9 @@
namespace llvm {
class HexagonTargetObjectFile : public TargetLoweringObjectFileELF {
- const MCSectionELF *SmallDataSection;
- const MCSectionELF *SmallBSSSection;
+ MCSectionELF *SmallDataSection;
+ MCSectionELF *SmallBSSSection;
+
public:
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
@@ -30,9 +31,9 @@ namespace llvm {
const TargetMachine &TM) const;
bool IsSmallDataEnabled () const;
- const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind, Mangler &Mang,
- const TargetMachine &TM) const override;
+ MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler &Mang,
+ const TargetMachine &TM) const override;
};
} // namespace llvm
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
index 6d1d9f4f223..d2b51831245 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
@@ -58,7 +58,7 @@ void MipsELFStreamer::EmitLabel(MCSymbol *Symbol) {
Labels.push_back(Symbol);
}
-void MipsELFStreamer::SwitchSection(const MCSection * Section,
+void MipsELFStreamer::SwitchSection(MCSection *Section,
const MCExpr *Subsection) {
MCELFStreamer::SwitchSection(Section, Subsection);
Labels.clear();
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
index 4e3090171e3..af9311fa428 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.h
@@ -55,7 +55,7 @@ public:
/// Overriding this function allows us to dismiss all labels that are
/// candidates for marking as microMIPS when .section directive is processed.
- void SwitchSection(const MCSection *Section,
+ void SwitchSection(MCSection *Section,
const MCExpr *Subsection = nullptr) override;
/// Overriding this function allows us to dismiss all labels that are
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
index 2b8f0c89a2e..ee11461ef17 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
@@ -51,7 +51,7 @@ public:
const MCAsmLayout *Layout,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
- const MCSection *FindAssociatedSection() const override {
+ MCSection *FindAssociatedSection() const override {
return getSubExpr()->FindAssociatedSection();
}
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
index 188e3e8e1db..272186240ba 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
@@ -28,7 +28,7 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
if (MTS->getABI().IsN64()) {
// The EntrySize value of 1 seems strange since the records are neither
// 1-byte long nor fixed length but it matches the value GAS emits.
- const MCSectionELF *Sec =
+ MCSectionELF *Sec =
Context.getELFSection(".MIPS.options", ELF::SHT_MIPS_OPTIONS,
ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1, "");
MCA.getOrCreateSectionData(*Sec).setAlignment(8);
@@ -46,8 +46,8 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
Streamer->EmitIntValue(ri_cprmask[3], 4);
Streamer->EmitIntValue(ri_gp_value, 8);
} else {
- const MCSectionELF *Sec = Context.getELFSection(
- ".reginfo", ELF::SHT_MIPS_REGINFO, ELF::SHF_ALLOC, 24, "");
+ MCSectionELF *Sec = Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO,
+ ELF::SHF_ALLOC, 24, "");
MCA.getOrCreateSectionData(*Sec)
.setAlignment(MTS->getABI().IsN32() ? 8 : 4);
Streamer->SwitchSection(Sec);
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
index 289959be47e..0bb04c58520 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -564,8 +564,8 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
MCContext &Context = MCA.getContext();
MCStreamer &OS = getStreamer();
- const MCSectionELF *Sec = Context.getELFSection(
- ".pdr", ELF::SHT_PROGBITS, ELF::SHF_ALLOC | ELF::SHT_REL);
+ MCSectionELF *Sec = Context.getELFSection(".pdr", ELF::SHT_PROGBITS,
+ ELF::SHF_ALLOC | ELF::SHT_REL);
const MCSymbolRefExpr *ExprRef =
MCSymbolRefExpr::Create(Name, MCSymbolRefExpr::VK_None, Context);
@@ -786,7 +786,7 @@ void MipsTargetELFStreamer::emitMipsAbiFlags() {
MCAssembler &MCA = getStreamer().getAssembler();
MCContext &Context = MCA.getContext();
MCStreamer &OS = getStreamer();
- const MCSectionELF *Sec = Context.getELFSection(
+ MCSectionELF *Sec = Context.getELFSection(
".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24, "");
MCSectionData &ABIShndxSD = MCA.getOrCreateSectionData(*Sec);
ABIShndxSD.setAlignment(8);
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index 7d5377aaf9d..ae33867f4d3 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -963,7 +963,7 @@ void MipsAsmPrinter::EmitFPCallStub(
//
// .section mips16.call.fpxxxx,"ax",@progbits
//
- const MCSectionELF *M = OutContext.getELFSection(
+ MCSectionELF *M = OutContext.getELFSection(
".mips16.call.fp." + std::string(Symbol), ELF::SHT_PROGBITS,
ELF::SHF_ALLOC | ELF::SHF_EXECINSTR);
OutStreamer->SwitchSection(M, nullptr);
diff --git a/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp b/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
index 723b63bb41c..0f2db6039b6 100644
--- a/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
+++ b/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
@@ -110,9 +110,10 @@ IsGlobalInSmallSectionImpl(const GlobalValue *GV,
return IsInSmallSection(TM.getDataLayout()->getTypeAllocSize(Ty));
}
-const MCSection *MipsTargetObjectFile::
-SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler &Mang, const TargetMachine &TM) const {
+MCSection *
+MipsTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
+ SectionKind Kind, Mangler &Mang,
+ const TargetMachine &TM) const {
// TODO: Could also support "weak" symbols as well with ".gnu.linkonce.s.*"
// sections?
@@ -136,8 +137,9 @@ IsConstantInSmallSection(const Constant *CN, const TargetMachine &TM) const {
CN->getType())));
}
-const MCSection *MipsTargetObjectFile::
-getSectionForConstant(SectionKind Kind, const Constant *C) const {
+MCSection *
+MipsTargetObjectFile::getSectionForConstant(SectionKind Kind,
+ const Constant *C) const {
if (IsConstantInSmallSection(C, *TM))
return SmallDataSection;
diff --git a/llvm/lib/Target/Mips/MipsTargetObjectFile.h b/llvm/lib/Target/Mips/MipsTargetObjectFile.h
index 45ed9d05f9c..725f2ffd93d 100644
--- a/llvm/lib/Target/Mips/MipsTargetObjectFile.h
+++ b/llvm/lib/Target/Mips/MipsTargetObjectFile.h
@@ -15,8 +15,8 @@
namespace llvm {
class MipsTargetMachine;
class MipsTargetObjectFile : public TargetLoweringObjectFileELF {
- const MCSection *SmallDataSection;
- const MCSection *SmallBSSSection;
+ MCSection *SmallDataSection;
+ MCSection *SmallBSSSection;
const MipsTargetMachine *TM;
public:
@@ -31,16 +31,16 @@ class MipsTargetMachine;
bool IsGlobalInSmallSectionImpl(const GlobalValue *GV,
const TargetMachine &TM) const;
- const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind, Mangler &Mang,
- const TargetMachine &TM) const override;
+ MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler &Mang,
+ const TargetMachine &TM) const override;
/// Return true if this constant should be placed into small data section.
bool IsConstantInSmallSection(const Constant *CN,
const TargetMachine &TM) const;
- const MCSection *getSectionForConstant(SectionKind Kind,
- const Constant *C) const override;
+ MCSection *getSectionForConstant(SectionKind Kind,
+ const Constant *C) const override;
};
} // end namespace llvm
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index 162dc55cd80..805847a581f 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -4520,7 +4520,7 @@ NVPTXTargetObjectFile::~NVPTXTargetObjectFile() {
delete DwarfRangesSection;
}
-const MCSection *
+MCSection *
NVPTXTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
diff --git a/llvm/lib/Target/NVPTX/NVPTXMCExpr.h b/llvm/lib/Target/NVPTX/NVPTXMCExpr.h
index fcec11165af..8c6b219abd1 100644
--- a/llvm/lib/Target/NVPTX/NVPTXMCExpr.h
+++ b/llvm/lib/Target/NVPTX/NVPTXMCExpr.h
@@ -68,9 +68,7 @@ public:
return false;
}
void visitUsedExpr(MCStreamer &Streamer) const override {};
- const MCSection *FindAssociatedSection() const override {
- return nullptr;
- }
+ MCSection *FindAssociatedSection() const override { return nullptr; }
// There are no TLS NVPTXMCExprs at the moment.
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
@@ -112,9 +110,7 @@ public:
return false;
}
void visitUsedExpr(MCStreamer &Streamer) const override {};
- const MCSection *FindAssociatedSection() const override {
- return nullptr;
- }
+ MCSection *FindAssociatedSection() const override { return nullptr; }
// There are no TLS NVPTXMCExprs at the moment.
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
diff --git a/llvm/lib/Target/NVPTX/NVPTXTargetObjectFile.h b/llvm/lib/Target/NVPTX/NVPTXTargetObjectFile.h
index 5d9ab0d511f..5ecdc874883 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetObjectFile.h
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetObjectFile.h
@@ -84,20 +84,20 @@ public:
new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
}
- const MCSection *getSectionForConstant(SectionKind Kind,
- const Constant *C) const override {
+ MCSection *getSectionForConstant(SectionKind Kind,
+ const Constant *C) const override {
return ReadOnlySection;
}
- const MCSection *getExplicitSectionGlobal(const GlobalValue *GV,
- SectionKind Kind, Mangler &Mang,
- const TargetMachine &TM) const override {
+ MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler &Mang,
+ const TargetMachine &TM) const override {
return DataSection;
}
- const MCSection *
- SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
- const TargetMachine &TM) const override;
+ MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler &Mang,
+ const TargetMachine &TM) const override;
};
} // end namespace llvm
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
index 1c840d998e0..ca72ccf0f76 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
@@ -82,7 +82,7 @@ public:
const MCAsmLayout *Layout,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
- const MCSection *FindAssociatedSection() const override {
+ MCSection *FindAssociatedSection() const override {
return getSubExpr()->FindAssociatedSection();
}
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 4fd96145fb2..4f1c3c73e71 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1054,7 +1054,7 @@ void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
// Emit an official procedure descriptor.
MCSectionSubPair Current = OutStreamer->getCurrentSection();
- const MCSectionELF *Section = OutStreamer->getContext().getELFSection(
+ MCSectionELF *Section = OutStreamer->getContext().getELFSection(
".opd", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
OutStreamer->SwitchSection(Section);
OutStreamer->EmitLabel(CurrentFnSym);
@@ -1084,8 +1084,8 @@ bool PPCLinuxAsmPrinter::doFinalization(Module &M) {
static_cast<PPCTargetStreamer &>(*OutStreamer->getTargetStreamer());
if (!TOC.empty()) {
- const MCSectionELF *Section;
-
+ MCSectionELF *Section;
+
if (isPPC64)
Section = OutStreamer->getContext().getELFSection(
".toc", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
@@ -1285,15 +1285,14 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
static_cast<const TargetLoweringObjectFileMachO &>(getObjFileLowering());
// .lazy_symbol_pointer
- const MCSection *LSPSection = TLOFMacho.getLazySymbolPointerSection();
-
+ MCSection *LSPSection = TLOFMacho.getLazySymbolPointerSection();
+
// Output stubs for dynamically-linked functions
if (TM.getRelocationModel() == Reloc::PIC_) {
- const MCSection *StubSection =
- OutContext.getMachOSection("__TEXT", "__picsymbolstub1",
- MachO::S_SYMBOL_STUBS |
- MachO::S_ATTR_PURE_INSTRUCTIONS,
- 32, SectionKind::getText());
+ MCSection *StubSection = OutContext.getMachOSection(
+ "__TEXT", "__picsymbolstub1",
+ MachO::S_SYMBOL_STUBS | MachO::S_ATTR_PURE_INSTRUCTIONS, 32,
+ SectionKind::getText());
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
OutStreamer->SwitchSection(StubSection);
EmitAlignment(4);
@@ -1356,12 +1355,11 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
OutStreamer->AddBlankLine();
return;
}
-
- const MCSection *StubSection =
- OutContext.getMachOSection("__TEXT","__symbol_stub1",
- MachO::S_SYMBOL_STUBS |
- MachO::S_ATTR_PURE_INSTRUCTIONS,
- 16, SectionKind::getText());
+
+ MCSection *StubSection = OutContext.getMachOSection(
+ "__TEXT", "__symbol_stub1",
+ MachO::S_SYMBOL_STUBS | MachO::S_ATTR_PURE_INSTRUCTIONS, 16,
+ SectionKind::getText());
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
MCSymbol *Stub = Stubs[i].first;
MCSymbol *RawSym = Stubs[i].second.getPointer();
diff --git a/llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp b/llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp
index 2903cc192aa..9ad13407008 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp
@@ -22,7 +22,7 @@ Initialize(MCContext &Ctx, const TargetMachine &TM) {
InitializeELF(TM.Options.UseInitArray);
}
-const MCSection *PPC64LinuxTargetObjectFile::SelectSectionForGlobal(
+MCSection *PPC64LinuxTargetObjectFile::SelectSectionForGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
// Here override ReadOnlySection to DataRelROSection for PPC64 SVR4 ABI
diff --git a/llvm/lib/Target/PowerPC/PPCTargetObjectFile.h b/llvm/lib/Target/PowerPC/PPCTargetObjectFile.h
index cd84da22275..d248791f2ca 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetObjectFile.h
+++ b/llvm/lib/Target/PowerPC/PPCTargetObjectFile.h
@@ -22,9 +22,9 @@ namespace llvm {
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
- const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
- SectionKind Kind, Mangler &Mang,
- const TargetMachine &TM) const override;
+ MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler &Mang,
+ const TargetMachine &TM) const override;
/// \brief Describe a TLS variable address within debug info.
const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
diff --git a/llvm/lib/Target/R600/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/R600/AMDGPUAsmPrinter.cpp
index 9f09b42d11f..56b50a9c159 100644
--- a/llvm/lib/Target/R600/AMDGPUAsmPrinter.cpp
+++ b/llvm/lib/Target/R600/AMDGPUAsmPrinter.cpp
@@ -107,7 +107,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
SetupMachineFunction(MF);
MCContext &Context = getObjFileLowering().getContext();
- const MCSectionELF *ConfigSection =
+ MCSectionELF *ConfigSection =
Context.getELFSection(".AMDGPU.config", ELF::SHT_PROGBITS, 0);
OutStreamer->SwitchSection(ConfigSection);
@@ -131,7 +131,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
EmitFunctionBody();
if (isVerbose()) {
- const MCSectionELF *CommentSection =
+ MCSectionELF *CommentSection =
Context.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
OutStreamer->SwitchSection(CommentSection);
@@ -509,7 +509,7 @@ void AMDGPUAsmPrinter::EmitAmdKernelCodeT(const MachineFunction &MF,
header.wavefront_size = STM.getWavefrontSize();
- const MCSectionELF *VersionSection =
+ MCSectionELF *VersionSection =
OutContext.getELFSection(".hsa.version", ELF::SHT_PROGBITS, 0);
OutStreamer->SwitchSection(VersionSection);
OutStreamer->EmitBytes(Twine("HSA Code Unit:" +
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
index 3a6f508da72..116e10406a7 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
@@ -90,7 +90,7 @@ public:
const MCAsmLayout *Layout,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
- const MCSection *FindAssociatedSection() const override {
+ MCSection *FindAssociatedSection() const override {
return getSubExpr()->FindAssociatedSection();
}
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index 1b02a1c60bb..a184b92d3c9 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -255,12 +255,13 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV,
llvm_unreachable("Invalid relocation");
}
-/// SectionForGlobal - This method computes the appropriate section to emit
-/// the specified global variable or function definition. This should not
-/// be passed external (or available externally) globals.
-const MCSection *TargetLoweringObjectFile::
-SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
- const TargetMachine &TM) const {
+/// This method computes the appropriate section to emit the specified global
+/// variable or function definition. This should not be passed external (or
+/// available externally) globals.
+MCSection *
+TargetLoweringObjectFile::SectionForGlobal(const GlobalValue *GV,
+ SectionKind Kind, Mangler &Mang,
+ const TargetMachine &TM) const {
// Select section name.
if (GV->hasSection())
return getExplicitSectionGlobal(GV, Kind, Mang, TM);
@@ -270,7 +271,7 @@ SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
return SelectSectionForGlobal(GV, Kind, Mang, TM);
}
-const MCSection *TargetLoweringObjectFile::getSectionForJumpTable(
+MCSection *TargetLoweringObjectFile::getSectionForJumpTable(
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
return getSectionForConstant(SectionKind::getReadOnly(), /*C=*/nullptr);
}
@@ -293,10 +294,9 @@ bool TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection(
return false;
}
-/// getSectionForConstant - Given a mergable constant with the
-/// specified size and relocation information, return a section that it
-/// should be placed in.
-const MCSection *
+/// Given a mergable constant with the specified size and relocation
+/// information, return a section that it should be placed in.
+MCSection *
TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind,
const Constant *C) const {
if (Kind.isReadOnly() && ReadOnlySection != nullptr)
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index c7ac0bd7721..f97557e5c60 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -615,12 +615,11 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
Stubs = MMIMacho.GetFnStubList();
if (!Stubs.empty()) {
- const MCSection *TheSection =
- OutContext.getMachOSection("__IMPORT", "__jump_table",
- MachO::S_SYMBOL_STUBS |
- MachO::S_ATTR_SELF_MODIFYING_CODE |
- MachO::S_ATTR_PURE_INSTRUCTIONS,
- 5, SectionKind::getMetadata());
+ MCSection *TheSection = OutContext.getMachOSection(
+ "__IMPORT", "__jump_table",
+ MachO::S_SYMBOL_STUBS | MachO::S_ATTR_SELF_MODIFYING_CODE |
+ MachO::S_ATTR_PURE_INSTRUCTIONS,
+ 5, SectionKind::getMetadata());
OutStreamer->SwitchSection(TheSection);
for (const auto &Stub : Stubs) {
@@ -641,10 +640,9 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
// Output stubs for external and common global variables.
Stubs = MMIMacho.GetGVStubList();
if (!Stubs.empty()) {
- const MCSection *TheSection =
- OutContext.getMachOSection("__IMPORT", "__pointers",
- MachO::S_NON_LAZY_SYMBOL_POINTERS,
- SectionKind::getMetadata());
+ MCSection *TheSection = OutContext.getMachOSection(
+ "__IMPORT", "__pointers", MachO::S_NON_LAZY_SYMBOL_POINTERS,
+ SectionKind::getMetadata());
OutStreamer->SwitchSection(TheSection);
for (auto &Stub : Stubs)
@@ -656,10 +654,9 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
Stubs = MMIMacho.GetHiddenGVStubList();
if (!Stubs.empty()) {
- const MCSection *TheSection =
- OutContext.getMachOSection("__IMPORT", "__pointers",
- MachO::S_NON_LAZY_SYMBOL_POINTERS,
- SectionKind::getMetadata());
+ MCSection *TheSection = OutContext.getMachOSection(
+ "__IMPORT", "__pointers", MachO::S_NON_LAZY_SYMBOL_POINTERS,
+ SectionKind::getMetadata());
OutStreamer->SwitchSection(TheSection);
for (auto &Stub : Stubs)
diff --git a/llvm/lib/Target/X86/X86TargetObjectFile.cpp b/llvm/lib/Target/X86/X86TargetObjectFile.cpp
index d65d3b0cbf7..6bf45c37e38 100644
--- a/llvm/lib/Target/X86/X86TargetObjectFile.cpp
+++ b/llvm/lib/Target/X86/X86TargetObjectFile.cpp
@@ -149,7 +149,7 @@ static std::string scalarConstantToHexString(const Constant *C) {
return APIntToHexString(AI);
}
-const MCSection *
+MCSection *
X86WindowsTargetObjectFile::getSectionForConstant(SectionKind Kind,
const Constant *C) const {
if (Kind.isReadOnly()) {
diff --git a/llvm/lib/Target/X86/X86TargetObjectFile.h b/llvm/lib/Target/X86/X86TargetObjectFile.h
index 2e25fb2b849..66366b2373c 100644
--- a/llvm/lib/Target/X86/X86TargetObjectFile.h
+++ b/llvm/lib/Target/X86/X86TargetObjectFile.h
@@ -58,8 +58,8 @@ namespace llvm {
/// \brief Given a mergeable constant with the specified size and relocation
/// information, return a section that it should be placed in.
- const MCSection *getSectionForConstant(SectionKind Kind,
- const Constant *C) const override;
+ MCSection *getSectionForConstant(SectionKind Kind,
+ const Constant *C) const override;
};
} // end namespace llvm
diff --git a/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp b/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp
index c435b36fae1..b5a99058f46 100644
--- a/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp
+++ b/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp
@@ -95,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 {
@@ -108,9 +108,10 @@ XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV,
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());
@@ -141,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;
diff --git a/llvm/lib/Target/XCore/XCoreTargetObjectFile.h b/llvm/lib/Target/XCore/XCoreTargetObjectFile.h
index 7d3f49d222d..2a5ac238a44 100644
--- a/llvm/lib/Target/XCore/XCoreTargetObjectFile.h
+++ b/llvm/lib/Target/XCore/XCoreTargetObjectFile.h
@@ -17,25 +17,24 @@ namespace llvm {
static const unsigned CodeModelLargeSize = 256;
class XCoreTargetObjectFile : public TargetLoweringObjectFileELF {
- const MCSection *BSSSectionLarge;
- const MCSection *DataSectionLarge;
- const MCSection *ReadOnlySectionLarge;
- const MCSection *DataRelROSectionLarge;
+ MCSection *BSSSectionLarge;
+ MCSection *DataSectionLarge;
+ MCSection *ReadOnlySectionLarge;
+ MCSection *DataRelROSectionLarge;
+
public:
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
- const MCSection *
- getExplicitSectionGlobal(const GlobalValue *GV,
- SectionKind Kind, Mangler &Mang,
- const TargetMachine &TM) const override;
+ MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler &Mang,
+ const TargetMachine &TM) const override;
- const MCSection *
- SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
- Mangler &Mang,
- const TargetMachine &TM) const override;
+ MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+ Mangler &Mang,
+ const TargetMachine &TM) const override;
- const MCSection *getSectionForConstant(SectionKind Kind,
- const Constant *C) const override;
+ MCSection *getSectionForConstant(SectionKind Kind,
+ const Constant *C) const override;
};
} // end namespace llvm
OpenPOWER on IntegriCloud