LLVM 20.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 "llvm/Support/SystemZ/zOSSupport.h"
#include <memory>
#include "llvm/BinaryFormat/MachO.def"

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;
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
static const bool IsLittleEndianHost
Definition: SwapByteOrder.h:29

Function Documentation

◆ constructSection() [1/2]

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

Definition at line 50 of file MachOReader.cpp.

References constructSectionCommon().

Referenced by extractSections().

◆ constructSection() [2/2]

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

◆ constructSectionCommon()

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

◆ 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