LLVM 22.0.0git
llvm::objcopy::macho::Object Struct Reference

#include "ObjCopy/MachO/MachOObject.h"

Public Member Functions

 Object ()
Error removeSections (function_ref< bool(const std::unique_ptr< Section > &)> ToRemove)
Error removeLoadCommands (function_ref< bool(const LoadCommand &)> ToRemove)
void updateLoadCommandIndexes ()
LoadCommandaddSegment (StringRef SegName, uint64_t SegVMSize)
 Creates a new segment load command in the object and returns a reference to the newly created load command.
bool is64Bit () const
uint64_t nextAvailableSegmentAddress () const

Public Attributes

MachHeader Header
std::vector< LoadCommandLoadCommands
SymbolTable SymTable
StringTable StrTable
RebaseInfo Rebases
BindInfo Binds
WeakBindInfo WeakBinds
LazyBindInfo LazyBinds
ExportInfo Exports
IndirectSymbolTable IndirectSymTable
LinkData DataInCode
LinkData LinkerOptimizationHint
LinkData FunctionStarts
LinkData ExportsTrie
LinkData ChainedFixups
LinkData DylibCodeSignDRs
std::optional< uint32_tSwiftVersion
std::optional< size_t > CodeSignatureCommandIndex
 The index of LC_CODE_SIGNATURE load command if present.
std::optional< size_t > DylibCodeSignDRsIndex
 The index of LC_DYLIB_CODE_SIGN_DRS load command if present.
std::optional< size_t > SymTabCommandIndex
 The index of LC_SYMTAB load command if present.
std::optional< size_t > DyLdInfoCommandIndex
 The index of LC_DYLD_INFO or LC_DYLD_INFO_ONLY load command if present.
std::optional< size_t > DySymTabCommandIndex
 The index LC_DYSYMTAB load command if present.
std::optional< size_t > DataInCodeCommandIndex
 The index LC_DATA_IN_CODE load command if present.
std::optional< size_t > LinkerOptimizationHintCommandIndex
 The index of LC_LINKER_OPTIMIZATIN_HINT load command if present.
std::optional< size_t > FunctionStartsCommandIndex
 The index LC_FUNCTION_STARTS load command if present.
std::optional< size_t > ChainedFixupsCommandIndex
 The index LC_DYLD_CHAINED_FIXUPS load command if present.
std::optional< size_t > ExportsTrieCommandIndex
 The index LC_DYLD_EXPORTS_TRIE load command if present.
std::optional< size_t > TextSegmentCommandIndex
 The index of the LC_SEGMENT or LC_SEGMENT_64 load command corresponding to the __TEXT segment.
BumpPtrAllocator Alloc
StringSaver NewSectionsContents

Detailed Description

Definition at line 299 of file MachOObject.h.

Constructor & Destructor Documentation

◆ Object()

llvm::objcopy::macho::Object::Object ( )
inline

Definition at line 348 of file MachOObject.h.

References Alloc, and NewSectionsContents.

Member Function Documentation

◆ addSegment()

LoadCommand & Object::addSegment ( StringRef SegName,
uint64_t SegVMSize )

Creates a new segment load command in the object and returns a reference to the newly created load command.

The caller should verify that SegName is not too long (SegName.size() should be less than or equal to 16).

Definition at line 198 of file MachOObject.cpp.

References constructSegment(), is64Bit(), LoadCommands, llvm::objcopy::macho::LoadCommand::MachOLoadCommand, and nextAvailableSegmentAddress().

Referenced by addSection().

◆ is64Bit()

bool llvm::objcopy::macho::Object::is64Bit ( ) const
inline

Definition at line 362 of file MachOObject.h.

References Header, llvm::MachO::MH_CIGAM_64, and llvm::MachO::MH_MAGIC_64.

Referenced by addSegment(), and nextAvailableSegmentAddress().

◆ nextAvailableSegmentAddress()

uint64_t Object::nextAvailableSegmentAddress ( ) const

Definition at line 159 of file MachOObject.cpp.

References Header, is64Bit(), and LoadCommands.

Referenced by addSegment().

◆ removeLoadCommands()

Error Object::removeLoadCommands ( function_ref< bool(const LoadCommand &)> ToRemove)

◆ removeSections()

◆ updateLoadCommandIndexes()

Member Data Documentation

◆ Alloc

BumpPtrAllocator llvm::objcopy::macho::Object::Alloc

Definition at line 345 of file MachOObject.h.

Referenced by Object().

◆ Binds

BindInfo llvm::objcopy::macho::Object::Binds

