35 uintptr_t
Addr =
reinterpret_cast<uintptr_t
>(
Ptr);
38 return reinterpret_cast<const T *
>(
Addr);
42 return reinterpret_cast<uintptr_t
>(
reinterpret_cast<const char *
>(
Base) +
46template <
typename T>
static const T *
viewAs(uintptr_t in) {
47 return reinterpret_cast<const T *
>(in);
58 const T &DerivedXCOFFSectionHeader =
static_cast<const T &
>(*this);
63 const T &DerivedXCOFFSectionHeader =
static_cast<const T &
>(*this);
64 return DerivedXCOFFSectionHeader.Flags & SectionFlagsTypeMask;
69 return getSectionType() & SectionFlagsReservedMask;
72template <
typename AddressType>
77template <
typename AddressType>
82template <
typename AddressType>
95 if (LoaderSecHeader->LengthOfStrTbl >
Offset)
96 return (
reinterpret_cast<const char *
>(LoaderSecHeader) +
97 LoaderSecHeader->OffsetToStrTbl +
Offset);
100 " in the loader section's string table with size 0x" +
128 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
129 return viewAs<XCOFF::SymbolAuxType>(
133void XCOFFObjectFile::checkSectionAddress(uintptr_t
Addr,
134 uintptr_t TableAddress)
const {
135 if (
Addr < TableAddress)
142 if (
Offset % getSectionHeaderSize() != 0)
144 "Section header pointer does not point to a valid section header.");
147const XCOFFSectionHeader32 *
148XCOFFObjectFile::toSection32(DataRefImpl
Ref)
const {
149 assert(!
is64Bit() &&
"32-bit interface called on 64-bit object file.");
151 checkSectionAddress(
Ref.p, getSectionHeaderTableAddress());
153 return viewAs<XCOFFSectionHeader32>(
Ref.p);
156const XCOFFSectionHeader64 *
157XCOFFObjectFile::toSection64(DataRefImpl
Ref)
const {
158 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
160 checkSectionAddress(
Ref.p, getSectionHeaderTableAddress());
162 return viewAs<XCOFFSectionHeader64>(
Ref.p);
166 assert(
Ref.p != 0 &&
"Symbol table pointer can not be nullptr!");
174 assert(!
is64Bit() &&
"32-bit interface called on 64-bit object file.");
179 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
184 assert(!
is64Bit() &&
"32-bit interface called on 64-bit object file.");
189 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
193template <
typename T>
const T *XCOFFObjectFile::sectionHeaderTable()
const {
194 return static_cast<const T *
>(SectionHeaderTable);
197const XCOFFSectionHeader32 *
198XCOFFObjectFile::sectionHeaderTable32()
const {
199 assert(!
is64Bit() &&
"32-bit interface called on 64-bit object file.");
200 return static_cast<const XCOFFSectionHeader32 *
>(SectionHeaderTable);
203const XCOFFSectionHeader64 *
204XCOFFObjectFile::sectionHeaderTable64()
const {
205 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
206 return static_cast<const XCOFFSectionHeader64 *
>(SectionHeaderTable);
215 if (NextSymbolAddr != getEndOfSymbolTableAddress())
218 Symb.
p = NextSymbolAddr;
235 " in a string table with size 0x" +
243 StringTable.
Size <= 4 ? 0 : StringTable.
Size);
271 if (!CsectAuxRefOrError)
275 Result = 1ULL << CsectAuxRefOrError.
get().getAlignmentLog2();
286 if (!CsectAuxRefOrError)
321 if (SymNameOrError) {
323 if (SymNameOrError.
get() ==
"TOC")
329 SecName = XCOFFObjectFile::toSection64(SecDRIOrErr.
get())->getName();
331 SecName = XCOFFObjectFile::toSection32(SecDRIOrErr.
get())->getName();
333 if (SecName == SymNameOrError.
get())
351 if (isReservedSectionNumber(SectNum))
362 const char *
Ptr =
reinterpret_cast<const char *
>(Sec.
p);
363 Sec.
p =
reinterpret_cast<uintptr_t
>(
Ptr + getSectionHeaderSize());
383 return toSection64(Sec) - sectionHeaderTable64() + 1;
385 return toSection32(Sec) - sectionHeaderTable32() + 1;
408 const uint8_t * ContentStart =
base() + OffsetToRaw;
411 Data,
reinterpret_cast<uintptr_t
>(ContentStart), SectionSize))
413 toString(std::move(
E)) +
": section data with offset 0x" +
417 return ArrayRef(ContentStart, SectionSize);
440 uint64_t SectionOffset = getSectionFileOffsetToRawData(DRI);
443 uintptr_t SectionStart =
reinterpret_cast<uintptr_t
>(
base() + SectionOffset);
451#define ECASE(Value, String) \
453 SectionName = String; \
472 " section with offset 0x" +
475 " goes past the end of the file");
512 auto RelocationsOrErr =
513 relocations<XCOFFSectionHeader64, XCOFFRelocation64>(*SectionEntPtr);
514 if (
Error E = RelocationsOrErr.takeError()) {
519 Ret.p =
reinterpret_cast<uintptr_t
>(&*RelocationsOrErr.get().begin());
522 auto RelocationsOrErr =
523 relocations<XCOFFSectionHeader32, XCOFFRelocation32>(*SectionEntPtr);
524 if (
Error E = RelocationsOrErr.takeError()) {
529 Ret.p =
reinterpret_cast<uintptr_t
>(&*RelocationsOrErr.get().begin());
538 auto RelocationsOrErr =
539 relocations<XCOFFSectionHeader64, XCOFFRelocation64>(*SectionEntPtr);
540 if (
Error E = RelocationsOrErr.takeError()) {
545 Ret.p =
reinterpret_cast<uintptr_t
>(&*RelocationsOrErr.get().end());
548 auto RelocationsOrErr =
549 relocations<XCOFFSectionHeader32, XCOFFRelocation32>(*SectionEntPtr);
550 if (
Error E = RelocationsOrErr.takeError()) {
555 Ret.p =
reinterpret_cast<uintptr_t
>(&*RelocationsOrErr.get().end());
562 Rel.
p =
reinterpret_cast<uintptr_t
>(viewAs<XCOFFRelocation64>(Rel.
p) + 1);
564 Rel.
p =
reinterpret_cast<uintptr_t
>(viewAs<XCOFFRelocation32>(Rel.
p) + 1);
577 RelocAddress < Sec64->VirtualAddress + Sec64->
SectionSize) {
591 RelocAddress < Sec32->VirtualAddress + Sec32->
SectionSize) {
622 return viewAs<XCOFFRelocation64>(Rel.
p)->Type;
623 return viewAs<XCOFFRelocation32>(Rel.
p)->Type;
636 Result.append(Res.
begin(), Res.
end());
656 if (CsectAuxEntOrErr) {
681 SymDRI.
p =
reinterpret_cast<uintptr_t
>(SymbolTblPtr);
694 DRI.
p = getSectionHeaderTableAddress();
708 return is64Bit() ?
"aix5coff64-rs6000" :
"aixcoff-rs6000";
733 .
Case(
"dwinfo",
"debug_info")
734 .
Case(
"dwline",
"debug_line")
735 .
Case(
"dwpbnms",
"debug_pubnames")
736 .
Case(
"dwpbtyp",
"debug_pubtypes")
737 .
Case(
"dwarnge",
"debug_aranges")
738 .
Case(
"dwabrev",
"debug_abbrev")
739 .
Case(
"dwstr",
"debug_str")
740 .
Case(
"dwrnges",
"debug_ranges")
741 .
Case(
"dwloc",
"debug_loc")
742 .
Case(
"dwframe",
"debug_frame")
743 .
Case(
"dwmac",
"debug_macinfo")
747size_t XCOFFObjectFile::getFileHeaderSize()
const {
751size_t XCOFFObjectFile::getSectionHeaderSize()
const {
752 return is64Bit() ?
sizeof(XCOFFSectionHeader64) :
753 sizeof(XCOFFSectionHeader32);
763 uintptr_t StartPtr =
reinterpret_cast<uintptr_t
>(Start);
769 " goes past the end of the file");
780 "the section index (" +
Twine(Num) +
785 getSectionHeaderSize() * (Num - 1));
792 auto GetSectionAddr = [&](
const auto &Sections) -> uintptr_t {
793 for (
const auto &Sec : Sections)
794 if (Sec.getSectionType() == SectType)
795 return reinterpret_cast<uintptr_t
>(&Sec);
809 switch (SectionNum) {
820 getSectionNameInternal(SecRef.
get()));
830bool XCOFFObjectFile::isReservedSectionNumber(int16_t SectionNumber) {
831 return (SectionNumber <= 0 && SectionNumber >= -2);
878uintptr_t XCOFFObjectFile::getEndOfSymbolTableAddress()
const {
880 return getWithOffset(
reinterpret_cast<uintptr_t
>(SymbolTblPtr),
885 if (SymbolEntPtr <
reinterpret_cast<uintptr_t
>(SymbolTblPtr))
888 if (SymbolEntPtr >= getEndOfSymbolTableAddress())
892 reinterpret_cast<const char *
>(SymbolTblPtr);
896 "Symbol table entry position is not valid inside of symbol table.");
900 return (
reinterpret_cast<const char *
>(SymbolEntPtr) -
901 reinterpret_cast<const char *
>(SymbolTblPtr)) /
911 if (!CsectAuxRefOrError)
933 if (
Index >= NumberOfSymTableEntries)
935 " exceeds symbol count " +
936 Twine(NumberOfSymTableEntries));
947const char *XCOFFObjectFile::getSectionNameInternal(
DataRefImpl Sec)
const {
951uintptr_t XCOFFObjectFile::getSectionHeaderTableAddress()
const {
952 return reinterpret_cast<uintptr_t
>(SectionHeaderTable);
965 assert(
is64Bit() &&
"64-bit interface called for non 64-bit file.");
972 assert(!
is64Bit() &&
"32-bit interface called for non 32-bit file.");
985 const T &Section =
static_cast<const T &
>(Sec);
987 return Section.NumberOfRelocations;
989 uint16_t SectionIndex = &Section - sectionHeaderTable<T>() + 1;
991 return Section.NumberOfRelocations;
994 Sec.NumberOfRelocations == SectionIndex)
995 return Sec.PhysicalAddress;
1000template <
typename Shdr,
typename Reloc>
1002 uintptr_t RelocAddr =
getWithOffset(
reinterpret_cast<uintptr_t
>(FileHeader),
1003 Sec.FileOffsetToRelocationInfo);
1005 if (
Error E = NumRelocEntriesOrErr.takeError())
1006 return std::move(
E);
1008 uint32_t NumRelocEntries = NumRelocEntriesOrErr.get();
1011 "Relocation structure is incorrect");
1012 auto RelocationOrErr =
1013 getObject<Reloc>(
Data,
reinterpret_cast<void *
>(RelocAddr),
1014 NumRelocEntries *
sizeof(Reloc));
1015 if (!RelocationOrErr)
1017 toString(RelocationOrErr.takeError()) +
": relocations with offset 0x" +
1020 " go past the end of the file");
1022 const Reloc *StartReloc = RelocationOrErr.get();
1027template <
typename ExceptEnt>
1034 if (!ExceptionSectOrErr)
1041 ExceptEnt *ExceptEntStart =
1042 reinterpret_cast<ExceptEnt *
>(*ExceptionSectOrErr);
1044 ExceptEntStart, ExceptEntStart +
getSectionSize(DRI) /
sizeof(ExceptEnt));
1057 Obj->
Data,
reinterpret_cast<uintptr_t
>(Obj->
base() +
Offset), 4)) {
1068 return XCOFFStringTable{4,
nullptr};
1070 auto StringTableOrErr =
1072 if (!StringTableOrErr)
1074 ": string table with offset 0x" +
1077 " goes past the end of the file");
1079 const char *StringTablePtr = StringTableOrErr.get();
1080 if (StringTablePtr[
Size - 1] !=
'\0')
1083 return XCOFFStringTable{
Size, StringTablePtr};
1091 if (!LoaderSectionAddrOrError)
1092 return LoaderSectionAddrOrError.
takeError();
1094 uintptr_t LoaderSectionAddr = LoaderSectionAddrOrError.
get();
1095 if (!LoaderSectionAddr)
1098 uint64_t OffsetToImportFileTable = 0;
1099 uint64_t LengthOfImportFileTable = 0;
1102 viewAs<LoaderSectionHeader64>(LoaderSectionAddr);
1107 viewAs<LoaderSectionHeader32>(LoaderSectionAddr);
1112 auto ImportTableOrErr = getObject<char>(
1114 reinterpret_cast<void *
>(LoaderSectionAddr + OffsetToImportFileTable),
1115 LengthOfImportFileTable);
1116 if (!ImportTableOrErr)
1118 toString(ImportTableOrErr.takeError()) +
1119 ": import file table with offset 0x" +
1122 " goes past the end of the file");
1124 const char *ImportTablePtr = ImportTableOrErr.get();
1125 if (ImportTablePtr[LengthOfImportFileTable - 1] !=
'\0')
1127 ": import file name table with offset 0x" +
1130 " must end with a null terminator");
1132 return StringRef(ImportTablePtr, LengthOfImportFileTable);
1138 std::unique_ptr<XCOFFObjectFile> Obj;
1142 const auto *
Base = Obj->base();
1146 auto FileHeaderOrErr =
1147 getObject<void>(
Data,
Base + CurOffset, Obj->getFileHeaderSize());
1148 if (
Error E = FileHeaderOrErr.takeError())
1149 return std::move(
E);
1150 Obj->FileHeader = FileHeaderOrErr.get();
1152 CurOffset += Obj->getFileHeaderSize();
1154 if (Obj->getOptionalHeaderSize()) {
1155 auto AuxiliaryHeaderOrErr =
1156 getObject<void>(
Data,
Base + CurOffset, Obj->getOptionalHeaderSize());
1157 if (
Error E = AuxiliaryHeaderOrErr.takeError())
1158 return std::move(
E);
1159 Obj->AuxiliaryHeader = AuxiliaryHeaderOrErr.get();
1162 CurOffset += Obj->getOptionalHeaderSize();
1165 if (Obj->getNumberOfSections()) {
1167 Obj->getNumberOfSections() * Obj->getSectionHeaderSize();
1168 auto SecHeadersOrErr =
1169 getObject<void>(
Data,
Base + CurOffset, SectionHeadersSize);
1170 if (!SecHeadersOrErr)
1172 ": section headers with offset 0x" +
1175 " go past the end of the file");
1177 Obj->SectionHeaderTable = SecHeadersOrErr.get();
1180 const uint32_t NumberOfSymbolTableEntries =
1181 Obj->getNumberOfSymbolTableEntries();
1184 if (NumberOfSymbolTableEntries == 0)
1185 return std::move(Obj);
1188 CurOffset = Obj->is64Bit() ? Obj->getSymbolTableOffset64()
1189 : Obj->getSymbolTableOffset32();
1192 NumberOfSymbolTableEntries;
1193 auto SymTableOrErr =
1194 getObject<void *>(
Data,
Base + CurOffset, SymbolTableSize);
1197 toString(SymTableOrErr.takeError()) +
": symbol table with offset 0x" +
1201 Obj->SymbolTblPtr = SymTableOrErr.get();
1202 CurOffset += SymbolTableSize;
1205 Expected<XCOFFStringTable> StringTableOrErr =
1206 parseStringTable(Obj.get(), CurOffset);
1207 if (Error
E = StringTableOrErr.takeError())
1208 return std::move(
E);
1209 Obj->StringTable = StringTableOrErr.get();
1211 return std::move(Obj);
1214Expected<std::unique_ptr<ObjectFile>>
1216 unsigned FileType) {
1217 return XCOFFObjectFile::create(FileType, MemBufRef);
1228 if (!ExpCsectAuxEnt) {
1266 "Calling csect symbol interface with a non-csect symbol.");
1272 return std::move(Err);
1275 if (!NumberOfAuxEntries) {
1276 return createError(
"csect symbol \"" + *NameOrErr +
"\" with index " +
1277 Twine(SymbolIdx) +
" contains no auxiliary entry");
1280 if (!OwningObjectPtr->
is64Bit()) {
1303 "a csect auxiliary entry has not been found for symbol \"" + *NameOrErr +
1304 "\" with index " +
Twine(SymbolIdx));
1311 return StringRef(
"Unimplemented Debug Name");
1340 if (Bytes.
size() < 4)
1346#define GETVALUEWITHMASK(X) (Data & (TracebackTable::X))
1347#define GETVALUEWITHMASKSHIFT(X, S) \
1348 ((Data & (TracebackTable::X)) >> (TracebackTable::S))
1354 return std::move(Err);
1359 const uint8_t *
Ptr =
reinterpret_cast<const uint8_t *
>(TBvectorStrRef.
data());
1368 if (!VecParmsTypeOrError)
1371 VecParmsInfo = VecParmsTypeOrError.
get();
1388 NumberOfVectorParmsShift);
1394#undef GETVALUEWITHMASK
1395#undef GETVALUEWITHMASKSHIFT
1402 return std::move(Err);
1406XCOFFTracebackTable::XCOFFTracebackTable(
const uint8_t *
Ptr,
uint64_t &
Size,
1422 if (Cur && (FixedParmsNum + FloatingParmsNum) > 0)
1423 ParamsTypeValue = DE.getU32(Cur);
1426 TraceBackTableOffset = DE.getU32(Cur);
1429 HandlerMask = DE.getU32(Cur);
1432 NumOfCtlAnchors = DE.getU32(Cur);
1433 if (Cur && NumOfCtlAnchors) {
1435 Disp.
reserve(*NumOfCtlAnchors);
1436 for (
uint32_t I = 0;
I < NumOfCtlAnchors && Cur; ++
I)
1439 ControlledStorageInfoDisp = std::move(Disp);
1444 uint16_t FunctionNameLen = DE.getU16(Cur);
1446 FunctionName = DE.getBytes(Cur, FunctionNameLen);
1450 AllocaRegister = DE.getU8(Cur);
1452 unsigned VectorParmsNum = 0;
1454 StringRef VectorExtRef = DE.getBytes(Cur, 6);
1457 if (!TBVecExtOrErr) {
1458 Err = TBVecExtOrErr.takeError();
1461 VecExt = TBVecExtOrErr.get();
1462 VectorParmsNum = VecExt->getNumberOfVectorParms();
1469 if (Cur && (FixedParmsNum + FloatingParmsNum) > 0) {
1470 Expected<SmallString<32>> ParmsTypeOrError =
1473 FloatingParmsNum, VectorParmsNum)
1474 :
parseParmsType(ParamsTypeValue, FixedParmsNum, FloatingParmsNum);
1476 if (!ParmsTypeOrError) {
1477 Err = ParmsTypeOrError.takeError();
1480 ParmsType = ParmsTypeOrError.get();
1484 ExtensionTable = DE.getU8(Cur);
1487 Err = Cur.takeError();
1492#define GETBITWITHMASK(P, X) \
1493 (support::endian::read32be(TBPtr + (P)) & (TracebackTable::X))
1494#define GETBITWITHMASKSHIFT(P, X, S) \
1495 ((support::endian::read32be(TBPtr + (P)) & (TracebackTable::X)) >> \
1496 (TracebackTable::S))
1535 return GETBITWITHMASK(0, IsFloatingPointOperationLogOrAbortEnabledMask);
1552 OnConditionDirectiveShift);
1589 NumberOfFixedParmsShift);
1594 NumberOfFloatingPointParmsShift);
1601#undef GETBITWITHMASK
1602#undef GETBITWITHMASKSHIFT
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Analysis containing CSE Info
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
#define GETVALUEWITHMASKSHIFT(X, S)
#define GETVALUEWITHMASK(X)
#define GETBITWITHMASKSHIFT(P, X, S)
#define GETBITWITHMASK(P, X)
#define ECASE(Value, String)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Helper for Errors used as out-parameters.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
reference get()
Returns a reference to the stored T value.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Manages the enabling and disabling of subtarget specific features.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static Twine utohexstr(const uint64_t &Val)
void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
The instances of the Type class are immutable: once they are created, they are never changed.
unsigned int getType() const
static Error checkOffset(MemoryBufferRef M, uintptr_t Addr, const uint64_t Size)
This class is the base class for all object file types.
friend class RelocationRef
const uint8_t * base() const
static Expected< std::unique_ptr< ObjectFile > > createXCOFFObjectFile(MemoryBufferRef Object, unsigned FileType)
This is a value type class that represents a single symbol in the list of symbols in the object file.
uint8_t getNumberOfVectorParms() const
static Expected< TBVectorExt > create(StringRef TBvectorStrRef)
bool isVRSavedOnStack() const
uint8_t getNumberOfVRSaved() const
bool hasVMXInstruction() const
XCOFF::StorageMappingClass getStorageMappingClass() const
uint8_t getSymbolType() const
uint64_t getSectionOrLength() const
Expected< DataRefImpl > getSectionByNum(int16_t Num) const
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
const void * getPointerToSymbolTable() const
section_iterator section_begin() const override
uint32_t getSymbolIndex(uintptr_t SymEntPtr) const
relocation_iterator section_rel_end(DataRefImpl Sec) const override
Expected< StringRef > getCFileName(const XCOFFFileAuxEnt *CFileEntPtr) const
uintptr_t getSymbolEntryAddressByIndex(uint32_t SymbolTableIndex) const
bool isDebugSection(DataRefImpl Sec) const override
const XCOFFAuxiliaryHeader32 * auxiliaryHeader32() const
ArrayRef< XCOFFSectionHeader32 > sections32() const
void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const override
const XCOFFFileHeader64 * fileHeader64() const
ArrayRef< XCOFFSectionHeader64 > sections64() const
Expected< uint64_t > getStartAddress() const override
Expected< uint32_t > getSymbolFlags(DataRefImpl Symb) const override
uint32_t getSymbolTableOffset32() const
bool isSectionVirtual(DataRefImpl Sec) const override
bool isSectionBSS(DataRefImpl Sec) const override
Expected< StringRef > getSectionName(DataRefImpl Sec) const override
uint32_t getNumberOfSymbolTableEntries() const
bool isSectionData(DataRefImpl Sec) const override
uint64_t getRelocationOffset(DataRefImpl Rel) const override
uint64_t getSectionSize(DataRefImpl Sec) const override
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
int32_t getSectionFlags(DataRefImpl Sec) const
Expected< StringRef > getSymbolName(DataRefImpl Symb) const override
const XCOFFFileHeader32 * fileHeader32() const
int32_t getRawNumberOfSymbolTableEntries32() const
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
uint32_t getNumberOfSymbolTableEntries64() const
const XCOFFAuxiliaryHeader64 * auxiliaryHeader64() const
uint16_t getOptionalHeaderSize() const
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
XCOFFSymbolRef toSymbolRef(DataRefImpl Ref) const
basic_symbol_iterator symbol_begin() const override
Expected< StringRef > getSymbolNameByIndex(uint32_t SymbolTableIndex) const
unsigned getSymbolSectionID(SymbolRef Sym) const
uint64_t getSymbolTableOffset64() const
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override
uint16_t getNumberOfSections() const
void moveRelocationNext(DataRefImpl &Rel) const override
Expected< StringRef > getImportFileTable() const
StringRef getFileFormatName() const override
Expected< uint32_t > getNumberOfRelocationEntries(const XCOFFSectionHeader< T > &Sec) const
bool isSectionCompressed(DataRefImpl Sec) const override
Expected< StringRef > getSymbolSectionName(XCOFFSymbolRef Ref) const
Expected< StringRef > getStringTableEntry(uint32_t Offset) const
static constexpr uint64_t InvalidRelocOffset
uint64_t getSectionAddress(DataRefImpl Sec) const override
Expected< ArrayRef< uint8_t > > getSectionContents(DataRefImpl Sec) const override
Expected< ArrayRef< ExceptEnt > > getExceptionEntries() const
Expected< SubtargetFeatures > getFeatures() const override
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
uint16_t getMagic() const
uint64_t getSectionAlignment(DataRefImpl Sec) const override
void checkSymbolEntryPointer(uintptr_t SymbolEntPtr) const
StringRef mapDebugSectionName(StringRef Name) const override
Maps a debug section name to a standard DWARF section name.
basic_symbol_iterator symbol_end() const override
static uintptr_t getAdvancedSymbolEntryAddress(uintptr_t CurrentAddress, uint32_t Distance)
bool is64Bit() const override
const XCOFF::SymbolAuxType * getSymbolAuxType(uintptr_t AuxEntryAddress) const
Triple::ArchType getArch() const override
uint64_t getRelocationType(DataRefImpl Rel) const override
bool isSectionText(DataRefImpl Sec) const override
Expected< StringRef > getRawData(const char *Start, uint64_t Size, StringRef Name) const
uint16_t getFlags() const
uint64_t getSymbolSize(DataRefImpl Symb) const
int32_t getTimeStamp() const
void moveSymbolNext(DataRefImpl &Symb) const override
Expected< ArrayRef< Reloc > > relocations(const Shdr &Sec) const
uint64_t getSectionIndex(DataRefImpl Sec) const override
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
void moveSectionNext(DataRefImpl &Sec) const override
Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const override
section_iterator section_end() const override
uint32_t getLogicalNumberOfSymbolTableEntries32() const
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
StringRef getStringTable() const
Expected< XCOFFCsectAuxRef > getXCOFFCsectAuxRef() const
int16_t getSectionNumber() const
bool isCsectSymbol() const
uint16_t getSymbolType() const
uint64_t getValue() const
Expected< StringRef > getName() const
uint8_t getNumberOfAuxEntries() const
uintptr_t getEntryAddress() const
XCOFF::StorageClass getStorageClass() const
This class provides methods to extract traceback table data from a buffer.
bool isOutOfLineEpilogOrPrologue() const
uint8_t getNumOfGPRsSaved() const
bool hasTraceBackTableOffset() const
bool hasParmsOnStack() const
bool hasExtensionTable() const
uint8_t getOnConditionDirective() const
uint8_t getLanguageID() const
uint8_t getNumOfFPRsSaved() const
bool isFloatingPointOperationLogOrAbortEnabled() const
uint8_t getNumberOfFPParms() const
bool isFuncNamePresent() const
static Expected< XCOFFTracebackTable > create(const uint8_t *Ptr, uint64_t &Size)
Parse an XCOFF Traceback Table from Ptr with Size bytes.
bool isAllocaUsed() const
bool isGlobalLinkage() const
bool isInternalProcedure() const
bool hasControlledStorage() const
bool isInterruptHandler() const
bool isFloatingPointPresent() const
uint8_t getVersion() const
bool isBackChainStored() const
uint8_t getNumberOfFixedParms() const
bool hasVectorInfo() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static constexpr uint8_t XR_BIASED_LENGTH_MASK
constexpr size_t RelocationSerializationSize32
static constexpr uint8_t XR_FIXUP_INDICATOR_MASK
constexpr uint16_t VISIBILITY_MASK
Expected< SmallString< 32 > > parseParmsTypeWithVecInfo(uint32_t Value, unsigned FixedParmsNum, unsigned FloatingParmsNum, unsigned VectorParmsNum)
static constexpr uint8_t XR_SIGN_INDICATOR_MASK
StringRef getRelocationTypeString(XCOFF::RelocationType Type)
Expected< SmallString< 32 > > parseParmsType(uint32_t Value, unsigned FixedParmsNum, unsigned FloatingParmsNum)
constexpr size_t RelocationSerializationSize64
Expected< SmallString< 32 > > parseVectorParmsType(uint32_t Value, unsigned ParmsNum)
@ AUX_CSECT
Identifies a csect auxiliary entry.
constexpr size_t NameSize
constexpr uint16_t RelocOverflow
constexpr size_t SymbolTableEntrySize
@ XTY_CM
Common csect definition. For uninitialized storage.
@ XTY_SD
Csect definition for initialized storage.
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
static Expected< const T * > getObject(MemoryBufferRef M, const void *Ptr, const uint64_t Size=sizeof(T))
bool doesXCOFFTracebackTableBegin(ArrayRef< uint8_t > Bytes)
Error createError(const Twine &Err)
Expected< StringRef > getLoaderSecSymNameInStrTbl(const T *LoaderSecHeader, uint64_t Offset)
static const size_t SymbolAuxTypeOffset
static const uint16_t NoRelMask
@ string_table_non_null_end
content_iterator< SectionRef > section_iterator
static const uint8_t FunctionSym
content_iterator< RelocationRef > relocation_iterator
content_iterator< BasicSymbolRef > basic_symbol_iterator
static uintptr_t getWithOffset(uintptr_t Base, ptrdiff_t Offset)
static StringRef generateXCOFFFixedNameStringRef(const char *Name)
static const T * viewAs(uintptr_t in)
uint32_t read32be(const void *P)
uint16_t read16be(const void *P)
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
@ Ref
The access may reference the value stored in memory.
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
void consumeError(Error Err)
Consume a Error without doing anything.
support::big32_t IsNameInStrTbl
Expected< StringRef > getSymbolName(const LoaderSectionHeader32 *LoaderSecHeader) const
char SymbolName[XCOFF::NameSize]
Expected< StringRef > getSymbolName(const LoaderSectionHeader64 *LoaderSecHeader) const
NameInStrTblType NameInStrTbl
char Name[XCOFF::NameSize+XCOFF::FileNamePadSize]
XCOFF::RelocationType Type
AddressType VirtualAddress
bool isFixupIndicated() const
support::ubig32_t SymbolIndex
uint8_t getRelocatedLength() const
bool isRelocationSigned() const
NameInStrTblType NameInStrTbl
char SymbolName[XCOFF::NameSize]