summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp69
-rw-r--r--llvm/lib/MC/MCParser/COFFAsmParser.cpp11
-rw-r--r--llvm/lib/MC/MCParser/DarwinAsmParser.cpp10
-rw-r--r--llvm/lib/MC/MCParser/ELFAsmParser.cpp14
-rw-r--r--llvm/lib/MC/MCWinEH.cpp8
5 files changed, 48 insertions, 64 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 943eaef0386..8b75457a246 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -76,16 +76,15 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(Triple T) {
MachO::S_ATTR_PURE_INSTRUCTIONS,
SectionKind::getText());
DataSection // .data
- = Ctx->getMachOSection("__DATA", "__data", 0,
- SectionKind::getDataRel());
+ = Ctx->getMachOSection("__DATA", "__data", 0, SectionKind::getData());
// BSSSection might not be expected initialized on msvc.
BSSSection = nullptr;
TLSDataSection // .tdata
- = Ctx->getMachOSection("__DATA", "__thread_data",
- MachO::S_THREAD_LOCAL_REGULAR,
- SectionKind::getDataRel());
+ = Ctx->getMachOSection("__DATA", "__thread_data",
+ MachO::S_THREAD_LOCAL_REGULAR,
+ SectionKind::getData());
TLSBSSSection // .tbss
= Ctx->getMachOSection("__DATA", "__thread_bss",
MachO::S_THREAD_LOCAL_ZEROFILL,
@@ -93,14 +92,13 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(Triple T) {
// TODO: Verify datarel below.
TLSTLVSection // .tlv
- = Ctx->getMachOSection("__DATA", "__thread_vars",
- MachO::S_THREAD_LOCAL_VARIABLES,
- SectionKind::getDataRel());
+ = Ctx->getMachOSection("__DATA", "__thread_vars",
+ MachO::S_THREAD_LOCAL_VARIABLES,
+ SectionKind::getData());
- TLSThreadInitSection
- = Ctx->getMachOSection("__DATA", "__thread_init",
- MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
- SectionKind::getDataRel());
+ TLSThreadInitSection = Ctx->getMachOSection(
+ "__DATA", "__thread_init", MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
+ SectionKind::getData());
CStringSection // .cstring
= Ctx->getMachOSection("__TEXT", "__cstring",
@@ -145,10 +143,8 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(Triple T) {
= Ctx->getMachOSection("__TEXT", "__const_coal",
MachO::S_COALESCED,
SectionKind::getReadOnly());
- DataCoalSection
- = Ctx->getMachOSection("__DATA","__datacoal_nt",
- MachO::S_COALESCED,
- SectionKind::getDataRel());
+ DataCoalSection = Ctx->getMachOSection(
+ "__DATA", "__datacoal_nt", MachO::S_COALESCED, SectionKind::getData());
} else {
TextCoalSection = TextSection;
ConstTextCoalSection = ReadOnlySection;
@@ -177,21 +173,17 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(Triple T) {
SectionKind::getMetadata());
if (RelocM == Reloc::Static) {
- StaticCtorSection
- = Ctx->getMachOSection("__TEXT", "__constructor", 0,
- SectionKind::getDataRel());
- StaticDtorSection
- = Ctx->getMachOSection("__TEXT", "__destructor", 0,
- SectionKind::getDataRel());
+ StaticCtorSection = Ctx->getMachOSection("__TEXT", "__constructor", 0,
+ SectionKind::getData());
+ StaticDtorSection = Ctx->getMachOSection("__TEXT", "__destructor", 0,
+ SectionKind::getData());
} else {
- StaticCtorSection
- = Ctx->getMachOSection("__DATA", "__mod_init_func",
- MachO::S_MOD_INIT_FUNC_POINTERS,
- SectionKind::getDataRel());
- StaticDtorSection
- = Ctx->getMachOSection("__DATA", "__mod_term_func",
- MachO::S_MOD_TERM_FUNC_POINTERS,
- SectionKind::getDataRel());
+ StaticCtorSection = Ctx->getMachOSection("__DATA", "__mod_init_func",
+ MachO::S_MOD_INIT_FUNC_POINTERS,
+ SectionKind::getData());
+ StaticDtorSection = Ctx->getMachOSection("__DATA", "__mod_term_func",
+ MachO::S_MOD_TERM_FUNC_POINTERS,
+ SectionKind::getData());
}
// Exception Handling.
@@ -452,9 +444,6 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(Triple T) {
TLSBSSSection = Ctx->getELFSection(
".tbss", ELF::SHT_NOBITS, ELF::SHF_ALLOC | ELF::SHF_TLS | ELF::SHF_WRITE);
- DataRelSection = Ctx->getELFSection(".data.rel", ELF::SHT_PROGBITS,
- ELF::SHF_ALLOC | ELF::SHF_WRITE);
-
DataRelROSection = Ctx->getELFSection(".data.rel.ro", ELF::SHT_PROGBITS,
ELF::SHF_ALLOC | ELF::SHF_WRITE);
@@ -556,7 +545,7 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) {
EHFrameSection = Ctx->getCOFFSection(
".eh_frame", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getDataRel());
+ SectionKind::getData());
bool IsWoA = T.getArch() == Triple::arm || T.getArch() == Triple::thumb;
@@ -576,7 +565,7 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) {
DataSection = Ctx->getCOFFSection(
".data", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ |
COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getDataRel());
+ SectionKind::getData());
ReadOnlySection = Ctx->getCOFFSection(
".rdata", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ,
SectionKind::getReadOnly());
@@ -594,11 +583,11 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) {
StaticCtorSection = Ctx->getCOFFSection(
".ctors", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getDataRel());
+ SectionKind::getData());
StaticDtorSection = Ctx->getCOFFSection(
".dtors", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getDataRel());
+ SectionKind::getData());
}
// FIXME: We're emitting LSDA info into a readonly section on COFF, even
@@ -751,11 +740,11 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) {
PDataSection = Ctx->getCOFFSection(
".pdata", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ,
- SectionKind::getDataRel());
+ SectionKind::getData());
XDataSection = Ctx->getCOFFSection(
".xdata", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ,
- SectionKind::getDataRel());
+ SectionKind::getData());
SXDataSection = Ctx->getCOFFSection(".sxdata", COFF::IMAGE_SCN_LNK_INFO,
SectionKind::getMetadata());
@@ -763,7 +752,7 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) {
TLSDataSection = Ctx->getCOFFSection(
".tls$", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ |
COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getDataRel());
+ SectionKind::getData());
StackMapSection = Ctx->getCOFFSection(".llvm_stackmaps",
COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
diff --git a/llvm/lib/MC/MCParser/COFFAsmParser.cpp b/llvm/lib/MC/MCParser/COFFAsmParser.cpp
index f09bce005d6..a4b2b195f71 100644
--- a/llvm/lib/MC/MCParser/COFFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/COFFAsmParser.cpp
@@ -98,11 +98,10 @@ class COFFAsmParser : public MCAsmParserExtension {
SectionKind::getText());
}
bool ParseSectionDirectiveData(StringRef, SMLoc) {
- return ParseSectionSwitch(".data",
- COFF::IMAGE_SCN_CNT_INITIALIZED_DATA
- | COFF::IMAGE_SCN_MEM_READ
- | COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getDataRel());
+ return ParseSectionSwitch(".data", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ |
+ COFF::IMAGE_SCN_MEM_WRITE,
+ SectionKind::getData());
}
bool ParseSectionDirectiveBSS(StringRef, SMLoc) {
return ParseSectionSwitch(".bss",
@@ -153,7 +152,7 @@ static SectionKind computeSectionKind(unsigned Flags) {
if (Flags & COFF::IMAGE_SCN_MEM_READ &&
(Flags & COFF::IMAGE_SCN_MEM_WRITE) == 0)
return SectionKind::getReadOnly();
- return SectionKind::getDataRel();
+ return SectionKind::getData();
}
bool COFFAsmParser::ParseSectionFlags(StringRef FlagsString, unsigned* Flags) {
diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
index 582d43623e8..b3bb3cc4e16 100644
--- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -390,9 +390,8 @@ bool DarwinAsmParser::parseSectionSwitch(const char *Segment,
// FIXME: Arch specific.
bool isText = TAA & MachO::S_ATTR_PURE_INSTRUCTIONS;
getStreamer().SwitchSection(getContext().getMachOSection(
- Segment, Section, TAA, StubSize,
- isText ? SectionKind::getText()
- : SectionKind::getDataRel()));
+ Segment, Section, TAA, StubSize,
+ isText ? SectionKind::getText() : SectionKind::getData()));
// Set the implicit alignment, if any.
//
@@ -614,9 +613,8 @@ bool DarwinAsmParser::parseDirectiveSection(StringRef, SMLoc) {
// FIXME: Arch specific.
bool isText = Segment == "__TEXT"; // FIXME: Hack.
getStreamer().SwitchSection(getContext().getMachOSection(
- Segment, Section, TAA, StubSize,
- isText ? SectionKind::getText()
- : SectionKind::getDataRel()));
+ Segment, Section, TAA, StubSize,
+ isText ? SectionKind::getText() : SectionKind::getData()));
return false;
}
diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
index e00a1afc0e4..6cbcdec5e27 100644
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -79,8 +79,8 @@ public:
// the best way for us to get access to it?
bool ParseSectionDirectiveData(StringRef, SMLoc) {
return ParseSectionSwitch(".data", ELF::SHT_PROGBITS,
- ELF::SHF_WRITE |ELF::SHF_ALLOC,
- SectionKind::getDataRel());
+ ELF::SHF_WRITE | ELF::SHF_ALLOC,
+ SectionKind::getData());
}
bool ParseSectionDirectiveText(StringRef, SMLoc) {
return ParseSectionSwitch(".text", ELF::SHT_PROGBITS,
@@ -111,9 +111,8 @@ public:
}
bool ParseSectionDirectiveDataRel(StringRef, SMLoc) {
return ParseSectionSwitch(".data.rel", ELF::SHT_PROGBITS,
- ELF::SHF_ALLOC |
- ELF::SHF_WRITE,
- SectionKind::getDataRel());
+ ELF::SHF_ALLOC | ELF::SHF_WRITE,
+ SectionKind::getData());
}
bool ParseSectionDirectiveDataRelRo(StringRef, SMLoc) {
return ParseSectionSwitch(".data.rel.ro", ELF::SHT_PROGBITS,
@@ -123,9 +122,8 @@ public:
}
bool ParseSectionDirectiveEhFrame(StringRef, SMLoc) {
return ParseSectionSwitch(".eh_frame", ELF::SHT_PROGBITS,
- ELF::SHF_ALLOC |
- ELF::SHF_WRITE,
- SectionKind::getDataRel());
+ ELF::SHF_ALLOC | ELF::SHF_WRITE,
+ SectionKind::getData());
}
bool ParseDirectivePushSection(StringRef, SMLoc);
bool ParseDirectivePopSection(StringRef, SMLoc);
diff --git a/llvm/lib/MC/MCWinEH.cpp b/llvm/lib/MC/MCWinEH.cpp
index d5d9eadf39a..83af203c7ac 100644
--- a/llvm/lib/MC/MCWinEH.cpp
+++ b/llvm/lib/MC/MCWinEH.cpp
@@ -49,10 +49,10 @@ static MCSection *getUnwindInfoSection(StringRef SecName,
if (CodeSecName.startswith(".text$"))
CodeSecName = CodeSecName.substr(6);
- return Context.getCOFFSection(
- (SecName + Twine('$') + CodeSecName).str(),
- COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ,
- SectionKind::getDataRel());
+ return Context.getCOFFSection((SecName + Twine('$') + CodeSecName).str(),
+ COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ,
+ SectionKind::getData());
}
}
OpenPOWER on IntegriCloud