LLVM 22.0.0git
COFFObjectFile.cpp File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/Error.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/WindowsMachineFlag.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBufferRef.h"
#include <algorithm>
#include <cassert>
#include <cinttypes>
#include <cstddef>
#include <cstring>
#include <limits>
#include <memory>
#include <system_error>

Go to the source code of this file.

Macros

#define LLVM_COFF_SWITCH_RELOC_TYPE_NAME(reloc_type)
#define RETURN_IF_ERROR(Expr)

Functions

static bool checkSize (MemoryBufferRef M, std::error_code &EC, uint64_t Size)
template<typename T>
static Error getObject (const T *&Obj, MemoryBufferRef M, const void *Ptr, const uint64_t Size=sizeof(T))
static bool decodeBase64StringEntry (StringRef Str, uint32_t &Result)
static uint32_t getNumberOfRelocations (const coff_section *Sec, MemoryBufferRef M, const uint8_t *base)
static const coff_relocationgetFirstReloc (const coff_section *Sec, MemoryBufferRef M, const uint8_t *Base)
static Error ignoreStrippedErrors (Error E)
static imported_symbol_iterator makeImportedSymbolIterator (const COFFObjectFile *Object, uintptr_t Ptr, int Index)
static imported_symbol_iterator importedSymbolBegin (uint32_t RVA, const COFFObjectFile *Object)
static imported_symbol_iterator importedSymbolEnd (uint32_t RVA, const COFFObjectFile *Object)

Macro Definition Documentation

◆ LLVM_COFF_SWITCH_RELOC_TYPE_NAME

#define LLVM_COFF_SWITCH_RELOC_TYPE_NAME ( reloc_type)
Value:
case COFF::reloc_type: \
return #reloc_type;

Definition at line 1377 of file COFFObjectFile.cpp.

Referenced by llvm::object::COFFObjectFile::getRelocationTypeName().

◆ RETURN_IF_ERROR

#define RETURN_IF_ERROR ( Expr)
Value:
do { \
Error E = (Expr); \
if (E) \
return std::move(E); \
} while (0)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159

Definition at line 2203 of file COFFObjectFile.cpp.

Referenced by llvm::object::ResourceEntryRef::moveNext(), llvm::object::WindowsResourceParser::parse(), and llvm::object::readStringOrId().

Function Documentation

◆ checkSize()

bool checkSize ( MemoryBufferRef M,
std::error_code & EC,
uint64_t Size )
static

Definition at line 46 of file COFFObjectFile.cpp.

References Size.

◆ decodeBase64StringEntry()

bool decodeBase64StringEntry ( StringRef Str,
uint32_t & Result )
static

Definition at line 68 of file COFFObjectFile.cpp.

References assert().

Referenced by llvm::object::COFFObjectFile::getSectionName().

◆ getFirstReloc()

◆ getNumberOfRelocations()

◆ getObject()

template<typename T>
Error getObject ( const T *& Obj,
MemoryBufferRef M,
const void * Ptr,
const uint64_t Size = sizeof(T) )
static

◆ ignoreStrippedErrors()

Error ignoreStrippedErrors ( Error E)
static

Definition at line 879 of file COFFObjectFile.cpp.

References llvm::consumeError(), E(), and llvm::Error::success().

◆ importedSymbolBegin()

◆ importedSymbolEnd()

◆ makeImportedSymbolIterator()

imported_symbol_iterator makeImportedSymbolIterator ( const COFFObjectFile * Object,
uintptr_t Ptr,
int Index )
static

Definition at line 1582 of file COFFObjectFile.cpp.

References P, and Ptr.

Referenced by importedSymbolBegin(), and importedSymbolEnd().