LLVM 20.0.0git
|
#include "llvm/MC/MCELFObjectWriter.h"
Classes | |
struct | Symver |
Public Attributes | |
std::unique_ptr< MCELFObjectTargetWriter > | TargetObjectWriter |
raw_pwrite_stream & | OS |
raw_pwrite_stream * | DwoOS = nullptr |
DenseMap< const MCSectionELF *, std::vector< ELFRelocationEntry > > | Relocations |
DenseMap< const MCSymbolELF *, const MCSymbolELF * > | Renames |
bool | IsLittleEndian = false |
bool | SeenGnuAbi = false |
std::optional< uint8_t > | OverrideABIVersion |
SmallVector< Symver, 0 > | Symvers |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::MCObjectWriter | |
MCObjectWriter ()=default | |
Protected Attributes inherited from llvm::MCObjectWriter | |
SmallVector< std::pair< std::string, size_t >, 0 > | FileNames |
List of declared file names. | |
std::string | CompilerVersion |
std::vector< const MCSymbol * > | AddrsigSyms |
bool | EmitAddrsigSection = false |
bool | SubsectionsViaSymbols = false |
SmallVector< CGProfileEntry, 0 > | CGProfile |
Definition at line 142 of file MCELFObjectWriter.h.
ELFObjectWriter::ELFObjectWriter | ( | std::unique_ptr< MCELFObjectTargetWriter > | MOTW, |
raw_pwrite_stream & | OS, | ||
bool | IsLittleEndian | ||
) |
Definition at line 1161 of file ELFObjectWriter.cpp.
ELFObjectWriter::ELFObjectWriter | ( | std::unique_ptr< MCELFObjectTargetWriter > | MOTW, |
raw_pwrite_stream & | OS, | ||
raw_pwrite_stream & | DwoOS, | ||
bool | IsLittleEndian | ||
) |
Definition at line 1165 of file ELFObjectWriter.cpp.
bool ELFObjectWriter::checkRelocation | ( | MCContext & | Ctx, |
SMLoc | Loc, | ||
const MCSectionELF * | From, | ||
const MCSectionELF * | To | ||
) |
Definition at line 1372 of file ELFObjectWriter.cpp.
References DwoOS, From, isDwoSection(), and llvm::MCContext::reportError().
Referenced by recordRelocation().
|
overridevirtual |
Perform any late binding of symbols (for example, to assign symbol indices for use when generating relocations).
This routine is called by the assembler after layout and relaxation is complete.
Reimplemented from llvm::MCObjectWriter.
Definition at line 1185 of file ELFObjectWriter.cpp.
References llvm::MCObjectWriter::AddrsigSyms, assert(), llvm::MCSymbolRefExpr::create(), llvm::StringRef::find(), llvm::StringRef::npos, Renames, llvm::StringRef::starts_with(), llvm::StringRef::substr(), Sym, Symvers, and llvm::CallingConv::Tail.
|
inline |
Definition at line 192 of file MCELFObjectWriter.h.
bool ELFObjectWriter::hasRelocationAddend | ( | ) | const |
Definition at line 1181 of file ELFObjectWriter.cpp.
References TargetObjectWriter.
Referenced by shouldRelocateWithSymbol(), and usesRela().
|
overridevirtual |
Reimplemented from llvm::MCObjectWriter.
Definition at line 1486 of file ELFObjectWriter.cpp.
References assert(), llvm::MCFragment::getParent(), llvm::ELF::STB_LOCAL, and llvm::ELF::STT_GNU_IFUNC.
|
inline |
Definition at line 196 of file MCELFObjectWriter.h.
References SeenGnuAbi.
Referenced by llvm::MCELFStreamer::changeSection(), and llvm::MCELFStreamer::emitSymbolAttribute().
|
overridevirtual |
Record a relocation entry.
This routine is called by the assembler after layout and relaxation, and post layout binding. The implementation is responsible for storing information about the relocation so that it can be emitted during writeObject().
Implements llvm::MCObjectWriter.
Definition at line 1388 of file ELFObjectWriter.cpp.
References assert(), llvm::CallingConv::C, checkRelocation(), Fixup, llvm::MCFixupKindInfo::FKF_IsPCRel, llvm::MCFixupKindInfo::Flags, llvm::MCSection::getBeginSymbol(), llvm::MCAsmBackend::getFixupKindInfo(), llvm::MCFragment::getParent(), llvm::MCSymbolRefExpr::getSymbol(), llvm::MCContext::getTargetOptions(), Relocations, Renames, llvm::MCContext::reportError(), llvm::MCSymbolELF::setIsWeakrefUsedInReloc(), llvm::MCSymbol::setUsedInReloc(), shouldRelocateWithSymbol(), llvm::ELF::SHT_LLVM_CALL_GRAPH_PROFILE, TargetObjectWriter, usesRela(), and llvm::MCSymbolRefExpr::VK_WEAKREF.
|
overridevirtual |
lifetime management
Reimplemented from llvm::MCObjectWriter.
Definition at line 1171 of file ELFObjectWriter.cpp.
References OverrideABIVersion, Relocations, Renames, llvm::MCObjectWriter::reset(), SeenGnuAbi, and Symvers.
|
inline |
Definition at line 197 of file MCELFObjectWriter.h.
References SeenGnuAbi.
|
inline |
Definition at line 193 of file MCELFObjectWriter.h.
|
inline |
Definition at line 200 of file MCELFObjectWriter.h.
References OverrideABIVersion.
bool ELFObjectWriter::shouldRelocateWithSymbol | ( | const MCAssembler & | Asm, |
const MCValue & | Val, | ||
const MCSymbolELF * | Sym, | ||
uint64_t | C, | ||
unsigned | Type | ||
) | const |
Definition at line 1243 of file ELFObjectWriter.cpp.
References assert(), llvm::CallingConv::C, llvm::ELF::EM_386, llvm::ELF::EM_MIPS, llvm::MCSectionELF::getFlags(), llvm::MCSymbolRefExpr::getKind(), llvm::MCValue::getSymA(), hasRelocationAddend(), llvm_unreachable, llvm::ELF::SHF_MERGE, llvm::ELF::SHF_TLS, llvm::ELF::STB_GLOBAL, llvm::ELF::STB_GNU_UNIQUE, llvm::ELF::STB_LOCAL, llvm::ELF::STB_WEAK, llvm::ELF::STT_GNU_IFUNC, Sym, TargetObjectWriter, llvm::MCSymbolRefExpr::VK_GOT, llvm::MCSymbolRefExpr::VK_GOTPCREL, llvm::MCSymbolRefExpr::VK_GOTPCREL_NORELAX, llvm::MCSymbolRefExpr::VK_PLT, llvm::MCSymbolRefExpr::VK_PPC_GOT_HA, llvm::MCSymbolRefExpr::VK_PPC_GOT_HI, llvm::MCSymbolRefExpr::VK_PPC_GOT_LO, and llvm::MCSymbolRefExpr::VK_PPC_TOCBASE.
Referenced by recordRelocation().
bool ELFObjectWriter::usesRela | ( | const MCTargetOptions * | TO, |
const MCSectionELF & | Sec | ||
) | const |
Definition at line 1479 of file ELFObjectWriter.cpp.
References llvm::MCTargetOptions::Crel, llvm::MCSectionELF::getType(), hasRelocationAddend(), and llvm::ELF::SHT_LLVM_CALL_GRAPH_PROFILE.
Referenced by recordRelocation().
|
overridevirtual |
Write the object file and returns the number of bytes written.
This routine is called by the assembler after layout and relaxation is complete, fixups have been evaluated and applied, and relocations generated.
Implements llvm::MCObjectWriter.
Definition at line 1499 of file ELFObjectWriter.cpp.
References DwoOS, IsLittleEndian, OS, and Size.
raw_pwrite_stream* llvm::ELFObjectWriter::DwoOS = nullptr |
Definition at line 148 of file MCELFObjectWriter.h.
Referenced by checkRelocation(), and writeObject().
bool llvm::ELFObjectWriter::IsLittleEndian = false |
Definition at line 152 of file MCELFObjectWriter.h.
Referenced by writeObject().
raw_pwrite_stream& llvm::ELFObjectWriter::OS |
Definition at line 147 of file MCELFObjectWriter.h.
Referenced by writeObject().
std::optional<uint8_t> llvm::ELFObjectWriter::OverrideABIVersion |
Definition at line 154 of file MCELFObjectWriter.h.
Referenced by reset(), and setOverrideABIVersion().
DenseMap<const MCSectionELF *, std::vector<ELFRelocationEntry> > llvm::ELFObjectWriter::Relocations |
Definition at line 150 of file MCELFObjectWriter.h.
Referenced by recordRelocation(), and reset().
DenseMap<const MCSymbolELF *, const MCSymbolELF *> llvm::ELFObjectWriter::Renames |
Definition at line 151 of file MCELFObjectWriter.h.
Referenced by executePostLayoutBinding(), recordRelocation(), and reset().
bool llvm::ELFObjectWriter::SeenGnuAbi = false |
Definition at line 153 of file MCELFObjectWriter.h.
Referenced by markGnuAbi(), reset(), and seenGnuAbi().
SmallVector<Symver, 0> llvm::ELFObjectWriter::Symvers |
Definition at line 163 of file MCELFObjectWriter.h.
Referenced by llvm::MCELFStreamer::emitELFSymverDirective(), executePostLayoutBinding(), and reset().
std::unique_ptr<MCELFObjectTargetWriter> llvm::ELFObjectWriter::TargetObjectWriter |
Definition at line 146 of file MCELFObjectWriter.h.
Referenced by hasRelocationAddend(), recordRelocation(), and shouldRelocateWithSymbol().