9#ifndef LLVM_LIB_OBJCOPY_MACHO_MACHOOBJECT_H
10#define LLVM_LIB_OBJCOPY_MACHO_MACHOOBJECT_H
93 std::vector<std::unique_ptr<Section>>
Sections;
128 : std::optional<uint32_t>(
n_sect);
135 std::vector<std::unique_ptr<SymbolEntry>>
Symbols;
159 std::optional<SymbolEntry *>
Symbol)
175 std::optional<const SymbolEntry *>
Symbol;
177 std::optional<const Section *>
Sec;
189 return Info.r_word1 & 0xffffff;
190 return Info.r_word1 >> 8;
194 assert(SymbolNum < (1 << 24) &&
"SymbolNum out of range");
196 Info.r_word1 = (
Info.r_word1 & ~0x00ffffff) | SymbolNum;
198 Info.r_word1 = (
Info.r_word1 & ~0xffffff00) | (SymbolNum << 8);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ReachingDefAnalysis InstSet & ToRemove
This file declares classes for handling the YAML representation of DWARF Debug Info.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
An efficient, type-erasing, non-owning reference to a callable.
SectionType
These are the section type and attributes fields.
@ S_GB_ZEROFILL
S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4 gigabytes).
@ S_THREAD_LOCAL_ZEROFILL
S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
@ S_ZEROFILL
S_ZEROFILL - Zero fill on demand section.
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
The location of the bind info inside the binary is described by LC_DYLD_INFO load command.
ArrayRef< uint8_t > Opcodes
The location of the export info inside the binary is described by LC_DYLD_INFO load command.
std::optional< SymbolEntry * > Symbol
The Symbol referenced by this entry.
IndirectSymbolEntry(uint32_t OriginalIndex, std::optional< SymbolEntry * > Symbol)
std::vector< IndirectSymbolEntry > Symbols
The location of the lazy bind info inside the binary is described by LC_DYLD_INFO load command.
ArrayRef< uint8_t > Opcodes
MachO::macho_load_command MachOLoadCommand
std::optional< StringRef > getSegmentName() const
std::vector< std::unique_ptr< Section > > Sections
std::optional< uint64_t > getSegmentVMAddr() const
std::vector< uint8_t > Payload
std::optional< size_t > FunctionStartsCommandIndex
The index LC_FUNCTION_STARTS load command if present.
void updateLoadCommandIndexes()
StringSaver NewSectionsContents
Error removeLoadCommands(function_ref< bool(const LoadCommand &)> ToRemove)
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.
Error removeSections(function_ref< bool(const std::unique_ptr< Section > &)> ToRemove)
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::vector< LoadCommand > LoadCommands
std::optional< size_t > DataInCodeCommandIndex
The index LC_DATA_IN_CODE load command if present.
std::optional< uint32_t > SwiftVersion
std::optional< size_t > DySymTabCommandIndex
The index LC_DYSYMTAB load command if present.
LinkData LinkerOptimizationHint
std::optional< size_t > TextSegmentCommandIndex
The index of the LC_SEGMENT or LC_SEGMENT_64 load command corresponding to the __TEXT segment.
IndirectSymbolTable IndirectSymTable
uint64_t nextAvailableSegmentAddress() const
LinkData DylibCodeSignDRs
std::optional< size_t > CodeSignatureCommandIndex
The index of LC_CODE_SIGNATURE load command if present.
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 co...
std::optional< size_t > LinkerOptimizationHintCommandIndex
The index of LC_LINKER_OPTIMIZATIN_HINT load command if present.
The location of the rebase info inside the binary is described by LC_DYLD_INFO load command.
ArrayRef< uint8_t > Opcodes
MachO::any_relocation_info Info
std::optional< const SymbolEntry * > Symbol
std::optional< const Section * > Sec
unsigned getPlainRelocationSymbolNum(bool IsLittleEndian)
void setPlainRelocationSymbolNum(unsigned SymbolNum, bool IsLittleEndian)
Section(StringRef SegName, StringRef SectName)
std::optional< uint32_t > OriginalOffset
bool isBssSection() const
bool hasValidOffset() const
std::vector< RelocationInfo > Relocations
std::string CanonicalName
MachO::SectionType getType() const
The location of the string table inside the binary is described by LC_SYMTAB load command.
std::vector< std::string > Strings
bool isExternalSymbol() const
std::optional< uint32_t > section() const
bool isUndefinedSymbol() const
bool isSwiftSymbol() const
bool isLocalSymbol() const
The location of the symbol table inside the binary is described by LC_SYMTAB load command.
void updateSymbols(function_ref< void(SymbolEntry &)> Callable)
const SymbolEntry * getSymbolByIndex(uint32_t Index) const
std::vector< std::unique_ptr< SymbolEntry > > Symbols
void removeSymbols(function_ref< bool(const std::unique_ptr< SymbolEntry > &)> ToRemove)
pointee_iterator< std::vector< std::unique_ptr< SymbolEntry > >::const_iterator > iterator
The location of the weak bind info inside the binary is described by LC_DYLD_INFO load command.
ArrayRef< uint8_t > Opcodes
An iterator type that allows iterating over the pointees via some other iterator.