Definition at line 307 of file MachOObject.h.

◆ ChainedFixups

LinkData llvm::objcopy::macho::Object::ChainedFixups

Definition at line 316 of file MachOObject.h.

◆ ChainedFixupsCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::ChainedFixupsCommandIndex

The index LC_DYLD_CHAINED_FIXUPS load command if present.

Definition at line 338 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ CodeSignatureCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::CodeSignatureCommandIndex

The index of LC_CODE_SIGNATURE load command if present.

Definition at line 322 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ DataInCode

LinkData llvm::objcopy::macho::Object::DataInCode

Definition at line 312 of file MachOObject.h.

◆ DataInCodeCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::DataInCodeCommandIndex

The index LC_DATA_IN_CODE load command if present.

Definition at line 332 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ DyLdInfoCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::DyLdInfoCommandIndex

The index of LC_DYLD_INFO or LC_DYLD_INFO_ONLY load command if present.

Definition at line 328 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ DylibCodeSignDRs

LinkData llvm::objcopy::macho::Object::DylibCodeSignDRs

Definition at line 317 of file MachOObject.h.

◆ DylibCodeSignDRsIndex

std::optional<size_t> llvm::objcopy::macho::Object::DylibCodeSignDRsIndex

The index of LC_DYLIB_CODE_SIGN_DRS load command if present.

Definition at line 324 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ DySymTabCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::DySymTabCommandIndex

The index LC_DYSYMTAB load command if present.

Definition at line 330 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ Exports

ExportInfo llvm::objcopy::macho::Object::Exports

Definition at line 310 of file MachOObject.h.

◆ ExportsTrie

LinkData llvm::objcopy::macho::Object::ExportsTrie

Definition at line 315 of file MachOObject.h.

◆ ExportsTrieCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::ExportsTrieCommandIndex

The index LC_DYLD_EXPORTS_TRIE load command if present.

Definition at line 340 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ FunctionStarts

LinkData llvm::objcopy::macho::Object::FunctionStarts

Definition at line 314 of file MachOObject.h.

◆ FunctionStartsCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::FunctionStartsCommandIndex

The index LC_FUNCTION_STARTS load command if present.

Definition at line 336 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ Header

MachHeader llvm::objcopy::macho::Object::Header

Definition at line 300 of file MachOObject.h.

Referenced by is64Bit(), nextAvailableSegmentAddress(), and updateAndRemoveSymbols().

◆ IndirectSymTable

IndirectSymbolTable llvm::objcopy::macho::Object::IndirectSymTable

Definition at line 311 of file MachOObject.h.

Referenced by markSymbols().

◆ LazyBinds

LazyBindInfo llvm::objcopy::macho::Object::LazyBinds

Definition at line 309 of file MachOObject.h.

◆ LinkerOptimizationHint

LinkData llvm::objcopy::macho::Object::LinkerOptimizationHint

Definition at line 313 of file MachOObject.h.

◆ LinkerOptimizationHintCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::LinkerOptimizationHintCommandIndex

The index of LC_LINKER_OPTIMIZATIN_HINT load command if present.

Definition at line 334 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ LoadCommands

◆ NewSectionsContents

StringSaver llvm::objcopy::macho::Object::NewSectionsContents

Definition at line 346 of file MachOObject.h.

Referenced by addSection(), and Object().

◆ Rebases

RebaseInfo llvm::objcopy::macho::Object::Rebases

Definition at line 306 of file MachOObject.h.

◆ StrTable

StringTable llvm::objcopy::macho::Object::StrTable

Definition at line 304 of file MachOObject.h.

◆ SwiftVersion

std::optional<uint32_t> llvm::objcopy::macho::Object::SwiftVersion

Definition at line 319 of file MachOObject.h.

Referenced by updateAndRemoveSymbols().

◆ SymTabCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::SymTabCommandIndex

The index of LC_SYMTAB load command if present.

Definition at line 326 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ SymTable

SymbolTable llvm::objcopy::macho::Object::SymTable

Definition at line 303 of file MachOObject.h.

Referenced by removeSections(), and updateAndRemoveSymbols().

◆ TextSegmentCommandIndex

std::optional<size_t> llvm::objcopy::macho::Object::TextSegmentCommandIndex

The index of the LC_SEGMENT or LC_SEGMENT_64 load command corresponding to the __TEXT segment.

Definition at line 343 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ WeakBinds

WeakBindInfo llvm::objcopy::macho::Object::WeakBinds

Definition at line 308 of file MachOObject.h.


The documentation for this struct was generated from the following files: