public ELFProgbitsSection(ELFObjectFile owner, String name, int alignment, ProgbitsSectionImpl impl, EnumSet<ELFSectionFlag> flags) { super(owner, name, alignment, ELFObjectFile.SectionType.PROGBITS, impl != null ? impl : new BasicProgbitsSectionImpl(new byte[0]), flags); // this *is* necessary because the newProgbitsSection helper doesn't see the impl if (impl == null) { // i.e. if *we* just created this.impl in the "? :" above this.impl.setElement(this); } }
@Override public RelocationRecord markRelocationSite(int offset, int length, RelocationKind k, String symbolName, boolean useImplicitAddend, Long explicitAddend) { return ((RelocatableSectionImpl) getElement()).markRelocationSite(offset, length, ByteBuffer.wrap(getContent()).order(getOwner().getByteOrder()), k, symbolName, useImplicitAddend, explicitAddend); }
@Override public final RelocationRecord markRelocationSite(int offset, int length, ByteBuffer bb, RelocationKind k, String symbolName, boolean useImplicitAddend, Long explicitAddend) { assert getContent() == null || bb.array() == getContent(); return ((RelocatableSectionImpl) getElement()).markRelocationSite(offset, length, bb, k, symbolName, useImplicitAddend, explicitAddend); }
public List<Section> getElements() { return Collections.singletonList(getElement()); }
@Override public Set<BuildDependency> getDependencies(Map<Element, LayoutDecisionMap> decisions) { // we can get away with minimal dependencies, because we have no // content-> size dependency by default return ObjectFile.minimalDependencies(decisions, getElement()); }
public PECoffProgbitsSection(PECoffObjectFile owner, String name, int alignment, ProgbitsSectionImpl impl, EnumSet<PECoffSectionFlag> flags) { super(owner, name, alignment, impl != null ? impl : new BasicProgbitsSectionImpl(new byte[0]), flags); // this *is* necessary because the newProgbitsSection helper doesn't see the impl if (impl == null) { // i.e. if *we* just created this.impl in the "? :" above this.impl.setElement(this); } }
@Override public Element getOrCreateRelocationElement(boolean useImplicitAddend) { // FIXME: This looks suspicious: turning an Element back into an Impl? return ((RelocatableSectionImpl) getElement()).getOrCreateRelocationElement(useImplicitAddend); }
public ELFProgbitsSection(ELFObjectFile owner, String name, int alignment, EnumSet<ELFSectionFlag> flags, int shtIndex, InputDisassembler in, int size) { super(owner, name, alignment, ELFObjectFile.SectionType.PROGBITS, new BasicProgbitsSectionImpl(in.readBlob(size)), flags, shtIndex); // this *is* necessary because the newProgbitsSection helper doesn't see the impl this.impl.setElement(this); }
@Override public int getAlignment() { return getElement().getAlignment(); }
public PECoffProgbitsSection(PECoffObjectFile owner, String name, int alignment, EnumSet<PECoffSectionFlag> flags, int shtIndex, InputDisassembler in, int size) { super(owner, name, alignment, new BasicProgbitsSectionImpl(in.readBlob(size)), flags, shtIndex); // this *is* necessary because the newProgbitsSection helper doesn't see the impl this.impl.setElement(this); }
@Override public MachOUserDefinedSection newUserDefinedSection(Segment segment, String name, int alignment, ElementImpl impl) { assert segment != null; ElementImpl ourImpl; if (impl == null) { ourImpl = new BasicProgbitsSectionImpl((Section) null); } else { ourImpl = impl; } MachOUserDefinedSection userDefined = new MachOUserDefinedSection(this, name, alignment, (Segment64Command) segment, SectionType.REGULAR, ourImpl); ourImpl.setElement(userDefined); return userDefined; }
final ProgbitsSectionImpl roDataImpl = new BasicProgbitsSectionImpl(roDataBuffer.getBytes()); final String roDataSectionName = SectionName.RODATA.getFormatDependentName(objectFile.getFormat()); roDataSection = objectFile.newProgbitsSection(roDataSectionName, objectFile.getPageSize(), false, false, roDataImpl); final ProgbitsSectionImpl rwDataImpl = new BasicProgbitsSectionImpl(rwDataBuffer.getBytes()); final String rwDataSectionName = SectionName.DATA.getFormatDependentName(objectFile.getFormat()); rwDataSection = objectFile.newProgbitsSection(rwDataSectionName, objectFile.getPageSize(), true, false, rwDataImpl); heapSectionImpl = new BasicProgbitsSectionImpl(heapSectionBuffer.getBytes()); final String heapSectionName = SectionName.SVM_HEAP.getFormatDependentName(objectFile.getFormat()); heapSection = objectFile.newProgbitsSection(heapSectionName, objectFile.getPageSize(), writable, false, heapSectionImpl);