LLVM  16.0.0git
Macros | Functions
MachOReader.cpp File Reference
#include "MachOReader.h"
#include "MachOObject.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/Errc.h"
#include <memory>
#include "llvm/BinaryFormat/MachO.def"
Include dependency graph for MachOReader.cpp:

Go to the source code of this file.

Macros

#define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct)
 

Functions

template<typename SectionType >
static Section constructSectionCommon (const SectionType &Sec, uint32_t Index)
 
Section constructSection (const MachO::section &Sec, uint32_t Index)
 
Section constructSection (const MachO::section_64 &Sec, uint32_t Index)
 
template<typename SectionType , typename SegmentType >
static Expected< std::vector< std::unique_ptr< Section > > > extractSections (const object::MachOObjectFile::LoadCommandInfo &LoadCmd, const object::MachOObjectFile &MachOObj, uint32_t &NextSectionIndex)
 
template<typename nlist_t >
SymbolEntry constructSymbolEntry (StringRef StrTable, const nlist_t &nlist)
 

Macro Definition Documentation

◆ HANDLE_LOAD_COMMAND

#define HANDLE_LOAD_COMMAND (   LCName,
  LCValue,
  LCStruct 
)
Value:
case MachO::LCName: \
memcpy((void *)&(LC.MachOLoadCommand.LCStruct##_data), LoadCmd.Ptr, \
sizeof(MachO::LCStruct)); \
if (MachOObj.isLittleEndian() != sys::IsLittleEndianHost) \
MachO::swapStruct(LC.MachOLoadCommand.LCStruct##_data); \
if (LoadCmd.C.cmdsize > sizeof(MachO::LCStruct)) \
LC.Payload = ArrayRef<uint8_t>( \
reinterpret_cast<uint8_t *>(const_cast<char *>(LoadCmd.Ptr)) + \
sizeof(MachO::LCStruct), \
LoadCmd.C.cmdsize - sizeof(MachO::LCStruct)); \
break;

Function Documentation

◆ constructSection() [1/2]

Section constructSection ( const MachO::section Sec,
uint32_t  Index 
)

Definition at line 49 of file MachOReader.cpp.

References constructSectionCommon().

◆ constructSection() [2/2]

Section constructSection ( const MachO::section_64 Sec,
uint32_t  Index 
)

Definition at line 53 of file MachOReader.cpp.

References constructSectionCommon(), llvm::MachO::section_64::reserved3, and S.

◆ constructSectionCommon()

template<typename SectionType >
static Section constructSectionCommon ( const SectionType &  Sec,
uint32_t  Index 
)
static

Definition at line 31 of file MachOReader.cpp.

References Index, and S.

Referenced by constructSection().

◆ constructSymbolEntry()

template<typename nlist_t >
SymbolEntry constructSymbolEntry ( StringRef  StrTable,
const nlist_t &  nlist 
)

◆ extractSections()

template<typename SectionType , typename SegmentType >
static Expected<std::vector<std::unique_ptr<Section> > > extractSections ( const object::MachOObjectFile::LoadCommandInfo LoadCmd,
const object::MachOObjectFile MachOObj,
uint32_t NextSectionIndex 
)
static
llvm::ArrayRef< uint8_t >
llvm::sys::IsLittleEndianHost
static const bool IsLittleEndianHost
Definition: SwapByteOrder.h:101
llvm::MachO::swapStruct
void swapStruct(fat_header &mh)
Definition: MachO.h:1139