本文整理汇总了C++中MCSection::setAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ MCSection::setAlignment方法的具体用法?C++ MCSection::setAlignment怎么用?C++ MCSection::setAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCSection
的用法示例。
在下文中一共展示了MCSection::setAlignment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EmitCOFFSafeSEH
void MCWinCOFFStreamer::EmitCOFFSafeSEH(MCSymbol const *Symbol) {
// SafeSEH is a feature specific to 32-bit x86. It does not exist (and is
// unnecessary) on all platforms which use table-based exception dispatch.
if (getContext().getObjectFileInfo()->getTargetTriple().getArch() !=
Triple::x86)
return;
const MCSymbolCOFF *CSymbol = cast<MCSymbolCOFF>(Symbol);
if (CSymbol->isSafeSEH())
return;
MCSection *SXData = getContext().getObjectFileInfo()->getSXDataSection();
getAssembler().registerSection(*SXData);
if (SXData->getAlignment() < 4)
SXData->setAlignment(4);
new MCSafeSEHFragment(Symbol, SXData);
getAssembler().registerSymbol(*Symbol);
CSymbol->setIsSafeSEH();
// The Microsoft linker requires that the symbol type of a handler be
// function. Go ahead and oblige it here.
CSymbol->setType(COFF::IMAGE_SYM_DTYPE_FUNCTION
<< COFF::SCT_COMPLEX_TYPE_SHIFT);
}
示例2: EmitValueToAlignment
void MCObjectStreamer::EmitValueToAlignment(unsigned ByteAlignment,
int64_t Value,
unsigned ValueSize,
unsigned MaxBytesToEmit) {
if (MaxBytesToEmit == 0)
MaxBytesToEmit = ByteAlignment;
insert(new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit));
// Update the maximum alignment on the current section if necessary.
MCSection *CurSec = getCurrentSection().first;
if (ByteAlignment > CurSec->getAlignment())
CurSec->setAlignment(ByteAlignment);
}
示例3: EmitLocalCommonSymbol
void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
assert(!Symbol->isInSection() && "Symbol must not already have a section!");
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
getAssembler().registerSection(*Section);
if (Section->getAlignment() < ByteAlignment)
Section->setAlignment(ByteAlignment);
getAssembler().registerSymbol(*Symbol);
Symbol->setExternal(false);
if (ByteAlignment != 1)
new MCAlignFragment(ByteAlignment, /*Value=*/0, /*ValueSize=*/0,
ByteAlignment, Section);
MCFillFragment *Fragment = new MCFillFragment(
/*Value=*/0, Size, Section);
Symbol->setFragment(Fragment);
}
示例4: EmitLocalCommonSymbol
void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
unsigned ByteAlignment) {
auto *Symbol = cast<MCSymbolCOFF>(S);
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
getAssembler().registerSection(*Section);
if (Section->getAlignment() < ByteAlignment)
Section->setAlignment(ByteAlignment);
getAssembler().registerSymbol(*Symbol);
Symbol->setExternal(false);
if (ByteAlignment != 1)
new MCAlignFragment(ByteAlignment, /*Value=*/0, /*ValueSize=*/0,
ByteAlignment, Section);
MCFillFragment *Fragment = new MCFillFragment(
/*Value=*/0, Size, Section);
Symbol->setFragment(Fragment);
}
示例5: emitSwiftAST
/// Emit the swift_ast section stored in \p Buffers.
void DwarfStreamer::emitSwiftAST(StringRef Buffer) {
MCSection *SwiftASTSection = MOFI->getDwarfSwiftASTSection();
SwiftASTSection->setAlignment(1 << 5);
MS->SwitchSection(SwiftASTSection);
MS->EmitBytes(Buffer);
}