SmallPtrSet<MCSymbol *, 16> BindingExplicitlySet;
-
- void SetSection(StringRef Section, unsigned Type, unsigned Flags,
- SectionKind Kind);
void SetSectionData();
void SetSectionText();
void SetSectionBss();
*MAB, Out, MCE,
hasMCRelaxAll(),
hasMCNoExecStack()));
- AsmStreamer.get()->InitSections();
// Create the AsmPrinter, which takes ownership of AsmStreamer if successful.
FunctionPass *Printer = getTarget().createAsmPrinter(*this, *AsmStreamer);
#include "llvm/MC/MCELFSymbolFlags.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSectionELF.h"
using namespace llvm;
-
-inline void MCELFStreamer::SetSection(StringRef Section, unsigned Type,
- unsigned Flags, SectionKind Kind) {
- SwitchSection(getContext().getELFSection(Section, Type, Flags, Kind));
-}
-
inline void MCELFStreamer::SetSectionData() {
- SetSection(".data",
- ELF::SHT_PROGBITS,
- ELF::SHF_WRITE | ELF::SHF_ALLOC,
- SectionKind::getDataRel());
+ SwitchSection(getContext().getObjectFileInfo()->getDataSection());
EmitCodeAlignment(4, 0);
}
inline void MCELFStreamer::SetSectionText() {
- SetSection(".text",
- ELF::SHT_PROGBITS,
- ELF::SHF_EXECINSTR | ELF::SHF_ALLOC,
- SectionKind::getText());
+ SwitchSection(getContext().getObjectFileInfo()->getTextSection());
EmitCodeAlignment(4, 0);
}
inline void MCELFStreamer::SetSectionBss() {
- SetSection(".bss",
- ELF::SHT_NOBITS,
- ELF::SHF_WRITE | ELF::SHF_ALLOC,
- SectionKind::getBSS());
+ SwitchSection(getContext().getObjectFileInfo()->getBSSSection());
EmitCodeAlignment(4, 0);
}
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCMachOSymbolFlags.h"
+#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSectionMachO.h"
}
void MCMachOStreamer::InitToTextSection() {
- SwitchSection(getContext().getMachOSection(
- "__TEXT", "__text",
- MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, 0,
- SectionKind::getText()));
+ SwitchSection(getContext().getObjectFileInfo()->getTextSection());
}
void MCMachOStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
// '.lcomm' is equivalent to '.zerofill'.
- return EmitZerofill(getContext().getMachOSection("__DATA", "__bss",
- MCSectionMachO::S_ZEROFILL,
- 0, SectionKind::getBSS()),
+ return EmitZerofill(getContext().getObjectFileInfo()->getDataBSSSection(),
Symbol, Size, ByteAlignment);
}
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSectionCOFF.h"
DF->getContents().append(Code.begin(), Code.end());
}
- const MCSectionCOFF *getSectionText() {
- return getContext().getCOFFSection(
- ".text", COFF::IMAGE_SCN_CNT_CODE | COFF::IMAGE_SCN_MEM_EXECUTE |
- COFF::IMAGE_SCN_MEM_READ,
- SectionKind::getText());
+ const MCSection *getSectionText() {
+ return getContext().getObjectFileInfo()->getTextSection();
}
- const MCSectionCOFF *getSectionData() {
- return getContext().getCOFFSection(
- ".data", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
- COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getDataRel());
+ const MCSection *getSectionData() {
+ return getContext().getObjectFileInfo()->getDataSection();
}
- const MCSectionCOFF *getSectionBSS() {
- return getContext().getCOFFSection(
- ".bss", COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
- COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getBSS());
+ const MCSection *getSectionBSS() {
+ return getContext().getObjectFileInfo()->getBSSSection();
}
void SetSectionText() {
unsigned ByteAlignment, bool External) {
assert(!Symbol->isInSection() && "Symbol must not already have a section!");
- const MCSectionCOFF *Section = getSectionBSS();
+ const MCSection *Section = getSectionBSS();
MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
if (SectionData.getAlignment() < ByteAlignment)
SectionData.setAlignment(ByteAlignment);