#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/TargetAsmInfo.h"
+#include "llvm/MC/MCAsmInfo.h"
using namespace llvm;
MCSectionELF *MCSectionELF::
-Create(const StringRef &Section, unsigned Type, unsigned Flags,
+Create(StringRef Section, unsigned Type, unsigned Flags,
SectionKind K, bool isExplicit, MCContext &Ctx) {
- return new
- (Ctx) MCSectionELF(Section, Type, Flags, K, isExplicit);
+ return new (Ctx) MCSectionELF(Section, Type, Flags, K, isExplicit);
}
// ShouldOmitSectionDirective - Decides whether a '.section' directive
// should be printed before the section name
bool MCSectionELF::ShouldOmitSectionDirective(const char *Name,
- const TargetAsmInfo &TAI) const {
+ const MCAsmInfo &MAI) const {
// FIXME: Does .section .bss/.data/.text work everywhere??
if (strcmp(Name, ".text") == 0 ||
strcmp(Name, ".data") == 0 ||
(strcmp(Name, ".bss") == 0 &&
- !TAI.usesELFSectionDirectiveForBSS()))
+ !MAI.usesELFSectionDirectiveForBSS()))
return true;
return false;
return true;
}
-void MCSectionELF::PrintSwitchToSection(const TargetAsmInfo &TAI,
+void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const {
- if (ShouldOmitSectionDirective(SectionName.c_str(), TAI)) {
+ if (ShouldOmitSectionDirective(SectionName.c_str(), MAI)) {
OS << '\t' << getSectionName() << '\n';
return;
}
OS << "\t.section\t" << getSectionName();
// Handle the weird solaris syntax if desired.
- if (TAI.usesSunStyleELFSectionSwitchSyntax() &&
+ if (MAI.usesSunStyleELFSectionSwitchSyntax() &&
!(Flags & MCSectionELF::SHF_MERGE)) {
if (Flags & MCSectionELF::SHF_ALLOC)
OS << ",#alloc";
OS << ",#tls";
} else {
OS << ",\"";
-
if (Flags & MCSectionELF::SHF_ALLOC)
OS << 'a';
if (Flags & MCSectionELF::SHF_EXECINSTR)
OS << 'S';
if (Flags & MCSectionELF::SHF_TLS)
OS << 'T';
-
+
+ // If there are target-specific flags, print them.
+ if (Flags & ~MCSectionELF::TARGET_INDEP_SHF)
+ PrintTargetSpecificSectionFlags(MAI, OS);
+
OS << '"';
if (ShouldPrintSectionType(Type)) {
OS << ',';
// If comment string is '@', e.g. as on ARM - use '%' instead
- if (TAI.getCommentString()[0] == '@')
+ if (MAI.getCommentString()[0] == '@')
OS << '%';
else
OS << '@';