public abstract class ObjectFile extends Object
LayoutDecision), being computed on write-out (see WriteLayout).| Modifier and Type | Class and Description |
|---|---|
class |
ObjectFile.Element
All headers and sections are subclasses of ObjectFile.Element.
|
static class |
ObjectFile.ElementComparatorByDecidedOffset |
static class |
ObjectFile.Format |
class |
ObjectFile.Header |
static class |
ObjectFile.IntegerDecisionComparator |
static interface |
ObjectFile.NobitsSectionImpl |
static interface |
ObjectFile.ProgbitsSectionImpl
Abstract notions of section.
|
static interface |
ObjectFile.RelocatableSectionImpl |
static class |
ObjectFile.RelocationKind |
static interface |
ObjectFile.RelocationMethod
Interface implemented by objects implementing a specific relocation method and size.
|
static interface |
ObjectFile.RelocationRecord
Interface for objects representing relocation sites in an object file's contents.
|
static interface |
ObjectFile.RelocationSiteInfo |
class |
ObjectFile.Section |
static interface |
ObjectFile.Segment |
static class |
ObjectFile.SizeTiebreakComparator |
static interface |
ObjectFile.Symbol
An abstraction of symbols within object files.
|
static interface |
ObjectFile.ValueEnum
An interface for power-of-two values.
|
| Modifier and Type | Field and Description |
|---|---|
protected ElementList |
elements |
protected Map<ObjectFile.Element,String> |
nameForElement |
| Constructor and Description |
|---|
ObjectFile() |
protected final ElementList elements
protected final Map<ObjectFile.Element,String> nameForElement
public abstract ObjectFile.Format getFormat()
public static <E extends Enum<E> & ObjectFile.ValueEnum> long flagSetAsLong(EnumSet<E> flags)
flags - an EnumSet of flag elements, which must be an enum implementing PowerOfTwoValuedpublic static <E extends Enum<E> & ObjectFile.ValueEnum> EnumSet<E> flagSetFromLong(long flags, Class<E> clazz)
flags - the long integer encoding the set of flagsclazz - the enum class (implementing PowerOfTwoValued) representing elements of the setpublic abstract ByteOrder getByteOrder()
public abstract void setByteOrder(ByteOrder byteOrder)
public abstract void setMainEntryPoint(String name)
protected int initialVaddr()
public static String getFilenameSuffix()
public static ObjectFile.Format getNativeFormat()
public static ObjectFile getNativeObjectFile()
public static ObjectFile createRuntimeDebugInfo()
protected abstract ObjectFile.Segment getOrCreateSegment(String maybeSegmentName, String sectionName, boolean writable, boolean executable)
maybeSegmentName - 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 abstract ObjectFile.Section newUserDefinedSection(ObjectFile.Segment segment, String name, int alignment, ElementImpl impl)
segment - name - impl - public abstract ObjectFile.Section newProgbitsSection(ObjectFile.Segment segment, String name, int alignment, boolean writable, boolean executable, ObjectFile.ProgbitsSectionImpl impl)
public abstract ObjectFile.Section newNobitsSection(ObjectFile.Segment segment, String name, ObjectFile.NobitsSectionImpl impl)
public ObjectFile.Section newUserDefinedSection(String name, ElementImpl impl)
public ObjectFile.Section newDebugSection(String name, ElementImpl impl)
public ObjectFile.Section newProgbitsSection(String name, int alignment, boolean writable, boolean executable, ObjectFile.ProgbitsSectionImpl impl)
public ObjectFile.Section newNobitsSection(String name, ObjectFile.NobitsSectionImpl impl)
public ObjectFile.Segment findSegmentByName(String name)
public static int nextIntegerMultiple(int start,
int multipleOf)
public static int nextIntegerMultipleWithCongruence(int start,
int multipleOf,
int congruentTo,
int modulo)
protected static int greatestCommonDivisor(int arg1,
int arg2)
protected static int lowestCommonMultiple(int arg1,
int arg2)
protected static int nextAvailableVaddr(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided, int base, int defaultValue)
protected static List<LayoutDecision> maximalDecisionValues(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided, LayoutDecision.Kind k, Comparator<LayoutDecision> cmp)
protected static List<LayoutDecision> minimalDecisionValues(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided, LayoutDecision.Kind k, Comparator<LayoutDecision> cmp)
protected static List<LayoutDecision> sortedDecisionValues(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided, LayoutDecision.Kind k, Comparator<LayoutDecision> cmp)
protected static int nextAvailableOffset(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided)
public abstract int getWordSizeInBytes()
public abstract boolean shouldRecordDebugRelocations()
public static HashSet<BuildDependency> basicDependencies(Map<ObjectFile.Element,LayoutDecisionMap> decisions, ObjectFile.Element el, boolean sizeOnContent, boolean vaddrOnOffset)
public static HashSet<BuildDependency> minimalDependencies(Map<ObjectFile.Element,LayoutDecisionMap> decisions, ObjectFile.Element el)
public static HashSet<BuildDependency> defaultDependencies(Map<ObjectFile.Element,LayoutDecisionMap> decisions, ObjectFile.Element el)
public static <T> T defaultGetOrDecide(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided, ObjectFile.Element el, LayoutDecision.Kind k, T hint)
public static int defaultGetOrDecideOffset(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided, ObjectFile.Element el, int offsetHint)
public static byte[] defaultGetOrDecideContent(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided, ObjectFile.Element el, byte[] contentHint)
public static int defaultGetOrDecideSize(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided, ObjectFile.Element el, int sizeHint)
public static int defaultGetOrDecideVaddr(Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided, ObjectFile.Element el, int vaddrHint)
public static LayoutDecisionMap defaultDecisions(ObjectFile.Element e, LayoutDecisionMap copyingIn)
protected boolean elementsCanSharePage(ObjectFile.Element s1, ObjectFile.Element s2, int offset1, int offset2)
s1 - one sections2 - another sectionprotected static Iterable<LayoutDecision> allDecisions(Map<ObjectFile.Element,LayoutDecisionMap> decisions)
protected static Iterable<LayoutDecision> decisionsByKind(LayoutDecision.Kind kind, Map<ObjectFile.Element,LayoutDecisionMap> decisions)
public Map<ObjectFile.Element,LayoutDecisionMap> getDecisionsTaken()
protected Iterable<ObjectFile.Element> elementsMappedOnPage(long vaddr, Map<ObjectFile.Element,LayoutDecisionMap> alreadyDecided)
protected ElementList createElementList()
public List<ObjectFile.Element> getElements()
public ObjectFile.Element elementForName(String s)
public String nameForElement(ObjectFile.Element e)
public List<ObjectFile.Section> getSections()
public abstract Set<ObjectFile.Segment> getSegments()
public ObjectFile.Header getHeader()
ObjectFile.Header. Depending on the mode of the object file (read
or write), the header is newly created or read from the buffer.public ObjectFile.Element getOffsetBootstrapElement()
public final void write(FileChannel outputChannel)
public int bake(List<ObjectFile.Element> sortedObjectFileElements)
public Map<ObjectFile.Element,LayoutDecisionMap> getDecisionsByElement()
public void writeBuffer(List<ObjectFile.Element> sortedObjectFileElements, ByteBuffer out)
protected abstract int getMinimumFileSize()
public static int getHostPageSize()
public void setPageSize(int pageSize)
public int getPageSize()
public int getPageSizeShift()
public int roundUpToPageSize(int x)
public abstract ObjectFile.Symbol createDefinedSymbol(String name, ObjectFile.Element baseSection, long position, int size, boolean isCode, boolean isGlobal)
public abstract ObjectFile.Symbol createUndefinedSymbol(String name, int size, boolean isCode)
protected abstract SymbolTable createSymbolTable()
public abstract SymbolTable getSymbolTable()
public final SymbolTable getOrCreateSymbolTable()