42 #define DEBUG_TYPE "reloc-info"
47 class ELFObjectWriter;
49 class SymbolTableWriter {
50 ELFObjectWriter &EWriter;
54 std::vector<uint32_t> ShndxIndexes;
59 void createSymtabShndx();
64 SymbolTableWriter(ELFObjectWriter &EWriter,
bool Is64Bit);
67 uint8_t other,
uint32_t shndx,
bool Reserved);
75 bool Used,
bool Renamed);
78 struct ELFSymbolData {
84 bool operator<(
const ELFSymbolData &RHS)
const {
85 unsigned LHSType = Symbol->
getType();
86 unsigned RHSType = RHS.Symbol->getType();
92 return SectionIndex < RHS.SectionIndex;
93 return Name < RHS.Name;
98 std::unique_ptr<MCELFObjectTargetWriter> TargetObjectWriter;
116 unsigned LastLocalSymbolIndex;
118 unsigned StringTableIndex;
120 unsigned SymbolTableIndex;
123 std::vector<const MCSectionELF *> SectionTable;
127 bool is64Bit()
const {
return TargetObjectWriter->is64Bit(); }
128 bool hasRelocationAddend()
const {
129 return TargetObjectWriter->hasRelocationAddend();
133 return TargetObjectWriter->getRelocType(Ctx, Target, Fixup, IsPCRel);
136 void align(
unsigned Alignment);
138 bool maybeWriteCompression(uint64_t Size,
140 bool ZLibStyle,
unsigned Alignment);
147 void reset()
override {
150 StrTabBuilder.clear();
151 SectionTable.clear();
155 ~ELFObjectWriter()
override;
157 void WriteWord(uint64_t W) {
164 template <
typename T>
void write(
T Val) {
173 void writeSymbol(SymbolTableWriter &Writer,
uint32_t StringIndex,
177 typedef std::map<const MCSectionELF *, std::pair<uint64_t, uint64_t>>
180 bool shouldRelocateWithSymbol(
const MCAssembler &Asm,
183 unsigned Type)
const;
188 uint64_t &FixedValue)
override;
199 const SectionIndexMapTy &SectionIndexMap,
200 const RevGroupMapTy &RevGroupMap,
201 SectionOffsetsTy &SectionOffsets);
212 const SectionIndexMapTy &SectionIndexMap,
213 const SectionOffsetsTy &SectionOffsets);
225 bool isSymbolRefDifferenceFullyResolvedImpl(
const MCAssembler &Asm,
228 bool IsPCRel)
const override;
233 void writeSection(
const SectionIndexMapTy &SectionIndexMap,
234 uint32_t GroupSymbolIndex, uint64_t Offset, uint64_t Size,
239 void ELFObjectWriter::align(
unsigned Alignment) {
244 unsigned ELFObjectWriter::addToSectionTable(
const MCSectionELF *Sec) {
245 SectionTable.push_back(Sec);
247 return SectionTable.size();
250 void SymbolTableWriter::createSymtabShndx() {
251 if (!ShndxIndexes.empty())
254 ShndxIndexes.resize(NumWritten);
258 EWriter.write(Value);
261 SymbolTableWriter::SymbolTableWriter(ELFObjectWriter &EWriter,
bool Is64Bit)
262 : EWriter(EWriter), Is64Bit(Is64Bit), NumWritten(0) {}
264 void SymbolTableWriter::writeSymbol(
uint32_t name, uint8_t
info, uint64_t value,
265 uint64_t size, uint8_t other,
272 if (!ShndxIndexes.empty()) {
274 ShndxIndexes.push_back(shndx);
276 ShndxIndexes.push_back(0);
300 ELFObjectWriter::~ELFObjectWriter()
322 write8(TargetObjectWriter->getOSABI());
329 write16(TargetObjectWriter->getEMachine());
356 uint64_t ELFObjectWriter::SymbolValue(
const MCSymbol &Sym,
371 void ELFObjectWriter::executePostLayoutBinding(
MCAssembler &Asm,
381 const MCSymbol *Alias = Asm.getContext().lookupSymbol(Begin->
getName());
386 std::make_pair(cast<MCSymbolELF>(Alias), cast<MCSymbolELF>(Begin)));
391 for (
const MCSymbol &
A : Asm.symbols()) {
392 const auto &Alias = cast<MCSymbolELF>(
A);
399 const auto &
Symbol = cast<MCSymbolELF>(Ref->getSymbol());
402 size_t Pos = AliasName.
find(
'@');
403 if (Pos == StringRef::npos)
409 Alias.setBinding(
Symbol.getBinding());
420 Renames.insert(std::make_pair(&
Symbol, &Alias));
425 uint8_t
Type = newType;
459 void ELFObjectWriter::writeSymbol(SymbolTableWriter &Writer,
460 uint32_t StringIndex, ELFSymbolData &MSD,
462 const auto &
Symbol = cast<MCSymbolELF>(*MSD.Symbol);
468 bool IsReserved = !Base ||
Symbol.isCommon();
471 uint8_t Binding =
Symbol.getBinding();
476 uint8_t Info = (Binding << 4) | Type;
483 uint64_t Value = SymbolValue(*MSD.Symbol, Layout);
486 const MCExpr *ESize = MSD.Symbol->getSize();
488 ESize = Base->getSize();
498 Writer.writeSymbol(StringIndex, Info, Value, Size, Other, MSD.SectionIndex,
505 bool ELFObjectWriter::shouldRelocateWithSymbol(
const MCAssembler &Asm,
508 unsigned Type)
const {
509 const auto *Sym = cast_or_null<MCSymbolELF>(S);
525 case MCSymbolRefExpr::VK_PPC_TOCBASE:
532 case MCSymbolRefExpr::VK_GOT:
533 case MCSymbolRefExpr::VK_PLT:
534 case MCSymbolRefExpr::VK_GOTPCREL:
535 case MCSymbolRefExpr::VK_PPC_GOT_LO:
536 case MCSymbolRefExpr::VK_PPC_GOT_HI:
537 case MCSymbolRefExpr::VK_PPC_GOT_HA:
543 assert(Sym &&
"Expected a symbol");
547 unsigned Binding = Sym->getBinding();
572 auto &Sec = cast<MCSectionELF>(Sym->
getSection());
580 if (!hasRelocationAddend())
599 if (TargetObjectWriter->needsRelocateWithSymbol(*Sym, Type))
624 void ELFObjectWriter::recordRelocation(
MCAssembler &Asm,
628 bool &IsPCRel, uint64_t &FixedValue) {
635 assert(RefB->getKind() == MCSymbolRefExpr::VK_None &&
636 "Should not have constructed this");
648 "No relocation available to represent this relative expression");
652 const auto &SymB = cast<MCSymbolELF>(RefB->getSymbol());
654 if (SymB.isUndefined()) {
656 Twine(
"symbol '") + SymB.getName() +
657 "' can not be undefined in a subtraction expression");
661 assert(!SymB.isAbsolute() &&
"Should have been folded");
662 const MCSection &SecB = SymB.getSection();
663 if (&SecB != &FixupSection) {
665 "Cannot represent a difference across sections");
670 uint64_t K = SymBOffset - FixupOffset;
677 const auto *SymA = RefA ? cast<MCSymbolELF>(&RefA->
getSymbol()) :
nullptr;
679 bool ViaWeakRef =
false;
680 if (SymA && SymA->isVariable()) {
681 const MCExpr *Expr = SymA->getVariableValue();
682 if (
const auto *Inner = dyn_cast<MCSymbolRefExpr>(Expr)) {
683 if (Inner->getKind() == MCSymbolRefExpr::VK_WEAKREF) {
684 SymA = cast<MCSymbolELF>(&Inner->getSymbol());
690 unsigned Type =
getRelocType(Ctx, Target, Fixup, IsPCRel);
691 uint64_t OriginalC =
C;
692 bool RelocateWithSymbol = shouldRelocateWithSymbol(Asm, RefA, SymA, C, Type);
693 if (!RelocateWithSymbol && SymA && !SymA->isUndefined())
697 if (hasRelocationAddend()) {
704 if (!RelocateWithSymbol) {
706 (SymA && !SymA->isUndefined()) ? &SymA->getSection() :
nullptr;
707 auto *ELFSec = cast_or_null<MCSectionELF>(SecA);
708 const auto *SectionSymbol =
709 ELFSec ? cast<MCSymbolELF>(ELFSec->getBeginSymbol()) :
nullptr;
711 SectionSymbol->setUsedInReloc();
714 Relocations[&FixupSection].push_back(Rec);
718 const auto *RenamedSymA = SymA;
724 RenamedSymA->setIsWeakrefUsedInReloc();
726 RenamedSymA->setUsedInReloc();
730 Relocations[&FixupSection].push_back(Rec);
733 bool ELFObjectWriter::isInSymtab(
const MCAsmLayout &Layout,
739 if (Ref->getKind() == MCSymbolRefExpr::VK_WEAKREF)
768 void ELFObjectWriter::computeSymbolTable(
770 const SectionIndexMapTy &SectionIndexMap,
const RevGroupMapTy &RevGroupMap,
771 SectionOffsetsTy &SectionOffsets) {
773 SymbolTableWriter Writer(*
this,
is64Bit());
780 SymbolTableIndex = addToSectionTable(SymtabSection);
783 uint64_t SecStart = getStream().tell();
786 Writer.writeSymbol(0, 0, 0, 0, 0, 0,
false);
788 std::vector<ELFSymbolData> LocalSymbolData;
789 std::vector<ELFSymbolData> ExternalSymbolData;
792 bool HasLargeSectionIndex =
false;
794 const auto &Symbol = cast<MCSymbolELF>(S);
799 if (!isInSymtab(Layout, Symbol, Used || WeakrefUsed || isSignature,
800 Renames.count(&Symbol)))
809 MSD.Symbol = cast<MCSymbolELF>(&
Symbol);
820 if (isSignature && !Used) {
821 MSD.SectionIndex = RevGroupMap.lookup(&Symbol);
823 HasLargeSectionIndex =
true;
830 MSD.SectionIndex = SectionIndexMap.lookup(&Section);
831 assert(MSD.SectionIndex &&
"Invalid section index!");
833 HasLargeSectionIndex =
true;
866 size_t Pos = Name.
find(
"@@@");
867 if (Pos != StringRef::npos) {
868 Buf += Name.
substr(0, Pos);
870 Buf += Name.
substr(Pos + Skip);
871 Name = VersionSymSaver.save(Buf.
c_str());
878 StrTabBuilder.add(Name);
882 LocalSymbolData.push_back(MSD);
884 ExternalSymbolData.push_back(MSD);
888 unsigned SymtabShndxSectionIndex = 0;
890 if (HasLargeSectionIndex) {
893 SymtabShndxSectionIndex = addToSectionTable(SymtabShndxSection);
898 for (
const std::string &Name : FileNames)
899 StrTabBuilder.add(Name);
901 StrTabBuilder.finalize();
903 for (
const std::string &Name : FileNames)
904 Writer.writeSymbol(StrTabBuilder.getOffset(Name),
910 array_pod_sort(ExternalSymbolData.begin(), ExternalSymbolData.end());
914 unsigned Index = FileNames.size() + 1;
916 for (ELFSymbolData &MSD : LocalSymbolData) {
919 : StrTabBuilder.getOffset(MSD.Name);
920 MSD.Symbol->setIndex(Index++);
921 writeSymbol(Writer, StringIndex, MSD, Layout);
925 LastLocalSymbolIndex = Index;
927 for (ELFSymbolData &MSD : ExternalSymbolData) {
928 unsigned StringIndex = StrTabBuilder.getOffset(MSD.Name);
929 MSD.Symbol->setIndex(Index++);
930 writeSymbol(Writer, StringIndex, MSD, Layout);
934 uint64_t SecEnd = getStream().tell();
935 SectionOffsets[SymtabSection] = std::make_pair(SecStart, SecEnd);
938 if (ShndxIndexes.
empty()) {
939 assert(SymtabShndxSectionIndex == 0);
942 assert(SymtabShndxSectionIndex != 0);
944 SecStart = getStream().tell();
946 SectionTable[SymtabShndxSectionIndex - 1];
949 SecEnd = getStream().tell();
950 SectionOffsets[SymtabShndxSection] = std::make_pair(SecStart, SecEnd);
954 ELFObjectWriter::createRelocationSection(
MCContext &Ctx,
956 if (Relocations[&Sec].empty())
960 std::string RelaSectionName = hasRelocationAddend() ?
".rela" :
".rel";
964 if (hasRelocationAddend())
975 Flags, EntrySize, Sec.
getGroup(), &Sec);
981 bool ELFObjectWriter::maybeWriteCompression(
983 unsigned Alignment) {
987 if (Size <= HdrSize + CompressedContents.
size())
993 write(static_cast<ELF::Elf64_Word>(0));
994 write(static_cast<ELF::Elf64_Xword>(Size));
995 write(static_cast<ELF::Elf64_Xword>(Alignment));
999 write(static_cast<ELF::Elf32_Word>(Size));
1000 write(static_cast<ELF::Elf32_Word>(Alignment));
1008 if (Size <= Magic.
size() +
sizeof(Size) + CompressedContents.
size())
1023 bool CompressionEnabled =
1025 DebugCompressionType::DCT_None;
1026 if (!CompressionEnabled || !SectionName.
startswith(
".debug_") ||
1027 SectionName ==
".debug_frame") {
1037 setStream(OldStream);
1042 CompressedContents);
1044 getStream() << UncompressedData;
1049 DebugCompressionType::DCT_Zlib;
1050 if (!maybeWriteCompression(UncompressedData.
size(), CompressedContents,
1052 getStream() << UncompressedData;
1063 getStream() << CompressedContents;
1067 uint64_t Flags, uint64_t
Address,
1068 uint64_t
Offset, uint64_t Size,
1071 uint64_t EntrySize) {
1080 WriteWord(Alignment);
1081 WriteWord(EntrySize);
1084 void ELFObjectWriter::writeRelocations(
const MCAssembler &Asm,
1086 std::vector<ELFRelocationEntry> &Relocs = Relocations[&Sec];
1095 TargetObjectWriter->sortRelocs(Asm, Relocs);
1097 for (
unsigned i = 0, e = Relocs.size();
i != e; ++
i) {
1103 if (TargetObjectWriter->isN64()) {
1106 write(TargetObjectWriter->getRSsym(Entry.
Type));
1107 write(TargetObjectWriter->getRType3(Entry.
Type));
1108 write(TargetObjectWriter->getRType2(Entry.
Type));
1109 write(TargetObjectWriter->getRType(Entry.
Type));
1113 write(ERE64.r_info);
1115 if (hasRelocationAddend())
1122 write(ERE32.r_info);
1124 if (hasRelocationAddend())
1131 const MCSectionELF *StrtabSection = SectionTable[StringTableIndex - 1];
1132 StrTabBuilder.write(getStream());
1133 return StrtabSection;
1136 void ELFObjectWriter::writeSection(
const SectionIndexMapTy &SectionIndexMap,
1139 uint64_t sh_link = 0;
1140 uint64_t sh_info = 0;
1152 sh_link = SymbolTableIndex;
1153 assert(sh_link &&
".symtab not found");
1155 sh_info = SectionIndexMap.lookup(InfoSection);
1161 sh_link = StringTableIndex;
1162 sh_info = LastLocalSymbolIndex;
1166 sh_link = SymbolTableIndex;
1170 sh_link = SymbolTableIndex;
1171 sh_info = GroupSymbolIndex;
1175 if (TargetObjectWriter->getEMachine() ==
ELF::EM_ARM &&
1179 WriteSecHdrEntry(StrTabBuilder.getOffset(Section.
getSectionName()),
1185 void ELFObjectWriter::writeSectionHeader(
1186 const MCAsmLayout &Layout,
const SectionIndexMapTy &SectionIndexMap,
1187 const SectionOffsetsTy &SectionOffsets) {
1188 const unsigned NumSections = SectionTable.size();
1191 uint64_t FirstSectionSize =
1193 WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, 0, 0);
1197 unsigned Type = Section->
getType();
1199 GroupSymbolIndex = 0;
1203 const std::pair<uint64_t, uint64_t> &
Offsets =
1204 SectionOffsets.find(Section)->second;
1209 Size = Offsets.second - Offsets.first;
1211 writeSection(SectionIndexMap, GroupSymbolIndex, Offsets.first, Size,
1216 void ELFObjectWriter::writeObject(
MCAssembler &Asm,
1221 StringTableIndex = addToSectionTable(StrtabSection);
1223 RevGroupMapTy RevGroupMap;
1224 SectionIndexMapTy SectionIndexMap;
1226 std::map<const MCSymbol *, std::vector<const MCSectionELF *>> GroupMembers;
1232 SectionOffsetsTy SectionOffsets;
1233 std::vector<MCSectionELF *> Groups;
1234 std::vector<MCSectionELF *> Relocations;
1241 uint64_t SecStart = getStream().tell();
1244 writeSectionData(Asm, Section, Layout);
1246 uint64_t SecEnd = getStream().tell();
1247 SectionOffsets[&
Section] = std::make_pair(SecStart, SecEnd);
1249 MCSectionELF *RelSection = createRelocationSection(Ctx, Section);
1251 if (SignatureSymbol) {
1252 Asm.registerSymbol(*SignatureSymbol);
1253 unsigned &GroupIdx = RevGroupMap[SignatureSymbol];
1256 GroupIdx = addToSectionTable(Group);
1258 Groups.push_back(Group);
1260 std::vector<const MCSectionELF *> &Members =
1261 GroupMembers[SignatureSymbol];
1262 Members.push_back(&Section);
1264 Members.push_back(RelSection);
1267 SectionIndexMap[&
Section] = addToSectionTable(&Section);
1269 SectionIndexMap[RelSection] = addToSectionTable(RelSection);
1270 Relocations.push_back(RelSection);
1278 uint64_t SecStart = getStream().tell();
1283 for (
const MCSectionELF *Member : GroupMembers[SignatureSymbol]) {
1284 uint32_t SecIndex = SectionIndexMap.lookup(Member);
1288 uint64_t SecEnd = getStream().tell();
1289 SectionOffsets[Group] = std::make_pair(SecStart, SecEnd);
1293 computeSymbolTable(Asm, Layout, SectionIndexMap, RevGroupMap, SectionOffsets);
1299 uint64_t SecStart = getStream().tell();
1303 uint64_t SecEnd = getStream().tell();
1304 SectionOffsets[RelSection] = std::make_pair(SecStart, SecEnd);
1308 uint64_t SecStart = getStream().tell();
1310 uint64_t SecEnd = getStream().tell();
1311 SectionOffsets[Sec] = std::make_pair(SecStart, SecEnd);
1314 uint64_t NaturalAlignment =
is64Bit() ? 8 : 4;
1315 align(NaturalAlignment);
1317 const uint64_t SectionHeaderOffset = getStream().tell();
1320 writeSectionHeader(Layout, SectionIndexMap, SectionOffsets);
1324 : SectionTable.size() + 1;
1327 unsigned NumSectionsOffset;
1330 uint64_t Val = SectionHeaderOffset;
1333 getStream().pwrite(reinterpret_cast<char *>(&Val),
sizeof(Val),
1337 uint32_t Val = SectionHeaderOffset;
1340 getStream().pwrite(reinterpret_cast<char *>(&Val),
sizeof(Val),
1344 getStream().pwrite(reinterpret_cast<char *>(&NumSections),
1345 sizeof(NumSections), NumSectionsOffset);
1348 bool ELFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
1350 bool InSet,
bool IsPCRel)
const {
1351 const auto &SymA = cast<MCSymbolELF>(SA);
1357 return MCObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
1362 const auto &Sym = cast<MCSymbolELF>(S);
1378 const auto &Sec = cast<MCSectionELF>(Sym.
getSection());
1384 bool IsLittleEndian) {
1385 return new ELFObjectWriter(MOTW, OS, IsLittleEndian);
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
bool evaluateKnownAbsolute(int64_t &Res, const MCAsmLayout &Layout) const
Instances of this class represent a uniqued identifier for a section in the current translation unit...
const MCAsmInfo * getAsmInfo() const
StringRef getSectionName() const
void setSymbolAndType(Elf32_Word s, unsigned char t)
MCSectionELF * createELFRelSection(const Twine &Name, unsigned Type, unsigned Flags, unsigned EntrySize, const MCSymbolELF *Group, const MCSectionELF *Associated)
void swapByteOrder(T &Value)
const MCSymbol & getSymbol() const
bool isBindingSet() const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void setAlignment(unsigned Value)
unsigned getFlags() const
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const
Get the offset of the given symbol, as computed in the current layout.
A raw_ostream that writes to an SmallVector or SmallString.
unsigned getEntrySize() const
ELFYAML::ELF_STV Visibility
void setSymbolAndType(Elf64_Word s, Elf64_Word t)
unsigned getELFHeaderEFlags() const
ELF e_header flags.
unsigned getAlignment() const
MCContext & getContext() 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)...
DebugCompressionType compressDebugSections() const
struct fuzzer::@269 Flags
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void renameELFSection(MCSectionELF *Section, StringRef Name)
Encapsulates the layout of an assembly file at a particular point in time.
Base class for the full range of assembler expressions which are needed for parsing.
Status compress(StringRef InputBuffer, SmallVectorImpl< char > &CompressedBuffer, CompressionLevel Level=DefaultCompression)
Represent a reference to a symbol from inside an expression.
static unsigned getRelocType(const MCValue &Target, const MCFixupKind FixupKind, const bool IsPCRel)
Translates generic PPC fixup kind to Mach-O/PPC relocation type enum.
ArrayRef< std::string > getFileNames()
Context object for machine code objects.
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
static const bool IsLittleEndianHost
Utility for building string tables with deduplicated suffixes.
void write32(void *P, uint32_t V)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
const MCSymbolELF * getGroup() const
bool isThumbFunc(const MCSymbol *Func) const
Check whether a given symbol has been flagged with .thumb_func.
void setExternal(bool Value) const
static uint8_t mergeTypeForSet(uint8_t origType, uint8_t newType)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
uint32_t getOffset() const
bool isAbsolute(bool SetUsed=true) const
isAbsolute - Check if this is an absolute symbol.
const MCSymbol * getBaseSymbol(const MCSymbol &Symbol) const
If this symbol is equivalent to A + Constant, return A.
void array_pod_sort(IteratorTy Start, IteratorTy End)
array_pod_sort - This sorts an array with the specified start and end extent.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
void writeSectionData(const MCSection *Section, const MCAsmLayout &Layout) const
Emit the section contents using the given object writer.
The instances of the Type class are immutable: once they are created, they are never changed...
Allocate memory in an ever growing pool, as if by bump-pointer.
static bool is64Bit(const char *name)
uint32_t getIndex() const
Get the (implementation defined) index.
virtual void reset()
lifetime management
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
unsigned getBinding() const
unsigned getCommonAlignment() const
Return the alignment of a 'common' symbol.
void write64(void *P, uint64_t V)
void setFlags(unsigned F)
uint64_t getSectionAddressSize(const MCSection *Sec) const
Get the address space size of the given section, as it effects layout.
void reportError(SMLoc L, const Twine &Msg)
const MCSectionELF * getAssociatedSection() const
bool empty() const
empty - Check if the array is empty.
bool isInSection(bool SetUsed=true) const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
const MCSymbolRefExpr * getSymB() const
void write16(void *P, uint16_t V)
static void write(bool isBE, void *P, T V)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PowerPC TLS Dynamic Call Fixup
static const char *const Magic
static const char ElfMagic[]
const MCSymbolRefExpr * getSymA() const
bool isUsedInReloc() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
MCSymbol * getBeginSymbol()
MCSection * getParent() const
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
Target - Wrapper for Target specific information.
static bool isWeak(const MCSymbolELF &Sym)
const MCExpr * getVariableValue(bool SetUsed=true) const
getVariableValue - Get the value for variable symbols.
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
MCSection & getSection(bool SetUsed=true) const
Get the section associated with a defined, non-absolute symbol.
MCObjectWriter * createELFObjectWriter(MCELFObjectTargetWriter *MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
Construct a new ELF writer instance.
Saves strings in the inheritor's stable storage and returns a StringRef with a stable character point...
StringRef getName() const
getName - Get the symbol name.
pointer data()
Return a pointer to the vector's buffer, even if empty().
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
bool isCommon() const
Is this a 'common' symbol.
This represents a section on linux, lots of unix variants and some bare metal systems.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
uint64_t getFragmentOffset(const MCFragment *F) const
Get the offset of the given fragment inside its containing section.
MCSectionELF * createELFGroupSection(const MCSymbolELF *Group)
bool isVariable() const
isVariable - Check if this is a variable symbol.
An abstract base class for streams implementations that also support a pwrite operation.
VariantKind getKind() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
int64_t getConstant() const
bool operator<(int64_t V1, const APSInt &V2)
MCSectionELF * getELFSection(const Twine &Section, unsigned Type, unsigned Flags)
LLVM Value Representation.
bool isWeakrefUsedInReloc() const
MCAssembler & getAssembler() const
Get the assembler object this is a layout for.
uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align)
Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a mu...
StringRef - Represent a constant reference to a string, i.e.
const MCSymbolELF * Symbol
Represents a location in source code.
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).