9#ifndef LLVM_MC_MCMACHOBJECTWRITER_H 
   10#define LLVM_MC_MCMACHOBJECTWRITER_H 
   35  const unsigned Is64Bit : 1;
 
 
   99    bool EmitBuildVersion;
 
 
  113  struct MachSymbolData {
 
  122  struct IndirectSymbolData {
 
  123    MCSymbolMachO *Symbol;
 
  128  std::unique_ptr<MCMachObjectTargetWriter> TargetObjectWriter;
 
  133  struct RelAndSymbol {
 
  135    MachO::any_relocation_info MRE;
 
  136    RelAndSymbol(
const MCSymbol *Sym, 
const MachO::any_relocation_info &MRE)
 
  137        : Sym(Sym), MRE(MRE) {}
 
  140  DenseMap<const MCSection *, std::vector<RelAndSymbol>> Relocations;
 
  141  std::vector<IndirectSymbolData> IndirectSymbols;
 
  142  DenseMap<const MCSection *, unsigned> IndirectSymBase;
 
  144  std::vector<DataRegionData> DataRegions;
 
  146  DenseMap<const MCSection *, uint64_t> SectionAddress;
 
  150  SmallVector<MCSection *, 0> SectionOrder;
 
  157  std::vector<MachSymbolData> LocalSymbolData;
 
  158  std::vector<MachSymbolData> ExternalSymbolData;
 
  159  std::vector<MachSymbolData> UndefinedSymbolData;
 
  164  MCLOHContainer LOHContainer;
 
  166  VersionInfoType VersionInfo{};
 
  167  VersionInfoType TargetVariantVersionInfo{};
 
  170  std::vector<std::vector<std::string>> LinkerOptions;
 
  172  MachSymbolData *findSymbolData(
const MCSymbol &Sym);
 
  174  void writeWithPadding(StringRef Str, uint64_t 
Size);
 
  179      : TargetObjectWriter(
std::
move(MOTW)),
 
 
  189  void reset() 
override;
 
  196    return IndirectSymbols;
 
 
  205    return SectionAddress.lookup(Sec);
 
 
  216  bool doesSymbolRequireExternRelocation(
const MCSymbol &S);
 
  222    VersionInfo.EmitBuildVersion = 
false;
 
  223    VersionInfo.TypeOrPlatform.Type = 
Type;
 
  224    VersionInfo.Major = Major;
 
  225    VersionInfo.Minor = Minor;
 
  226    VersionInfo.Update = Update;
 
  227    VersionInfo.SDKVersion = SDKVersion;
 
 
  230                       unsigned Minor, 
unsigned Update,
 
  232    VersionInfo.EmitBuildVersion = 
true;
 
  233    VersionInfo.TypeOrPlatform.Platform = Platform;
 
  234    VersionInfo.Major = Major;
 
  235    VersionInfo.Minor = Minor;
 
  236    VersionInfo.Update = Update;
 
  237    VersionInfo.SDKVersion = SDKVersion;
 
 
  240                                    unsigned Major, 
unsigned Minor,
 
  242    TargetVariantVersionInfo.EmitBuildVersion = 
true;
 
  243    TargetVariantVersionInfo.TypeOrPlatform.Platform = Platform;
 
  244    TargetVariantVersionInfo.Major = Major;
 
  245    TargetVariantVersionInfo.Minor = Minor;
 
  246    TargetVariantVersionInfo.Update = Update;
 
  247    TargetVariantVersionInfo.SDKVersion = SDKVersion;
 
 
  251    return LinkerOptions;
 
 
  259  bool is64Bit()
 const { 
return TargetObjectWriter->is64Bit(); }
 
  261    uint32_t CPUType = TargetObjectWriter->getCPUType();
 
 
  268                   unsigned LoadCommandsSize, 
bool SubsectionsViaSymbols);
 
  274  void writeSegmentLoadCommand(
StringRef Name, 
unsigned NumSections,
 
  282                    uint64_t RelocationsStart, 
unsigned NumRelocations);
 
  288  void writeDysymtabLoadCommand(
 
  294  void writeNlist(MachSymbolData &MSD, 
const MCAssembler &Asm);
 
  299  void writeLinkerOptionsLoadCommand(
const std::vector<std::string> &
Options);
 
  322    RelAndSymbol 
P(RelSymbol, MRE);
 
  323    Relocations[Sec].push_back(
P);
 
 
  333                          std::vector<MachSymbolData> &LocalSymbolData,
 
  334                          std::vector<MachSymbolData> &ExternalSymbolData,
 
  335                          std::vector<MachSymbolData> &UndefinedSymbolData);
 
  337  void computeSectionAddresses(
const MCAssembler &Asm);
 
  339  void executePostLayoutBinding() 
override;
 
  341  bool isSymbolRefDifferenceFullyResolvedImpl(
const MCSymbol &SymA,
 
  343                                              bool IsPCRel) 
const override;
 
 
This file defines the DenseMap class.
 
bool operator<(const DeltaInfo &LHS, int64_t Delta)
 
PowerPC TLS Dynamic Call Fixup
 
Defines the llvm::VersionTuple class, which represents a version in the form major[....
 
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
 
~MCMachObjectTargetWriter() override
 
uint32_t getCPUType() const
 
unsigned LocalDifference_RIT
 
virtual void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue)=0
 
void setLocalDifferenceRelocationType(unsigned Type)
 
uint32_t getCPUSubtype() const
 
static bool classof(const MCObjectTargetWriter *W)
 
Triple::ObjectFormatType getFormat() const override
 
MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_, uint32_t CPUSubtype_)
 
unsigned getLocalDifferenceRelocationType() const
 
Base class for classes that define behaviour that is specific to both the target and the object forma...
 
This represents a section on a Mach-O system (used by Mac OS X).
 
Instances of this class represent a uniqued identifier for a section in the current translation unit.
 
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
 
void setTargetVariantBuildVersion(MachO::PlatformType Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
 
MCLOHContainer & getLOHContainer()
 
uint64_t getSectionAddress(const MCSection *Sec) const
 
void addRelocation(const MCSymbol *RelSymbol, const MCSection *Sec, MachO::any_relocation_info &MRE)
 
const llvm::SmallVectorImpl< MCSection * > & getSectionOrder() const
 
std::vector< DataRegionData > & getDataRegions()
 
support::endian::Writer W
 
const MCSymbol & findAliasedSymbol(const MCSymbol &Sym) const
 
std::vector< IndirectSymbolData > & getIndirectSymbols()
 
void setAssembler(MCAssembler *Asm) override
 
void reset() override
lifetime management
 
void setVersionMin(MCVersionMinType Type, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion=VersionTuple())
Mach-O deployment target version information.
 
void setBuildVersion(MachO::PlatformType Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion=VersionTuple())
 
MachObjectWriter(std::unique_ptr< MCMachObjectTargetWriter > MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
 
std::vector< std::vector< std::string > > & getLinkerOptions()
 
struct { bool EmitBuildVersion; union { MCVersionMinType Type; MachO::PlatformType Platform; } TypeOrPlatform; unsigned Major; unsigned Minor; unsigned Update; VersionTuple SDKVersion; } VersionInfoType
 
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
 
StringRef - Represent a constant reference to a string, i.e.
 
Utility for building string tables with deduplicated suffixes.
 
Target - Wrapper for Target specific information.
 
The instances of the Type class are immutable: once they are created, they are never changed.
 
Represents a version number in the form major[.minor[.subminor[.build]]].
 
An abstract base class for streams implementations that also support a pwrite operation.
 
This is an optimization pass for GlobalISel generic memory operations.
 
FunctionAddr VTableAddr uintptr_t uintptr_t DataSize
 
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
 
Implement std::hash so that hash_code can be used in STL containers.
 
MachO::DataRegionType Kind
 
Adapter to write values to a stream in a particular byte order.