当前位置: 首页>>代码示例>>C++>>正文


C++ MCSection::setAlignment方法代码示例

本文整理汇总了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);
}
开发者ID:AnachroNia,项目名称:llvm,代码行数:26,代码来源:WinCOFFStreamer.cpp

示例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);
}
开发者ID:RichardsonAlex,项目名称:llvm-1,代码行数:13,代码来源:MCObjectStreamer.cpp

示例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);
}
开发者ID:AnachroNia,项目名称:llvm,代码行数:20,代码来源:WinCOFFStreamer.cpp

示例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);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:20,代码来源:MCWinCOFFStreamer.cpp

示例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);
}
开发者ID:jaredmcneill,项目名称:netbsd-src,代码行数:7,代码来源:DwarfStreamer.cpp


注:本文中的MCSection::setAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。