public final class MachOObjectFile extends ObjectFile
| Modifier and Type | Class and Description |
|---|---|
class |
MachOObjectFile.AbstractDylibCommand
This abstract superclass models all load commands wrapping a struct dylib, namely
MachOObjectFile.LoadDylibCommand and MachOObjectFile.IDDylibCommand (and, if we implement it,
LoadWeakDylibCommand). |
class |
MachOObjectFile.DySymtabCommand
Symtab load command.
|
static class |
MachOObjectFile.FileType
Mach-O file type.
|
class |
MachOObjectFile.IDDylibCommand |
class |
MachOObjectFile.LinkEditSegment64Command
We model the link edit segment as a separate class.
|
class |
MachOObjectFile.LoadCommand
Abstract super class of all load commands.
|
static class |
MachOObjectFile.LoadCommandKind
This enum defines an element for every defined value for 'cmd', i.e.
|
class |
MachOObjectFile.LoadDylibCommand |
class |
MachOObjectFile.MachOSection |
class |
MachOObjectFile.RPathCommand |
static class |
MachOObjectFile.SectionFlag |
static class |
MachOObjectFile.SectionInfoStruct
Section directory entries as held by a Segment64 load command.
|
static class |
MachOObjectFile.SectionType |
class |
MachOObjectFile.Segment64Command |
class |
MachOObjectFile.SymtabCommand
Symtab load command.
|
class |
MachOObjectFile.UUIDCommand
UUID load command.
|
static class |
MachOObjectFile.VMProt |
ObjectFile.Element, ObjectFile.ElementComparatorByDecidedOffset, ObjectFile.Format, ObjectFile.Header, ObjectFile.IntegerDecisionComparator, ObjectFile.NobitsSectionImpl, ObjectFile.ProgbitsSectionImpl, ObjectFile.RelocatableSectionImpl, ObjectFile.RelocationKind, ObjectFile.RelocationMethod, ObjectFile.RelocationRecord, ObjectFile.RelocationSiteInfo, ObjectFile.Section, ObjectFile.Segment, ObjectFile.SizeTiebreakComparator, ObjectFile.Symbol, ObjectFile.ValueEnumelements, nameForElement| Constructor and Description |
|---|
MachOObjectFile()
Create an empty Mach-O object file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOpaqueLoadCommand(String name,
MachOObjectFile.LoadCommandKind k,
byte[] bs) |
int |
bake(List<ObjectFile.Element> sortedObjectFileElements) |
ObjectFile.Symbol |
createDefinedSymbol(String name,
ObjectFile.Element baseSection,
long position,
int size,
boolean isCode,
boolean isGlobal) |
protected ElementList |
createElementList() |
protected MachOObjectFile.LinkEditSegment64Command |
createLinkEditSegment() |
protected SymbolTable |
createSymbolTable() |
ObjectFile.Symbol |
createUndefinedSymbol(String name,
int size,
boolean isCode) |
ByteOrder |
getByteOrder() |
Set<com.oracle.objectfile.macho.MachOObjectFile.Flag> |
getFlags() |
ObjectFile.Format |
getFormat() |
ObjectFile.Header |
getHeader()
We override getHeader() since LoadCommands are also headers, so we do not have a unique
Element satisfying instanceof Header.
|
MachOObjectFile.Segment64Command |
getLinkEditSegment() |
MachOObjectFile.LoadCommand |
getLoadCommand(MachOObjectFile.LoadCommandKind k) |
protected int |
getMinimumFileSize() |
protected MachOObjectFile.LinkEditSegment64Command |
getOrCreateLinkEditSegment() |
com.oracle.objectfile.macho.MachORelocationElement |
getOrCreateRelocationElement(boolean useImplicitAddend) |
protected MachOObjectFile.Segment64Command |
getOrCreateSegment(String segmentNameOrNull,
String sectionName,
boolean writable,
boolean executable)
Return a Segment object which is appropriate for containing a section of the given name, if
such a segment is mandatory according to the object file format specification.
|
com.oracle.objectfile.macho.MachORelocationElement |
getRelocationElement() |
Set<ObjectFile.Segment> |
getSegments() |
MachOSymtab |
getSymbolTable() |
protected static String |
getUnnamedSegmentName() |
int |
getWordSizeInBytes() |
protected int |
initialVaddr() |
MachOZeroFillSection |
newNobitsSection(ObjectFile.Segment segment,
String name,
ObjectFile.NobitsSectionImpl impl) |
MachORegularSection |
newProgbitsSection(ObjectFile.Segment segment,
String name,
int alignment,
boolean writable,
boolean executable,
ObjectFile.ProgbitsSectionImpl impl) |
MachOUserDefinedSection |
newUserDefinedSection(ObjectFile.Segment segment,
String name,
int alignment,
ElementImpl impl)
Create a new section for holding user data.
|
void |
setByteOrder(ByteOrder byteOrder) |
void |
setFlags(EnumSet<com.oracle.objectfile.macho.MachOObjectFile.Flag> flags) |
void |
setMainEntryPoint(String name) |
boolean |
shouldRecordDebugRelocations()
Determines whether references between debug sections should be recorded for relocation.
|
allDecisions, basicDependencies, createRuntimeDebugInfo, decisionsByKind, defaultDecisions, defaultDependencies, defaultGetOrDecide, defaultGetOrDecideContent, defaultGetOrDecideOffset, defaultGetOrDecideSize, defaultGetOrDecideVaddr, elementForName, elementsCanSharePage, elementsMappedOnPage, findSegmentByName, flagSetAsLong, flagSetFromLong, getDecisionsByElement, getDecisionsTaken, getElements, getFilenameSuffix, getHostPageSize, getNativeFormat, getNativeObjectFile, getOffsetBootstrapElement, getOrCreateSymbolTable, getPageSize, getPageSizeShift, getSections, greatestCommonDivisor, lowestCommonMultiple, maximalDecisionValues, minimalDecisionValues, minimalDependencies, nameForElement, newDebugSection, newNobitsSection, newProgbitsSection, newUserDefinedSection, nextAvailableOffset, nextAvailableVaddr, nextIntegerMultiple, nextIntegerMultipleWithCongruence, roundUpToPageSize, setPageSize, sortedDecisionValues, write, writeBufferpublic ObjectFile.Format getFormat()
getFormat in class ObjectFileprotected static String getUnnamedSegmentName()
protected ElementList createElementList()
createElementList in class ObjectFilepublic ByteOrder getByteOrder()
getByteOrder in class ObjectFilepublic void setByteOrder(ByteOrder byteOrder)
setByteOrder in class ObjectFilepublic void setMainEntryPoint(String name)
setMainEntryPoint in class ObjectFileprotected int initialVaddr()
initialVaddr in class ObjectFilepublic int getWordSizeInBytes()
getWordSizeInBytes in class ObjectFilepublic boolean shouldRecordDebugRelocations()
ObjectFileshouldRecordDebugRelocations in class ObjectFilepublic ObjectFile.Symbol createDefinedSymbol(String name, ObjectFile.Element baseSection, long position, int size, boolean isCode, boolean isGlobal)
createDefinedSymbol in class ObjectFilepublic ObjectFile.Symbol createUndefinedSymbol(String name, int size, boolean isCode)
createUndefinedSymbol in class ObjectFileprotected MachOObjectFile.Segment64Command getOrCreateSegment(String segmentNameOrNull, String sectionName, boolean writable, boolean executable)
ObjectFilegetOrCreateSegment in class ObjectFilesegmentNameOrNull - either null, or the name of a segment which the caller would prefer
should contain the given section (in the case where multiple names would be
possible for the created segment, so the choice would be ambiguous)sectionName - a platform-dependent section namewritable - whether the segment contents should be writableexecutable - whether the segment contents should be executablepublic MachOZeroFillSection newNobitsSection(ObjectFile.Segment segment, String name, ObjectFile.NobitsSectionImpl impl)
newNobitsSection in class ObjectFilepublic MachORegularSection newProgbitsSection(ObjectFile.Segment segment, String name, int alignment, boolean writable, boolean executable, ObjectFile.ProgbitsSectionImpl impl)
newProgbitsSection in class ObjectFilepublic MachOUserDefinedSection newUserDefinedSection(ObjectFile.Segment segment, String name, int alignment, ElementImpl impl)
ObjectFilenewUserDefinedSection in class ObjectFilepublic MachOObjectFile.LoadCommand getLoadCommand(MachOObjectFile.LoadCommandKind k)
public MachOObjectFile.Segment64Command getLinkEditSegment()
public com.oracle.objectfile.macho.MachORelocationElement getRelocationElement()
public com.oracle.objectfile.macho.MachORelocationElement getOrCreateRelocationElement(boolean useImplicitAddend)
public Set<ObjectFile.Segment> getSegments()
getSegments in class ObjectFilepublic ObjectFile.Header getHeader()
getHeader in class ObjectFileObjectFile.Header. Depending on the mode of the object file (read
or write), the header is newly created or read from the buffer.protected int getMinimumFileSize()
getMinimumFileSize in class ObjectFilepublic int bake(List<ObjectFile.Element> sortedObjectFileElements)
bake in class ObjectFilepublic Set<com.oracle.objectfile.macho.MachOObjectFile.Flag> getFlags()
public void setFlags(EnumSet<com.oracle.objectfile.macho.MachOObjectFile.Flag> flags)
protected MachOObjectFile.LinkEditSegment64Command getOrCreateLinkEditSegment()
protected MachOObjectFile.LinkEditSegment64Command createLinkEditSegment()
protected SymbolTable createSymbolTable()
createSymbolTable in class ObjectFilepublic MachOSymtab getSymbolTable()
getSymbolTable in class ObjectFilepublic void addOpaqueLoadCommand(String name, MachOObjectFile.LoadCommandKind k, byte[] bs)