LLVM 23.0.0git
MachOWriter.cpp File Reference
#include "MachOWriter.h"
#include "MachOLayoutBuilder.h"
#include "MachOObject.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SHA256.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

static uint64_t paddedLinkEditEntrySize (uint64_t Size, bool Is64Bit)
template<typename NListType>
void writeNListEntry (const SymbolEntry &SE, bool IsLittleEndian, char *&Out, uint32_t Nstrx)
static uint64_t getSegmentFileOffset (const LoadCommand &TextSegmentLoadCommand)
static uint64_t getSegmentFileSize (const LoadCommand &TextSegmentLoadCommand)

Macro Definition Documentation

◆ HANDLE_LOAD_COMMAND

#define HANDLE_LOAD_COMMAND ( LCName,
LCValue,
LCStruct )
Value:
case MachO::LCName: \
assert(sizeof(MachO::LCStruct) + LC.Payload.size() == \
MLC.load_command_data.cmdsize); \
if (IsLittleEndian != sys::IsLittleEndianHost) \
MachO::swapStruct(MLC.LCStruct##_data); \
memcpy(Begin, &MLC.LCStruct##_data, sizeof(MachO::LCStruct)); \
Begin += sizeof(MachO::LCStruct); \
if (!LC.Payload.empty()) \
memcpy(Begin, LC.Payload.data(), LC.Payload.size()); \
Begin += LC.Payload.size(); \
break;
constexpr bool IsLittleEndianHost

Function Documentation

◆ getSegmentFileOffset()

uint64_t getSegmentFileOffset ( const LoadCommand & TextSegmentLoadCommand)
static

◆ getSegmentFileSize()

uint64_t getSegmentFileSize ( const LoadCommand & TextSegmentLoadCommand)
static

◆ paddedLinkEditEntrySize()

uint64_t paddedLinkEditEntrySize ( uint64_t Size,
bool Is64Bit )
static

Definition at line 28 of file MachOWriter.cpp.

References llvm::alignToPowerOf2(), and Size.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize().

◆ writeNListEntry()