LLVM 20.0.0git
|
#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 () |
LoadCommand & | 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. | |
bool | is64Bit () const |
uint64_t | nextAvailableSegmentAddress () const |
Public Attributes | |
MachHeader | Header |
std::vector< LoadCommand > | LoadCommands |
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_t > | SwiftVersion |
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 |
Definition at line 298 of file MachOObject.h.
|
inline |
Definition at line 347 of file MachOObject.h.
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().
|
inline |
Definition at line 361 of file MachOObject.h.
References Header, llvm::objcopy::macho::MachHeader::Magic, llvm::MachO::MH_CIGAM_64, and llvm::MachO::MH_MAGIC_64.
Referenced by addSegment(), and 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().
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().
Error Object::removeSections | ( | function_ref< bool(const std::unique_ptr< Section > &)> | ToRemove | ) |
Definition at line 103 of file MachOObject.cpp.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::createStringError(), End, I, llvm::SmallPtrSetImpl< PtrType >::insert(), IsDead, LoadCommands, llvm::objcopy::macho::SymbolTable::removeSymbols(), llvm::Error::success(), Sym, llvm::objcopy::macho::SymbolTable::Symbols, and SymTable.
Referenced by removeSections().
void Object::updateLoadCommandIndexes | ( | ) |
Definition at line 41 of file MachOObject.cpp.
References ChainedFixupsCommandIndex, CodeSignatureCommandIndex, DataInCodeCommandIndex, DyLdInfoCommandIndex, DylibCodeSignDRsIndex, DySymTabCommandIndex, ExportsTrieCommandIndex, FunctionStartsCommandIndex, LinkerOptimizationHintCommandIndex, LoadCommands, llvm::objcopy::macho::LoadCommand::MachOLoadCommand, Size, SymTabCommandIndex, and TextSegmentCommandIndex.
Referenced by processLoadCommands(), and removeLoadCommands().
BumpPtrAllocator llvm::objcopy::macho::Object::Alloc |
Definition at line 344 of file MachOObject.h.
BindInfo llvm::objcopy::macho::Object::Binds |
Definition at line 306 of file MachOObject.h.
Referenced by llvm::objcopy::macho::MachOWriter::totalSize().
LinkData llvm::objcopy::macho::Object::ChainedFixups |
Definition at line 315 of file MachOObject.h.
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().
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().
LinkData llvm::objcopy::macho::Object::DataInCode |
Definition at line 311 of file MachOObject.h.
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().
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().
LinkData llvm::objcopy::macho::Object::DylibCodeSignDRs |
Definition at line 316 of file MachOObject.h.
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().
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().
ExportInfo llvm::objcopy::macho::Object::Exports |
Definition at line 309 of file MachOObject.h.
Referenced by llvm::objcopy::macho::MachOWriter::totalSize().
LinkData llvm::objcopy::macho::Object::ExportsTrie |
Definition at line 314 of file MachOObject.h.
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().
LinkData llvm::objcopy::macho::Object::FunctionStarts |
Definition at line 313 of file MachOObject.h.
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().
MachHeader llvm::objcopy::macho::Object::Header |
Definition at line 299 of file MachOObject.h.
Referenced by is64Bit(), nextAvailableSegmentAddress(), and updateAndRemoveSymbols().
IndirectSymbolTable llvm::objcopy::macho::Object::IndirectSymTable |
Definition at line 310 of file MachOObject.h.
Referenced by markSymbols(), and llvm::objcopy::macho::MachOWriter::totalSize().
LazyBindInfo llvm::objcopy::macho::Object::LazyBinds |
Definition at line 308 of file MachOObject.h.
Referenced by llvm::objcopy::macho::MachOWriter::totalSize().
LinkData llvm::objcopy::macho::Object::LinkerOptimizationHint |
Definition at line 312 of file MachOObject.h.
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().
std::vector<LoadCommand> llvm::objcopy::macho::Object::LoadCommands |
Definition at line 300 of file MachOObject.h.
Referenced by addSection(), addSegment(), dumpSectionToFile(), handleArgs(), nextAvailableSegmentAddress(), processLoadCommands(), removeLoadCommands(), removeSections(), llvm::objcopy::macho::MachOWriter::totalSize(), and updateLoadCommandIndexes().
StringSaver llvm::objcopy::macho::Object::NewSectionsContents |
Definition at line 345 of file MachOObject.h.
Referenced by addSection().
RebaseInfo llvm::objcopy::macho::Object::Rebases |
Definition at line 305 of file MachOObject.h.
Referenced by llvm::objcopy::macho::MachOWriter::totalSize().
StringTable llvm::objcopy::macho::Object::StrTable |
Definition at line 303 of file MachOObject.h.
std::optional<uint32_t> llvm::objcopy::macho::Object::SwiftVersion |
Definition at line 318 of file MachOObject.h.
Referenced by updateAndRemoveSymbols().
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().
SymbolTable llvm::objcopy::macho::Object::SymTable |
Definition at line 302 of file MachOObject.h.
Referenced by removeSections(), and updateAndRemoveSymbols().
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().
WeakBindInfo llvm::objcopy::macho::Object::WeakBinds |
Definition at line 307 of file MachOObject.h.
Referenced by llvm::objcopy::macho::MachOWriter::totalSize().