#include "llvm/Object/XCOFFObjectFile.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/TargetParser/SubtargetFeature.h"
#include <cstddef>
#include <cstring>
namespace llvm {
usingnamespaceXCOFF;
namespace object {
static const uint8_t FunctionSym = …;
static const uint16_t NoRelMask = …;
static const size_t SymbolAuxTypeOffset = …;
template <typename T>
static Expected<const T *> getObject(MemoryBufferRef M, const void *Ptr,
const uint64_t Size = sizeof(T)) { … }
static uintptr_t getWithOffset(uintptr_t Base, ptrdiff_t Offset) { … }
template <typename T> static const T *viewAs(uintptr_t in) { … }
static StringRef generateXCOFFFixedNameStringRef(const char *Name) { … }
template <typename T> StringRef XCOFFSectionHeader<T>::getName() const { … }
template <typename T> uint16_t XCOFFSectionHeader<T>::getSectionType() const { … }
template <typename T>
uint32_t XCOFFSectionHeader<T>::getSectionSubtype() const { … }
template <typename T>
bool XCOFFSectionHeader<T>::isReservedSectionType() const { … }
template <typename AddressType>
bool XCOFFRelocation<AddressType>::isRelocationSigned() const { … }
template <typename AddressType>
bool XCOFFRelocation<AddressType>::isFixupIndicated() const { … }
template <typename AddressType>
uint8_t XCOFFRelocation<AddressType>::getRelocatedLength() const { … }
template struct ExceptionSectionEntry<support::ubig32_t>;
template struct ExceptionSectionEntry<support::ubig64_t>;
template <typename T>
Expected<StringRef> getLoaderSecSymNameInStrTbl(const T *LoaderSecHeader,
uint64_t Offset) { … }
Expected<StringRef> LoaderSectionSymbolEntry32::getSymbolName(
const LoaderSectionHeader32 *LoaderSecHeader32) const { … }
Expected<StringRef> LoaderSectionSymbolEntry64::getSymbolName(
const LoaderSectionHeader64 *LoaderSecHeader64) const { … }
uintptr_t
XCOFFObjectFile::getAdvancedSymbolEntryAddress(uintptr_t CurrentAddress,
uint32_t Distance) { … }
const XCOFF::SymbolAuxType *
XCOFFObjectFile::getSymbolAuxType(uintptr_t AuxEntryAddress) const { … }
void XCOFFObjectFile::checkSectionAddress(uintptr_t Addr,
uintptr_t TableAddress) const { … }
const XCOFFSectionHeader32 *
XCOFFObjectFile::toSection32(DataRefImpl Ref) const { … }
const XCOFFSectionHeader64 *
XCOFFObjectFile::toSection64(DataRefImpl Ref) const { … }
XCOFFSymbolRef XCOFFObjectFile::toSymbolRef(DataRefImpl Ref) const { … }
const XCOFFFileHeader32 *XCOFFObjectFile::fileHeader32() const { … }
const XCOFFFileHeader64 *XCOFFObjectFile::fileHeader64() const { … }
const XCOFFAuxiliaryHeader32 *XCOFFObjectFile::auxiliaryHeader32() const { … }
const XCOFFAuxiliaryHeader64 *XCOFFObjectFile::auxiliaryHeader64() const { … }
template <typename T> const T *XCOFFObjectFile::sectionHeaderTable() const { … }
const XCOFFSectionHeader32 *
XCOFFObjectFile::sectionHeaderTable32() const { … }
const XCOFFSectionHeader64 *
XCOFFObjectFile::sectionHeaderTable64() const { … }
void XCOFFObjectFile::moveSymbolNext(DataRefImpl &Symb) const { … }
Expected<StringRef>
XCOFFObjectFile::getStringTableEntry(uint32_t Offset) const { … }
StringRef XCOFFObjectFile::getStringTable() const { … }
Expected<StringRef>
XCOFFObjectFile::getCFileName(const XCOFFFileAuxEnt *CFileEntPtr) const { … }
Expected<StringRef> XCOFFObjectFile::getSymbolName(DataRefImpl Symb) const { … }
Expected<uint64_t> XCOFFObjectFile::getSymbolAddress(DataRefImpl Symb) const { … }
uint64_t XCOFFObjectFile::getSymbolValueImpl(DataRefImpl Symb) const { … }
uint32_t XCOFFObjectFile::getSymbolAlignment(DataRefImpl Symb) const { … }
uint64_t XCOFFObjectFile::getCommonSymbolSizeImpl(DataRefImpl Symb) const { … }
Expected<SymbolRef::Type>
XCOFFObjectFile::getSymbolType(DataRefImpl Symb) const { … }
Expected<section_iterator>
XCOFFObjectFile::getSymbolSection(DataRefImpl Symb) const { … }
void XCOFFObjectFile::moveSectionNext(DataRefImpl &Sec) const { … }
Expected<StringRef> XCOFFObjectFile::getSectionName(DataRefImpl Sec) const { … }
uint64_t XCOFFObjectFile::getSectionAddress(DataRefImpl Sec) const { … }
uint64_t XCOFFObjectFile::getSectionIndex(DataRefImpl Sec) const { … }
uint64_t XCOFFObjectFile::getSectionSize(DataRefImpl Sec) const { … }
Expected<ArrayRef<uint8_t>>
XCOFFObjectFile::getSectionContents(DataRefImpl Sec) const { … }
uint64_t XCOFFObjectFile::getSectionAlignment(DataRefImpl Sec) const { … }
uint64_t XCOFFObjectFile::getSectionFileOffsetToRawData(DataRefImpl Sec) const { … }
Expected<uintptr_t> XCOFFObjectFile::getSectionFileOffsetToRawData(
XCOFF::SectionTypeFlags SectType) const { … }
bool XCOFFObjectFile::isSectionCompressed(DataRefImpl Sec) const { … }
bool XCOFFObjectFile::isSectionText(DataRefImpl Sec) const { … }
bool XCOFFObjectFile::isSectionData(DataRefImpl Sec) const { … }
bool XCOFFObjectFile::isSectionBSS(DataRefImpl Sec) const { … }
bool XCOFFObjectFile::isDebugSection(DataRefImpl Sec) const { … }
bool XCOFFObjectFile::isSectionVirtual(DataRefImpl Sec) const { … }
relocation_iterator XCOFFObjectFile::section_rel_begin(DataRefImpl Sec) const { … }
relocation_iterator XCOFFObjectFile::section_rel_end(DataRefImpl Sec) const { … }
void XCOFFObjectFile::moveRelocationNext(DataRefImpl &Rel) const { … }
uint64_t XCOFFObjectFile::getRelocationOffset(DataRefImpl Rel) const { … }
symbol_iterator XCOFFObjectFile::getRelocationSymbol(DataRefImpl Rel) const { … }
uint64_t XCOFFObjectFile::getRelocationType(DataRefImpl Rel) const { … }
void XCOFFObjectFile::getRelocationTypeName(
DataRefImpl Rel, SmallVectorImpl<char> &Result) const { … }
Expected<uint32_t> XCOFFObjectFile::getSymbolFlags(DataRefImpl Symb) const { … }
basic_symbol_iterator XCOFFObjectFile::symbol_begin() const { … }
basic_symbol_iterator XCOFFObjectFile::symbol_end() const { … }
XCOFFObjectFile::xcoff_symbol_iterator_range XCOFFObjectFile::symbols() const { … }
section_iterator XCOFFObjectFile::section_begin() const { … }
section_iterator XCOFFObjectFile::section_end() const { … }
uint8_t XCOFFObjectFile::getBytesInAddress() const { … }
StringRef XCOFFObjectFile::getFileFormatName() const { … }
Triple::ArchType XCOFFObjectFile::getArch() const { … }
Expected<SubtargetFeatures> XCOFFObjectFile::getFeatures() const { … }
bool XCOFFObjectFile::isRelocatableObject() const { … }
Expected<uint64_t> XCOFFObjectFile::getStartAddress() const { … }
StringRef XCOFFObjectFile::mapDebugSectionName(StringRef Name) const { … }
size_t XCOFFObjectFile::getFileHeaderSize() const { … }
size_t XCOFFObjectFile::getSectionHeaderSize() const { … }
bool XCOFFObjectFile::is64Bit() const { … }
Expected<StringRef> XCOFFObjectFile::getRawData(const char *Start,
uint64_t Size,
StringRef Name) const { … }
uint16_t XCOFFObjectFile::getMagic() const { … }
Expected<DataRefImpl> XCOFFObjectFile::getSectionByNum(int16_t Num) const { … }
DataRefImpl
XCOFFObjectFile::getSectionByType(XCOFF::SectionTypeFlags SectType) const { … }
Expected<StringRef>
XCOFFObjectFile::getSymbolSectionName(XCOFFSymbolRef SymEntPtr) const { … }
unsigned XCOFFObjectFile::getSymbolSectionID(SymbolRef Sym) const { … }
bool XCOFFObjectFile::isReservedSectionNumber(int16_t SectionNumber) { … }
uint16_t XCOFFObjectFile::getNumberOfSections() const { … }
int32_t XCOFFObjectFile::getTimeStamp() const { … }
uint16_t XCOFFObjectFile::getOptionalHeaderSize() const { … }
uint32_t XCOFFObjectFile::getSymbolTableOffset32() const { … }
int32_t XCOFFObjectFile::getRawNumberOfSymbolTableEntries32() const { … }
uint32_t XCOFFObjectFile::getLogicalNumberOfSymbolTableEntries32() const { … }
uint64_t XCOFFObjectFile::getSymbolTableOffset64() const { … }
uint32_t XCOFFObjectFile::getNumberOfSymbolTableEntries64() const { … }
uint32_t XCOFFObjectFile::getNumberOfSymbolTableEntries() const { … }
uintptr_t XCOFFObjectFile::getEndOfSymbolTableAddress() const { … }
void XCOFFObjectFile::checkSymbolEntryPointer(uintptr_t SymbolEntPtr) const { … }
uint32_t XCOFFObjectFile::getSymbolIndex(uintptr_t SymbolEntPtr) const { … }
uint64_t XCOFFObjectFile::getSymbolSize(DataRefImpl Symb) const { … }
uintptr_t XCOFFObjectFile::getSymbolEntryAddressByIndex(uint32_t Index) const { … }
Expected<StringRef>
XCOFFObjectFile::getSymbolNameByIndex(uint32_t Index) const { … }
uint16_t XCOFFObjectFile::getFlags() const { … }
const char *XCOFFObjectFile::getSectionNameInternal(DataRefImpl Sec) const { … }
uintptr_t XCOFFObjectFile::getSectionHeaderTableAddress() const { … }
int32_t XCOFFObjectFile::getSectionFlags(DataRefImpl Sec) const { … }
XCOFFObjectFile::XCOFFObjectFile(unsigned int Type, MemoryBufferRef Object)
: … { … }
ArrayRef<XCOFFSectionHeader64> XCOFFObjectFile::sections64() const { … }
ArrayRef<XCOFFSectionHeader32> XCOFFObjectFile::sections32() const { … }
template <typename T>
Expected<uint32_t> XCOFFObjectFile::getNumberOfRelocationEntries(
const XCOFFSectionHeader<T> &Sec) const { … }
template <typename Shdr, typename Reloc>
Expected<ArrayRef<Reloc>> XCOFFObjectFile::relocations(const Shdr &Sec) const { … }
template <typename ExceptEnt>
Expected<ArrayRef<ExceptEnt>> XCOFFObjectFile::getExceptionEntries() const { … }
template Expected<ArrayRef<ExceptionSectionEntry32>>
XCOFFObjectFile::getExceptionEntries() const;
template Expected<ArrayRef<ExceptionSectionEntry64>>
XCOFFObjectFile::getExceptionEntries() const;
Expected<XCOFFStringTable>
XCOFFObjectFile::parseStringTable(const XCOFFObjectFile *Obj, uint64_t Offset) { … }
Expected<StringRef> XCOFFObjectFile::getImportFileTable() const { … }
Expected<std::unique_ptr<XCOFFObjectFile>>
XCOFFObjectFile::create(unsigned Type, MemoryBufferRef MBR) { … }
Expected<std::unique_ptr<ObjectFile>>
ObjectFile::createXCOFFObjectFile(MemoryBufferRef MemBufRef,
unsigned FileType) { … }
std::optional<StringRef> XCOFFObjectFile::tryGetCPUName() const { … }
Expected<bool> XCOFFSymbolRef::isFunction() const { … }
bool XCOFFSymbolRef::isCsectSymbol() const { … }
Expected<XCOFFCsectAuxRef> XCOFFSymbolRef::getXCOFFCsectAuxRef() const { … }
Expected<StringRef> XCOFFSymbolRef::getName() const { … }
template struct XCOFFSectionHeader<XCOFFSectionHeader32>;
template struct XCOFFSectionHeader<XCOFFSectionHeader64>;
template struct XCOFFRelocation<llvm::support::ubig32_t>;
template struct XCOFFRelocation<llvm::support::ubig64_t>;
template llvm::Expected<llvm::ArrayRef<llvm::object::XCOFFRelocation64>>
llvm::object::XCOFFObjectFile::relocations<llvm::object::XCOFFSectionHeader64,
llvm::object::XCOFFRelocation64>(
llvm::object::XCOFFSectionHeader64 const &) const;
template llvm::Expected<llvm::ArrayRef<llvm::object::XCOFFRelocation32>>
llvm::object::XCOFFObjectFile::relocations<llvm::object::XCOFFSectionHeader32,
llvm::object::XCOFFRelocation32>(
llvm::object::XCOFFSectionHeader32 const &) const;
bool doesXCOFFTracebackTableBegin(ArrayRef<uint8_t> Bytes) { … }
#define GETVALUEWITHMASK …
#define GETVALUEWITHMASKSHIFT …
Expected<TBVectorExt> TBVectorExt::create(StringRef TBvectorStrRef) { … }
TBVectorExt::TBVectorExt(StringRef TBvectorStrRef, Error &Err) { … }
uint8_t TBVectorExt::getNumberOfVRSaved() const { … }
bool TBVectorExt::isVRSavedOnStack() const { … }
bool TBVectorExt::hasVarArgs() const { … }
uint8_t TBVectorExt::getNumberOfVectorParms() const { … }
bool TBVectorExt::hasVMXInstruction() const { … }
#undef GETVALUEWITHMASK
#undef GETVALUEWITHMASKSHIFT
Expected<XCOFFTracebackTable>
XCOFFTracebackTable::create(const uint8_t *Ptr, uint64_t &Size, bool Is64Bit) { … }
XCOFFTracebackTable::XCOFFTracebackTable(const uint8_t *Ptr, uint64_t &Size,
Error &Err, bool Is64Bit)
: … { … }
#define GETBITWITHMASK …
#define GETBITWITHMASKSHIFT …
uint8_t XCOFFTracebackTable::getVersion() const { … }
uint8_t XCOFFTracebackTable::getLanguageID() const { … }
bool XCOFFTracebackTable::isGlobalLinkage() const { … }
bool XCOFFTracebackTable::isOutOfLineEpilogOrPrologue() const { … }
bool XCOFFTracebackTable::hasTraceBackTableOffset() const { … }
bool XCOFFTracebackTable::isInternalProcedure() const { … }
bool XCOFFTracebackTable::hasControlledStorage() const { … }
bool XCOFFTracebackTable::isTOCless() const { … }
bool XCOFFTracebackTable::isFloatingPointPresent() const { … }
bool XCOFFTracebackTable::isFloatingPointOperationLogOrAbortEnabled() const { … }
bool XCOFFTracebackTable::isInterruptHandler() const { … }
bool XCOFFTracebackTable::isFuncNamePresent() const { … }
bool XCOFFTracebackTable::isAllocaUsed() const { … }
uint8_t XCOFFTracebackTable::getOnConditionDirective() const { … }
bool XCOFFTracebackTable::isCRSaved() const { … }
bool XCOFFTracebackTable::isLRSaved() const { … }
bool XCOFFTracebackTable::isBackChainStored() const { … }
bool XCOFFTracebackTable::isFixup() const { … }
uint8_t XCOFFTracebackTable::getNumOfFPRsSaved() const { … }
bool XCOFFTracebackTable::hasExtensionTable() const { … }
bool XCOFFTracebackTable::hasVectorInfo() const { … }
uint8_t XCOFFTracebackTable::getNumOfGPRsSaved() const { … }
uint8_t XCOFFTracebackTable::getNumberOfFixedParms() const { … }
uint8_t XCOFFTracebackTable::getNumberOfFPParms() const { … }
bool XCOFFTracebackTable::hasParmsOnStack() const { … }
#undef GETBITWITHMASK
#undef GETBITWITHMASKSHIFT
}
}