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.ValueEnum
elements, nameForElement
Constructor and Description |
---|
MachOObjectFile()
Create an empty Mach-O object file.
|
MachOObjectFile(MachOCpuType cpuType) |
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) |
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, writeBuffer
public MachOObjectFile()
public MachOObjectFile(MachOCpuType cpuType)
public ObjectFile.Format getFormat()
getFormat
in class ObjectFile
protected static String getUnnamedSegmentName()
protected ElementList createElementList()
createElementList
in class ObjectFile
public ByteOrder getByteOrder()
getByteOrder
in class ObjectFile
public void setByteOrder(ByteOrder byteOrder)
setByteOrder
in class ObjectFile
protected int initialVaddr()
initialVaddr
in class ObjectFile
public int getWordSizeInBytes()
getWordSizeInBytes
in class ObjectFile
public boolean shouldRecordDebugRelocations()
ObjectFile
shouldRecordDebugRelocations
in class ObjectFile
public ObjectFile.Symbol createDefinedSymbol(String name, ObjectFile.Element baseSection, long position, int size, boolean isCode, boolean isGlobal)
createDefinedSymbol
in class ObjectFile
public ObjectFile.Symbol createUndefinedSymbol(String name, int size, boolean isCode)
createUndefinedSymbol
in class ObjectFile
protected MachOObjectFile.Segment64Command getOrCreateSegment(String segmentNameOrNull, String sectionName, boolean writable, boolean executable)
ObjectFile
getOrCreateSegment
in class ObjectFile
segmentNameOrNull
- 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 ObjectFile
public MachORegularSection newProgbitsSection(ObjectFile.Segment segment, String name, int alignment, boolean writable, boolean executable, ObjectFile.ProgbitsSectionImpl impl)
newProgbitsSection
in class ObjectFile
public MachOUserDefinedSection newUserDefinedSection(ObjectFile.Segment segment, String name, int alignment, ElementImpl impl)
ObjectFile
newUserDefinedSection
in class ObjectFile
public 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 ObjectFile
public ObjectFile.Header getHeader()
getHeader
in class ObjectFile
ObjectFile.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 ObjectFile
public int bake(List<ObjectFile.Element> sortedObjectFileElements)
bake
in class ObjectFile
public 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 ObjectFile
public MachOSymtab getSymbolTable()
getSymbolTable
in class ObjectFile
public void addOpaqueLoadCommand(String name, MachOObjectFile.LoadCommandKind k, byte[] bs)