9#ifndef LLVM_MC_MCELFOBJECTWRITER_H
10#define LLVM_MC_MCELFOBJECTWRITER_H
57 const unsigned HasRelocationAddend : 1;
58 const unsigned Is64Bit : 1;
62 bool HasRelocationAddend_,
uint8_t ABIVersion_ = 0);
89 bool IsPCRel)
const = 0;
95 virtual void sortRelocs(std::vector<ELFRelocationEntry> &Relocs);
108#define R_TYPE_SHIFT 0
109#define R_TYPE_MASK 0xffffff00
110#define R_TYPE2_SHIFT 8
111#define R_TYPE2_MASK 0xffff00ff
112#define R_TYPE3_SHIFT 16
113#define R_TYPE3_MASK 0xff00ffff
114#define R_SSYM_SHIFT 24
115#define R_SSYM_MASK 0x00ffffff
132 static unsigned setRTypes(
unsigned Value1,
unsigned Value2,
unsigned Value3) {
143 unsigned ELFHeaderEFlags = 0;
173 void reset()
override;
180 bool IsPCRel)
const override;
187 unsigned Type)
const;
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file defines the DenseMap class.
This file defines the SmallVector class.
std::unique_ptr< MCELFObjectTargetWriter > TargetObjectWriter
ELFObjectWriter(std::unique_ptr< MCELFObjectTargetWriter > MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
void setAssembler(MCAssembler *Asm) override
bool usesRela(const MCTargetOptions &TO, const MCSectionELF &Sec) const
SmallVector< const MCSymbolELF *, 0 > Weakrefs
bool checkRelocation(SMLoc Loc, const MCSectionELF *From, const MCSectionELF *To)
unsigned getELFHeaderEFlags() const
void reset() override
lifetime management
void setELFHeaderEFlags(unsigned Flags)
void setOverrideABIVersion(uint8_t V)
std::optional< uint8_t > OverrideABIVersion
uint64_t writeObject() override
Write the object file and returns the number of bytes written.
DenseMap< const MCSectionELF *, std::vector< ELFRelocationEntry > > Relocations
void executePostLayoutBinding() override
Perform any late binding of symbols (for example, to assign symbol indices for use when generating re...
bool isSymbolRefDifferenceFullyResolvedImpl(const MCSymbol &SymA, const MCFragment &FB, bool InSet, bool IsPCRel) const override
SmallVector< Symver, 0 > Symvers
bool hasRelocationAddend() const
void recordRelocation(const MCFragment &F, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) override
Record a relocation entry.
raw_pwrite_stream * DwoOS
bool useSectionSymbol(const MCValue &Val, const MCSymbolELF *Sym, uint64_t C, unsigned Type) const
DenseMap< const MCSymbolELF *, const MCSymbolELF * > Renames
Context object for machine code objects.
static bool classof(const MCObjectTargetWriter *W)
virtual unsigned getRelocType(const MCFixup &Fixup, const MCValue &Target, bool IsPCRel) const =0
bool hasRelocationAddend() const
Triple::ObjectFormatType getFormat() const override
~MCELFObjectTargetWriter() override=default
uint8_t getABIVersion() const
static unsigned setRTypes(unsigned Value1, unsigned Value2, unsigned Value3)
uint8_t getRType(uint32_t Type) const
uint8_t getRSsym(uint32_t Type) const
virtual bool needsRelocateWithSymbol(const MCValue &, unsigned Type) const
uint16_t getEMachine() const
static uint8_t getOSABI(Triple::OSType OSType)
unsigned setRSsym(unsigned Value, unsigned Type) const
MCELFObjectTargetWriter(bool Is64Bit_, uint8_t OSABI_, uint16_t EMachine_, bool HasRelocationAddend_, uint8_t ABIVersion_=0)
uint8_t getRType2(uint32_t Type) const
uint8_t getRType3(uint32_t Type) const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Base class for classes that define behaviour that is specific to both the target and the object forma...
This represents a section on linux, lots of unix variants and some bare metal systems.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Represents a location in source code.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
An abstract base class for streams implementations that also support a pwrite operation.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
ELFRelocationEntry(uint64_t Offset, const MCSymbolELF *Symbol, unsigned Type, uint64_t Addend)
const MCSymbolELF * Symbol
void print(raw_ostream &Out) const
LLVM_DUMP_METHOD void dump() const