summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/MC/MCSection.h4
-rw-r--r--llvm/include/llvm/MC/MCSectionCOFF.h3
-rw-r--r--llvm/include/llvm/MC/MCSectionELF.h3
-rw-r--r--llvm/include/llvm/MC/MCSectionMachO.h3
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp4
-rw-r--r--llvm/lib/MC/MCSectionCOFF.cpp2
-rw-r--r--llvm/lib/MC/MCSectionELF.cpp19
-rw-r--r--llvm/lib/MC/MCSectionMachO.cpp2
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXSection.h2
9 files changed, 27 insertions, 15 deletions
diff --git a/llvm/include/llvm/MC/MCSection.h b/llvm/include/llvm/MC/MCSection.h
index d4c31696b40..68d4a7f5509 100644
--- a/llvm/include/llvm/MC/MCSection.h
+++ b/llvm/include/llvm/MC/MCSection.h
@@ -29,6 +29,7 @@ class MCExpr;
class MCFragment;
class MCSection;
class MCSymbol;
+class Triple;
class raw_ostream;
template <> struct ilist_alloc_traits<MCFragment> {
@@ -169,7 +170,8 @@ public:
void dump();
- virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
+ virtual void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
+ raw_ostream &OS,
const MCExpr *Subsection) const = 0;
/// Return true if a .align directive should use "optimized nops" to fill
diff --git a/llvm/include/llvm/MC/MCSectionCOFF.h b/llvm/include/llvm/MC/MCSectionCOFF.h
index 7d5f9f7f3cd..914008d4c3d 100644
--- a/llvm/include/llvm/MC/MCSectionCOFF.h
+++ b/llvm/include/llvm/MC/MCSectionCOFF.h
@@ -73,7 +73,8 @@ public:
void setSelection(int Selection) const;
- void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
+ void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
+ raw_ostream &OS,
const MCExpr *Subsection) const override;
bool UseCodeAlign() const override;
bool isVirtualSection() const override;
diff --git a/llvm/include/llvm/MC/MCSectionELF.h b/llvm/include/llvm/MC/MCSectionELF.h
index dabd787b0d4..e296de60c77 100644
--- a/llvm/include/llvm/MC/MCSectionELF.h
+++ b/llvm/include/llvm/MC/MCSectionELF.h
@@ -78,7 +78,8 @@ public:
void setFlags(unsigned F) { Flags = F; }
const MCSymbolELF *getGroup() const { return Group; }
- void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
+ void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
+ raw_ostream &OS,
const MCExpr *Subsection) const override;
bool UseCodeAlign() const override;
bool isVirtualSection() const override;
diff --git a/llvm/include/llvm/MC/MCSectionMachO.h b/llvm/include/llvm/MC/MCSectionMachO.h
index 658dfcda726..3bc5408a4f7 100644
--- a/llvm/include/llvm/MC/MCSectionMachO.h
+++ b/llvm/include/llvm/MC/MCSectionMachO.h
@@ -76,7 +76,8 @@ public:
bool &TAAParsed, // Out.
unsigned &StubSize); // Out.
- void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
+ void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
+ raw_ostream &OS,
const MCExpr *Subsection) const override;
bool UseCodeAlign() const override;
bool isVirtualSection() const override;
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 817009a6536..2eae26bdc0c 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -392,7 +392,9 @@ void MCAsmStreamer::emitExplicitComments() {
void MCAsmStreamer::ChangeSection(MCSection *Section,
const MCExpr *Subsection) {
assert(Section && "Cannot switch to a null section!");
- Section->PrintSwitchToSection(*MAI, OS, Subsection);
+ Section->PrintSwitchToSection(
+ *MAI, getContext().getObjectFileInfo()->getTargetTriple(), OS,
+ Subsection);
}
void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) {
diff --git a/llvm/lib/MC/MCSectionCOFF.cpp b/llvm/lib/MC/MCSectionCOFF.cpp
index f2dd47d81b7..4e2df01c89c 100644
--- a/llvm/lib/MC/MCSectionCOFF.cpp
+++ b/llvm/lib/MC/MCSectionCOFF.cpp
@@ -37,7 +37,7 @@ void MCSectionCOFF::setSelection(int Selection) const {
Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
}
-void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI,
+void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const {
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 587b28f71b7..422652e5ef5 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -53,7 +53,7 @@ static void printName(raw_ostream &OS, StringRef Name) {
OS << '"';
}
-void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
+void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const {
@@ -106,12 +106,17 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
OS << 'T';
// If there are target-specific flags, print them.
- if (Flags & ELF::XCORE_SHF_CP_SECTION)
- OS << 'c';
- if (Flags & ELF::XCORE_SHF_DP_SECTION)
- OS << 'd';
- if (Flags & ELF::SHF_ARM_PURECODE)
- OS << 'y';
+ Triple::ArchType Arch = T.getArch();
+ if (Arch == Triple::xcore) {
+ if (Flags & ELF::XCORE_SHF_CP_SECTION)
+ OS << 'c';
+ if (Flags & ELF::XCORE_SHF_DP_SECTION)
+ OS << 'd';
+ } else if (Arch == Triple::arm || Arch == Triple::armeb ||
+ Arch == Triple::thumb || Arch == Triple::thumbeb) {
+ if (Flags & ELF::SHF_ARM_PURECODE)
+ OS << 'y';
+ }
OS << '"';
diff --git a/llvm/lib/MC/MCSectionMachO.cpp b/llvm/lib/MC/MCSectionMachO.cpp
index c2a772fdbda..974de0fc1f2 100644
--- a/llvm/lib/MC/MCSectionMachO.cpp
+++ b/llvm/lib/MC/MCSectionMachO.cpp
@@ -89,7 +89,7 @@ MCSectionMachO::MCSectionMachO(StringRef Segment, StringRef Section,
}
}
-void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI,
+void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const {
OS << "\t.section\t" << getSegmentName() << ',' << getSectionName();
diff --git a/llvm/lib/Target/NVPTX/NVPTXSection.h b/llvm/lib/Target/NVPTX/NVPTXSection.h
index b0472de980f..d736eaa4130 100644
--- a/llvm/lib/Target/NVPTX/NVPTXSection.h
+++ b/llvm/lib/Target/NVPTX/NVPTXSection.h
@@ -31,7 +31,7 @@ public:
/// Override this as NVPTX has its own way of printing switching
/// to a section.
- void PrintSwitchToSection(const MCAsmInfo &MAI,
+ void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const override {}
OpenPOWER on IntegriCloud