36 uintptr_t
Addr =
reinterpret_cast<uintptr_t
>(
Ptr);
39 return reinterpret_cast<const T *
>(
Addr);
43 return reinterpret_cast<uintptr_t
>(
reinterpret_cast<const char *
>(
Base) +
47template <
typename T>
static const T *
viewAs(uintptr_t in) {
48 return reinterpret_cast<const T *
>(in);
59 const T &DerivedXCOFFSectionHeader =
static_cast<const T &
>(*this);
64 const T &DerivedXCOFFSectionHeader =
static_cast<const T &
>(*this);
65 return DerivedXCOFFSectionHeader.Flags & SectionFlagsTypeMask;
70 const T &DerivedXCOFFSectionHeader =
static_cast<const T &
>(*this);
71 return DerivedXCOFFSectionHeader.Flags & ~SectionFlagsTypeMask;
76 return getSectionType() & SectionFlagsReservedMask;
79template <
typename AddressType>
84template <
typename AddressType>
89template <
typename AddressType>
102 if (LoaderSecHeader->LengthOfStrTbl >
Offset)
103 return (
reinterpret_cast<const char *
>(LoaderSecHeader) +
104 LoaderSecHeader->OffsetToStrTbl +
Offset);
107 " in the loader section's string table with size 0x" +
135 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
136 return viewAs<XCOFF::SymbolAuxType>(
140void XCOFFObjectFile::checkSectionAddress(uintptr_t
Addr,
141 uintptr_t TableAddress)
const {
142 if (
Addr < TableAddress)
149 if (
Offset % getSectionHeaderSize() != 0)
151 "Section header pointer does not point to a valid section header.");
154const XCOFFSectionHeader32 *
155XCOFFObjectFile::toSection32(DataRefImpl
Ref)
const {
156 assert(!
is64Bit() &&
"32-bit interface called on 64-bit object file.");
158 checkSectionAddress(
Ref.p, getSectionHeaderTableAddress());
160 return viewAs<XCOFFSectionHeader32>(
Ref.p);
163const XCOFFSectionHeader64 *
164XCOFFObjectFile::toSection64(DataRefImpl
Ref)
const {
165 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
167 checkSectionAddress(
Ref.p, getSectionHeaderTableAddress());
169 return viewAs<XCOFFSectionHeader64>(
Ref.p);
173 assert(
Ref.p != 0 &&
"Symbol table pointer can not be nullptr!");
181 assert(!
is64Bit() &&
"32-bit interface called on 64-bit object file.");
186 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
191 assert(!
is64Bit() &&
"32-bit interface called on 64-bit object file.");
196 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
200template <
typename T>
const T *XCOFFObjectFile::sectionHeaderTable()
const {
201 return static_cast<const T *
>(SectionHeaderTable);
204const XCOFFSectionHeader32 *
205XCOFFObjectFile::sectionHeaderTable32()
const {
206 assert(!
is64Bit() &&
"32-bit interface called on 64-bit object file.");
207 return static_cast<const XCOFFSectionHeader32 *
>(SectionHeaderTable);
210const XCOFFSectionHeader64 *
211XCOFFObjectFile::sectionHeaderTable64()
const {
212 assert(
is64Bit() &&
"64-bit interface called on a 32-bit object file.");
213 return static_cast<const XCOFFSectionHeader64 *
>(SectionHeaderTable);
222 if (NextSymbolAddr != getEndOfSymbolTableAddress())
225 Symb.
p = NextSymbolAddr;
242 " in a string table with size 0x" +
278 if (!CsectAuxRefOrError)
282 Result = 1ULL << CsectAuxRefOrError.
get().getAlignmentLog2();
293 if (!CsectAuxRefOrError)
311 return IsFunction.takeError();
332 if (SymNameOrError) {
334 if (SymNameOrError.
get() ==
"TOC")
340 SecName = XCOFFObjectFile::toSection64(SecDRIOrErr.
get())->getName();
342 SecName = XCOFFObjectFile::toSection32(SecDRIOrErr.
get())->getName();
344 if (SecName == SymNameOrError.
get())
362 if (isReservedSectionNumber(SectNum))
373 const char *
Ptr =
reinterpret_cast<const char *
>(Sec.
p);
374 Sec.
p =
reinterpret_cast<uintptr_t
>(
Ptr + getSectionHeaderSize());
394 return toSection64(Sec) - sectionHeaderTable64() + 1;
396 return toSection32(Sec) - sectionHeaderTable32() + 1;
419 const uint8_t * ContentStart =
base() + OffsetToRaw;
422 Data,
reinterpret_cast<uintptr_t
>(ContentStart), SectionSize))
424 toString(std::move(
E)) +
": section data with offset 0x" +
428 return ArrayRef(ContentStart, SectionSize);
455 uint64_t SectionOffset = getSectionFileOffsetToRawData(DRI);
458 uintptr_t SectionStart =
reinterpret_cast<uintptr_t
>(
base() + SectionOffset);
466#define ECASE(Value, String) \
468 SectionName = String; \
487 " section with offset 0x" +
490 " goes past the end of the file");
527 auto RelocationsOrErr =
528 relocations<XCOFFSectionHeader64, XCOFFRelocation64>(*SectionEntPtr);
529 if (
Error E = RelocationsOrErr.takeError()) {
534 Ret.p =
reinterpret_cast<uintptr_t
>(&*RelocationsOrErr.get().begin());
537 auto RelocationsOrErr =
538 relocations<XCOFFSectionHeader32, XCOFFRelocation32>(*SectionEntPtr);
539 if (
Error E = RelocationsOrErr.takeError()) {
544 Ret.p =
reinterpret_cast<uintptr_t
>(&*RelocationsOrErr.get().begin());
553 auto RelocationsOrErr =
554 relocations<XCOFFSectionHeader64, XCOFFRelocation64>(*SectionEntPtr);
555 if (
Error E = RelocationsOrErr.takeError()) {
560 Ret.p =
reinterpret_cast<uintptr_t
>(&*RelocationsOrErr.get().end());
563 auto RelocationsOrErr =
564 relocations<XCOFFSectionHeader32, XCOFFRelocation32>(*SectionEntPtr);
565 if (
Error E = RelocationsOrErr.takeError()) {
570 Ret.p =
reinterpret_cast<uintptr_t
>(&*RelocationsOrErr.get().end());
577 Rel.
p =
reinterpret_cast<uintptr_t
>(viewAs<XCOFFRelocation64>(Rel.
p) + 1);
579 Rel.
p =
reinterpret_cast<uintptr_t
>(viewAs<XCOFFRelocation32>(Rel.
p) + 1);
592 RelocAddress < Sec64->VirtualAddress + Sec64->
SectionSize) {
606 RelocAddress < Sec32->VirtualAddress + Sec32->
SectionSize) {
637 return viewAs<XCOFFRelocation64>(Rel.
p)->Type;
638 return viewAs<XCOFFRelocation32>(Rel.
p)->Type;
651 Result.append(Res.
begin(), Res.
end());
671 if (CsectAuxEntOrErr) {
696 SymDRI.
p =
reinterpret_cast<uintptr_t
>(SymbolTblPtr);
713 DRI.
p = getSectionHeaderTableAddress();
727 return is64Bit() ?
"aix5coff64-rs6000" :
"aixcoff-rs6000";
745 if (AuxiliaryHeader ==
nullptr)
754 .
Case(
"dwinfo",
"debug_info")
755 .
Case(
"dwline",
"debug_line")
756 .
Case(
"dwpbnms",
"debug_pubnames")
757 .
Case(
"dwpbtyp",
"debug_pubtypes")
758 .
Case(
"dwarnge",
"debug_aranges")
759 .
Case(
"dwabrev",
"debug_abbrev")
760 .
Case(
"dwstr",
"debug_str")
761 .
Case(
"dwrnges",
"debug_ranges")
762 .
Case(
"dwloc",
"debug_loc")
763 .
Case(
"dwframe",
"debug_frame")
764 .
Case(
"dwmac",
"debug_macinfo")
768size_t XCOFFObjectFile::getFileHeaderSize()
const {
772size_t XCOFFObjectFile::getSectionHeaderSize()
const {
773 return is64Bit() ?
sizeof(XCOFFSectionHeader64) :
774 sizeof(XCOFFSectionHeader32);
784 uintptr_t StartPtr =
reinterpret_cast<uintptr_t
>(Start);
790 " goes past the end of the file");
801 "the section index (" +
Twine(Num) +
806 getSectionHeaderSize() * (Num - 1));
813 auto GetSectionAddr = [&](
const auto &Sections) -> uintptr_t {
814 for (
const auto &Sec : Sections)
815 if (Sec.getSectionType() == SectType)
816 return reinterpret_cast<uintptr_t
>(&Sec);
830 switch (SectionNum) {
841 getSectionNameInternal(SecRef.
get()));
851bool XCOFFObjectFile::isReservedSectionNumber(int16_t SectionNumber) {
852 return (SectionNumber <= 0 && SectionNumber >= -2);
899uintptr_t XCOFFObjectFile::getEndOfSymbolTableAddress()
const {
901 return getWithOffset(
reinterpret_cast<uintptr_t
>(SymbolTblPtr),
906 if (SymbolEntPtr <
reinterpret_cast<uintptr_t
>(SymbolTblPtr))
909 if (SymbolEntPtr >= getEndOfSymbolTableAddress())
913 reinterpret_cast<const char *
>(SymbolTblPtr);
917 "Symbol table entry position is not valid inside of symbol table.");
921 return (
reinterpret_cast<const char *
>(SymbolEntPtr) -
922 reinterpret_cast<const char *
>(SymbolTblPtr)) /
932 if (!CsectAuxRefOrError)
954 if (
Index >= NumberOfSymTableEntries)
956 " exceeds symbol count " +
957 Twine(NumberOfSymTableEntries));
968const char *XCOFFObjectFile::getSectionNameInternal(
DataRefImpl Sec)
const {
972uintptr_t XCOFFObjectFile::getSectionHeaderTableAddress()
const {
973 return reinterpret_cast<uintptr_t
>(SectionHeaderTable);
986 assert(
is64Bit() &&
"64-bit interface called for non 64-bit file.");
993 assert(!
is64Bit() &&
"32-bit interface called for non 32-bit file.");
1003template <
typename T>
1006 const T &Section =
static_cast<const T &
>(Sec);
1008 return Section.NumberOfRelocations;
1010 uint16_t SectionIndex = &Section - sectionHeaderTable<T>() + 1;
1012 return Section.NumberOfRelocations;
1015 Sec.NumberOfRelocations == SectionIndex)
1016 return Sec.PhysicalAddress;
1021template <
typename Shdr,
typename Reloc>
1023 uintptr_t RelocAddr =
getWithOffset(
reinterpret_cast<uintptr_t
>(FileHeader),
1024 Sec.FileOffsetToRelocationInfo);
1026 if (
Error E = NumRelocEntriesOrErr.takeError())
1027 return std::move(
E);
1029 uint32_t NumRelocEntries = NumRelocEntriesOrErr.get();
1032 "Relocation structure is incorrect");
1033 auto RelocationOrErr =
1034 getObject<Reloc>(
Data,
reinterpret_cast<void *
>(RelocAddr),
1035 NumRelocEntries *
sizeof(Reloc));
1036 if (!RelocationOrErr)
1038 toString(RelocationOrErr.takeError()) +
": relocations with offset 0x" +
1041 " go past the end of the file");
1043 const Reloc *StartReloc = RelocationOrErr.get();
1048template <
typename ExceptEnt>
1055 if (!ExceptionSectOrErr)
1062 ExceptEnt *ExceptEntStart =
1063 reinterpret_cast<ExceptEnt *
>(*ExceptionSectOrErr);
1065 ExceptEntStart, ExceptEntStart +
getSectionSize(DRI) /
sizeof(ExceptEnt));
1078 Obj->
Data,
reinterpret_cast<uintptr_t
>(Obj->
base() +
Offset), 4)) {
1089 return XCOFFStringTable{4,
nullptr};
1091 auto StringTableOrErr =
1093 if (!StringTableOrErr)
1095 ": string table with offset 0x" +
1098 " goes past the end of the file");
1100 const char *StringTablePtr = StringTableOrErr.get();
1101 if (StringTablePtr[
Size - 1] !=
'\0')
1104 return XCOFFStringTable{
Size, StringTablePtr};
1112 if (!LoaderSectionAddrOrError)
1113 return LoaderSectionAddrOrError.
takeError();
1115 uintptr_t LoaderSectionAddr = LoaderSectionAddrOrError.
get();
1116 if (!LoaderSectionAddr)
1119 uint64_t OffsetToImportFileTable = 0;
1120 uint64_t LengthOfImportFileTable = 0;
1123 viewAs<LoaderSectionHeader64>(LoaderSectionAddr);
1128 viewAs<LoaderSectionHeader32>(LoaderSectionAddr);
1133 auto ImportTableOrErr = getObject<char>(
1135 reinterpret_cast<void *
>(LoaderSectionAddr + OffsetToImportFileTable),
1136 LengthOfImportFileTable);
1137 if (!ImportTableOrErr)
1139 toString(ImportTableOrErr.takeError()) +
1140 ": import file table with offset 0x" +
1143 " goes past the end of the file");
1145 const char *ImportTablePtr = ImportTableOrErr.get();
1146 if (ImportTablePtr[LengthOfImportFileTable - 1] !=
'\0')
1148 ": import file name table with offset 0x" +
1151 " must end with a null terminator");
1153 return StringRef(ImportTablePtr, LengthOfImportFileTable);
1159 std::unique_ptr<XCOFFObjectFile> Obj;
1163 const auto *
Base = Obj->base();
1167 auto FileHeaderOrErr =
1168 getObject<void>(
Data,
Base + CurOffset, Obj->getFileHeaderSize());
1169 if (
Error E = FileHeaderOrErr.takeError())
1170 return std::move(
E);
1171 Obj->FileHeader = FileHeaderOrErr.get();
1173 CurOffset += Obj->getFileHeaderSize();
1175 if (Obj->getOptionalHeaderSize()) {
1176 auto AuxiliaryHeaderOrErr =
1177 getObject<void>(
Data,
Base + CurOffset, Obj->getOptionalHeaderSize());
1178 if (
Error E = AuxiliaryHeaderOrErr.takeError())
1179 return std::move(
E);
1180 Obj->AuxiliaryHeader = AuxiliaryHeaderOrErr.get();
1183 CurOffset += Obj->getOptionalHeaderSize();
1186 if (Obj->getNumberOfSections()) {
1188 Obj->getNumberOfSections() * Obj->getSectionHeaderSize();
1189 auto SecHeadersOrErr =
1190 getObject<void>(
Data,
Base + CurOffset, SectionHeadersSize);
1191 if (!SecHeadersOrErr)
1193 ": section headers with offset 0x" +
1196 " go past the end of the file");
1198 Obj->SectionHeaderTable = SecHeadersOrErr.get();
1201 const uint32_t NumberOfSymbolTableEntries =
1202 Obj->getNumberOfSymbolTableEntries();
1205 if (NumberOfSymbolTableEntries == 0)
1206 return std::move(Obj);
1209 CurOffset = Obj->is64Bit() ? Obj->getSymbolTableOffset64()
1210 : Obj->getSymbolTableOffset32();
1213 NumberOfSymbolTableEntries;
1214 auto SymTableOrErr =
1215 getObject<void *>(
Data,
Base + CurOffset, SymbolTableSize);
1218 toString(SymTableOrErr.takeError()) +
": symbol table with offset 0x" +
1222 Obj->SymbolTblPtr = SymTableOrErr.get();
1223 CurOffset += SymbolTableSize;
1226 Expected<XCOFFStringTable> StringTableOrErr =
1227 parseStringTable(Obj.get(), CurOffset);
1228 if (Error
E = StringTableOrErr.takeError())
1229 return std::move(
E);
1230 Obj->StringTable = StringTableOrErr.get();
1232 return std::move(Obj);
1235Expected<std::unique_ptr<ObjectFile>>
1237 unsigned FileType) {
1238 return XCOFFObjectFile::create(FileType, MemBufRef);
1253 if (!ExpCsectAuxEnt)
1284 if (++NextIt == getObject()->symbol_end())
1292 if (!NextCsectAuxEnt)
1305 "symbol csect aux entry with index " +
1307 " has invalid symbol type " +
1319 "Calling csect symbol interface with a non-csect symbol.");
1325 return std::move(Err);
1328 if (!NumberOfAuxEntries) {
1329 return createError(
"csect symbol \"" + *NameOrErr +
"\" with index " +
1330 Twine(SymbolIdx) +
" contains no auxiliary entry");
1333 if (!getObject()->
is64Bit()) {
1346 if (*getObject()->getSymbolAuxType(AuxAddr) ==
1356 "a csect auxiliary entry has not been found for symbol \"" + *NameOrErr +
1357 "\" with index " +
Twine(SymbolIdx));
1364 return StringRef(
"Unimplemented Debug Name");
1366 if (!getObject()->
is64Bit()) {
1396 if (Bytes.
size() < 4)
1402#define GETVALUEWITHMASK(X) (Data & (TracebackTable::X))
1403#define GETVALUEWITHMASKSHIFT(X, S) \
1404 ((Data & (TracebackTable::X)) >> (TracebackTable::S))
1410 return std::move(Err);
1424 if (!VecParmsTypeOrError)
1427 VecParmsInfo = VecParmsTypeOrError.
get();
1444 NumberOfVectorParmsShift);
1450#undef GETVALUEWITHMASK
1451#undef GETVALUEWITHMASKSHIFT
1458 return std::move(Err);
1463 Error &Err,
bool Is64Bit)
1464 : TBPtr(
Ptr), Is64BitObj(Is64Bit) {
1478 if (Cur && (FixedParmsNum + FloatingParmsNum) > 0)
1479 ParamsTypeValue = DE.getU32(Cur);
1482 TraceBackTableOffset = DE.getU32(Cur);
1485 HandlerMask = DE.getU32(Cur);
1488 NumOfCtlAnchors = DE.getU32(Cur);
1489 if (Cur && NumOfCtlAnchors) {
1491 Disp.
reserve(*NumOfCtlAnchors);
1492 for (
uint32_t I = 0;
I < NumOfCtlAnchors && Cur; ++
I)
1495 ControlledStorageInfoDisp = std::move(Disp);
1500 uint16_t FunctionNameLen = DE.getU16(Cur);
1502 FunctionName = DE.getBytes(Cur, FunctionNameLen);
1506 AllocaRegister = DE.getU8(Cur);
1508 unsigned VectorParmsNum = 0;
1510 StringRef VectorExtRef = DE.getBytes(Cur, 6);
1513 if (!TBVecExtOrErr) {
1514 Err = TBVecExtOrErr.takeError();
1517 VecExt = TBVecExtOrErr.get();
1518 VectorParmsNum = VecExt->getNumberOfVectorParms();
1527 if (Cur && (FixedParmsNum + FloatingParmsNum) > 0) {
1528 Expected<SmallString<32>> ParmsTypeOrError =
1531 FloatingParmsNum, VectorParmsNum)
1532 :
parseParmsType(ParamsTypeValue, FixedParmsNum, FloatingParmsNum);
1534 if (!ParmsTypeOrError) {
1535 Err = ParmsTypeOrError.takeError();
1538 ParmsType = ParmsTypeOrError.get();
1542 ExtensionTable = DE.getU8(Cur);
1544 if (*ExtensionTable & ExtendedTBTableFlag::TB_EH_INFO) {
1546 Cur.seek(
alignTo(Cur.tell(), 4));
1547 EhInfoDisp = Is64BitObj ? DE.getU64(Cur) : DE.getU32(Cur);
1551 Err = Cur.takeError();
1556#define GETBITWITHMASK(P, X) \
1557 (support::endian::read32be(TBPtr + (P)) & (TracebackTable::X))
1558#define GETBITWITHMASKSHIFT(P, X, S) \
1559 ((support::endian::read32be(TBPtr + (P)) & (TracebackTable::X)) >> \
1560 (TracebackTable::S))
1599 return GETBITWITHMASK(0, IsFloatingPointOperationLogOrAbortEnabledMask);
1616 OnConditionDirectiveShift);
1653 NumberOfFixedParmsShift);
1658 NumberOfFloatingPointParmsShift);
1665#undef GETBITWITHMASK
1666#undef GETBITWITHMASKSHIFT
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Analysis containing CSE Info
#define LLVM_EXPORT_TEMPLATE
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
static bool is64Bit(const char *name)
#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.
constexpr 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)
A table of densely packed, null-terminated strings indexed by offset.
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)
LLVM_ABI 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.
A range adaptor for a pair of iterators.
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.
Expected< uint64_t > getAddress() const
Returns the symbol virtual address (i.e.
LLVM_ABI uint8_t getNumberOfVectorParms() const
static LLVM_ABI Expected< TBVectorExt > create(StringRef TBvectorStrRef)
LLVM_ABI bool isVRSavedOnStack() const
LLVM_ABI uint8_t getNumberOfVRSaved() const
LLVM_ABI bool hasVarArgs() const
LLVM_ABI bool hasVMXInstruction() const
XCOFF::StorageMappingClass getStorageMappingClass() const
uint8_t getSymbolType() const
uintptr_t getEntryAddress() 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< ArrayRef< ExceptEnt > > getExceptionEntries() const
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
iterator_range< xcoff_symbol_iterator > xcoff_symbol_iterator_range
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< 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
std::optional< StringRef > tryGetCPUName() 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
xcoff_symbol_iterator_range symbols() const
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
StringRef getStringTable() const
LLVM_ABI Expected< XCOFFCsectAuxRef > getXCOFFCsectAuxRef() const
LLVM_ABI Expected< bool > isFunction() const
int16_t getSectionNumber() const
LLVM_ABI bool isCsectSymbol() const
const XCOFFSymbolEntry64 * getSymbol64() const
const XCOFFSymbolEntry32 * getSymbol32() const
uint16_t getSymbolType() const
uint64_t getValue() const
LLVM_ABI 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.
LLVM_ABI bool isOutOfLineEpilogOrPrologue() const
LLVM_ABI uint8_t getNumOfGPRsSaved() const
LLVM_ABI bool hasTraceBackTableOffset() const
LLVM_ABI bool hasParmsOnStack() const
LLVM_ABI bool hasExtensionTable() const
LLVM_ABI uint8_t getOnConditionDirective() const
LLVM_ABI uint8_t getLanguageID() const
LLVM_ABI uint8_t getNumOfFPRsSaved() const
LLVM_ABI bool isFloatingPointOperationLogOrAbortEnabled() const
LLVM_ABI bool isLRSaved() const
LLVM_ABI uint8_t getNumberOfFPParms() const
LLVM_ABI bool isFuncNamePresent() const
LLVM_ABI bool isAllocaUsed() const
LLVM_ABI bool isGlobalLinkage() const
LLVM_ABI bool isInternalProcedure() const
LLVM_ABI bool hasControlledStorage() const
LLVM_ABI bool isInterruptHandler() const
LLVM_ABI bool isFixup() const
LLVM_ABI bool isFloatingPointPresent() const
LLVM_ABI uint8_t getVersion() const
static LLVM_ABI Expected< XCOFFTracebackTable > create(const uint8_t *Ptr, uint64_t &Size, bool Is64Bits=false)
Parse an XCOFF Traceback Table from Ptr with Size bytes.
LLVM_ABI bool isBackChainStored() const
LLVM_ABI uint8_t getNumberOfFixedParms() const
LLVM_ABI bool isCRSaved() const
LLVM_ABI bool isTOCless() const
LLVM_ABI bool hasVectorInfo() const
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
LLVM_ABI Expected< SmallString< 32 > > parseParmsTypeWithVecInfo(uint32_t Value, unsigned FixedParmsNum, unsigned FloatingParmsNum, unsigned VectorParmsNum)
static constexpr uint8_t XR_SIGN_INDICATOR_MASK
LLVM_ABI StringRef getRelocationTypeString(XCOFF::RelocationType Type)
LLVM_ABI Expected< SmallString< 32 > > parseParmsType(uint32_t Value, unsigned FixedParmsNum, unsigned FloatingParmsNum)
constexpr size_t RelocationSerializationSize64
LLVM_ABI Expected< SmallString< 32 > > parseVectorParmsType(uint32_t Value, unsigned ParmsNum)
@ AUX_CSECT
Identifies a csect auxiliary entry.
constexpr size_t NameSize
constexpr uint16_t RelocOverflow
@ XMC_GL
Global Linkage (Interfile Interface Code)
constexpr size_t SymbolTableEntrySize
@ XTY_CM
Common csect definition. For uninitialized storage.
@ XTY_SD
Csect definition for initialized storage.
@ XTY_LD
Label definition.
@ XTY_ER
External reference.
static Expected< const T * > getObject(MemoryBufferRef M, const void *Ptr, const uint64_t Size=sizeof(T))
LLVM_ABI 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.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
@ Ref
The access may reference the value stored in memory.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
const char * toString(DWARFSectionKind Kind)
LLVM_ABI 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
LLVM_ABI Expected< StringRef > getSymbolName(const LoaderSectionHeader32 *LoaderSecHeader) const
char SymbolName[XCOFF::NameSize]
LLVM_ABI 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