LLVM 20.0.0git
Public Member Functions | Public Attributes | List of all members
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 298 of file MachOObject.h.

Constructor & Destructor Documentation

◆ Object()

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

Definition at line 347 of file MachOObject.h.

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 185 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

◆ nextAvailableSegmentAddress()

uint64_t Object::nextAvailableSegmentAddress ( ) const

Definition at line 146 of file MachOObject.cpp.

References Addr, Header, is64Bit(), LoadCommands, and llvm::objcopy::macho::MachHeader::SizeOfCmds.

Referenced by addSegment().

◆ removeLoadCommands()

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

Definition at line 92 of file MachOObject.cpp.

References LoadCommands, llvm::Error::success(), and updateLoadCommandIndexes().

Referenced by processLoadCommands().

◆ removeSections()

Error Object::removeSections ( function_ref< bool(const std::unique_ptr< Section > &)>  ToRemove)

◆ updateLoadCommandIndexes()

void Object::updateLoadCommandIndexes ( )

Member Data Documentation

◆ Alloc

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

Definition at line 344 of file MachOObject.h.

◆ Binds

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

Definition at line 306 of file MachOObject.h.

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

◆ ChainedFixups

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

Definition at line 315 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 337 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().

◆ CodeSignatureCommandIndex

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

The index of LC_CODE_SIGNATURE load command if present.

Definition at line 321 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().

◆ DataInCode

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

Definition at line 311 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 331 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and 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 327 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().

◆ DylibCodeSignDRs

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

Definition at line 316 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 323 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().

◆ DySymTabCommandIndex

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

The index LC_DYSYMTAB load command if present.

Definition at line 329 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().

◆ Exports

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

Definition at line 309 of file MachOObject.h.

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

◆ ExportsTrie

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

Definition at line 314 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 339 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().

◆ FunctionStarts

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

Definition at line 313 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 335 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().

◆ Header

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

Definition at line 299 of file MachOObject.h.

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

◆ IndirectSymTable

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

Definition at line 310 of file MachOObject.h.

Referenced by markSymbols(), and llvm::objcopy::macho::MachOWriter::totalSize().

◆ LazyBinds

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

Definition at line 308 of file MachOObject.h.

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

◆ LinkerOptimizationHint

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

Definition at line 312 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 333 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().

◆ LoadCommands

std::vector<LoadCommand> llvm::objcopy::macho::Object::LoadCommands

◆ NewSectionsContents

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

Definition at line 345 of file MachOObject.h.

Referenced by addSection().

◆ Rebases

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

Definition at line 305 of file MachOObject.h.

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

◆ StrTable

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

Definition at line 303 of file MachOObject.h.

◆ SwiftVersion

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

Definition at line 318 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 325 of file MachOObject.h.

Referenced by llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().

◆ SymTable

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

Definition at line 302 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 342 of file MachOObject.h.

Referenced by updateLoadCommandIndexes().

◆ WeakBinds

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

Definition at line 307 of file MachOObject.h.

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


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