9 #ifndef LLVM_MC_MCMACHOBJECTWRITER_H 10 #define LLVM_MC_MCMACHOBJECTWRITER_H 26 class MachObjectWriter;
29 const unsigned Is64Bit : 1;
41 LocalDifference_RIT = Type;
78 uint64_t &FixedValue) = 0;
85 struct MachSymbolData {
91 bool operator<(
const MachSymbolData &RHS)
const;
95 std::unique_ptr<MCMachObjectTargetWriter> TargetObjectWriter;
100 struct RelAndSymbol {
104 : Sym(Sym), MRE(MRE) {}
117 std::vector<MachSymbolData> LocalSymbolData;
118 std::vector<MachSymbolData> ExternalSymbolData;
119 std::vector<MachSymbolData> UndefinedSymbolData;
123 MachSymbolData *findSymbolData(
const MCSymbol &Sym);
130 : TargetObjectWriter(
std::move(MOTW)),
131 W(OS, IsLittleEndian ? support::
little : support::
big) {}
140 void reset()
override;
152 return SectionAddress.
lookup(Sec);
156 uint64_t getFragmentAddress(
const MCFragment *Fragment,
161 bool doesSymbolRequireExternRelocation(
const MCSymbol &S);
168 bool is64Bit()
const {
return TargetObjectWriter->is64Bit(); }
170 uint32_t CPUType = TargetObjectWriter->getCPUType();
177 unsigned LoadCommandsSize,
bool SubsectionsViaSymbols);
183 void writeSegmentLoadCommand(
StringRef Name,
unsigned NumSections,
184 uint64_t VMAddr, uint64_t VMSize,
185 uint64_t SectionDataStartOffset,
186 uint64_t SectionDataSize,
uint32_t MaxProt,
190 uint64_t VMAddr, uint64_t FileOffset,
unsigned Flags,
191 uint64_t RelocationsStart,
unsigned NumRelocations);
197 void writeDysymtabLoadCommand(
203 void writeNlist(MachSymbolData &MSD,
const MCAsmLayout &Layout);
208 void writeLinkerOptionsLoadCommand(
const std::vector<std::string> &Options);
231 RelAndSymbol
P(RelSymbol, MRE);
232 Relocations[Sec].push_back(P);
239 unsigned Log2Size, uint64_t &FixedValue);
243 MCValue Target, uint64_t &FixedValue);
247 MCValue Target, uint64_t &FixedValue)
override;
253 std::vector<MachSymbolData> &LocalSymbolData,
254 std::vector<MachSymbolData> &ExternalSymbolData,
255 std::vector<MachSymbolData> &UndefinedSymbolData);
257 void computeSectionAddresses(
const MCAssembler &Asm,
263 bool isSymbolRefDifferenceFullyResolvedImpl(
const MCAssembler &Asm,
266 bool InSet)
const override;
268 bool isSymbolRefDifferenceFullyResolvedImpl(
const MCAssembler &Asm,
271 bool IsPCRel)
const override;
283 std::unique_ptr<MCObjectWriter>
289 #endif // LLVM_MC_MCMACHOBJECTWRITER_H Instances of this class represent a uniqued identifier for a section in the current translation unit...
This class represents lattice values for constants.
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
uint32_t getCPUType() const
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
MachObjectWriter(std::unique_ptr< MCMachObjectTargetWriter > MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
support::endian::Writer W
virtual ~MCMachObjectTargetWriter()
Encapsulates the layout of an assembly file at a particular point in time.
virtual Triple::ObjectFormatType getFormat() const =0
void setLocalDifferenceRelocationType(unsigned Type)
Utility for building string tables with deduplicated suffixes.
void addRelocation(const MCSymbol *RelSymbol, const MCSection *Sec, MachO::any_relocation_info &MRE)
SectionAddrMap & getSectionAddressMap()
static bool classof(const MCObjectTargetWriter *W)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
unsigned LocalDifference_RIT
The instances of the Type class are immutable: once they are created, they are never changed...
uint32_t getCPUSubtype() const
PowerPC TLS Dynamic Call Fixup
virtual Triple::ObjectFormatType getFormat() const
unsigned getLocalDifferenceRelocationType() const
Target - Wrapper for Target specific information.
Adapter to write values to a stream in a particular byte order.
virtual void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue)=0
std::unique_ptr< MCObjectWriter > createMachObjectWriter(std::unique_ptr< MCMachObjectTargetWriter > MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
Construct a new Mach-O writer instance.
Base class for classes that define behaviour that is specific to both the target and the object forma...
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
uint64_t getSectionAddress(const MCSection *Sec) const
An abstract base class for streams implementations that also support a pwrite operation.
bool operator<(int64_t V1, const APSInt &V2)
StringRef - Represent a constant reference to a string, i.e.
MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_, uint32_t CPUSubtype_)