assert s.getImpl().isLoadable() == es.getFlags().contains(ELFSectionFlag.ALLOC); ent.flags = ObjectFile.flagSetAsLong(es.getFlags()); ent.fileOffset = (int) alreadyDecided.get(es).getDecidedValue(LayoutDecision.Kind.OFFSET);
if (target instanceof DataSectionReference) { long addend = ((DataSectionReference) target).getOffset() - info.getExplicitAddend(); sectionImpl.markRelocationSite(offset, info.getRelocationSize(), info.getRelocationKind(), roDataSection.getName(), false, addend); } else if (target instanceof CGlobalDataReference) { CGlobalDataReference ref = (CGlobalDataReference) target; CGlobalDataImpl<?> data = dataInfo.getData(); long addend = RWDATA_CGLOBALS_PARTITION_OFFSET + dataInfo.getOffset() - info.getExplicitAddend(); sectionImpl.markRelocationSite(offset, info.getRelocationSize(), info.getRelocationKind(), rwDataSection.getName(), false, addend); if (dataInfo.isSymbolReference()) { // create relocation for referenced symbol if (objectFile.getSymbolTable().getSymbol(data.symbolName) == null) { objectFile.createUndefinedSymbol(data.symbolName, 0, true); ProgbitsSectionImpl baseSectionImpl = (ProgbitsSectionImpl) rwDataSection.getImpl(); int offsetInSection = Math.toIntExact(RWDATA_CGLOBALS_PARTITION_OFFSET + dataInfo.getOffset()); baseSectionImpl.markRelocationSite(offsetInSection, wordSize, RelocationKind.DIRECT, data.symbolName, false, 0L);
objectFile.createDefinedSymbol(textSection.getName(), textSection, 0, 0, false, false); objectFile.createDefinedSymbol("__svm_text_end", textSection, textSectionSize, 0, false, true); objectFile.createDefinedSymbol(roDataSection.getName(), roDataSection, 0, 0, false, false); objectFile.createDefinedSymbol(rwDataSection.getName(), rwDataSection, 0, 0, false, false); final String heapSectionName = SectionName.SVM_HEAP.getFormatDependentName(objectFile.getFormat()); heapSection = objectFile.newProgbitsSection(heapSectionName, objectFile.getPageSize(), writable, false, heapSectionImpl); objectFile.createDefinedSymbol(heapSection.getName(), heapSection, 0, 0, false, true); heap.setReadOnlySection(heapSection.getName(), 0); long writableSectionOffset = heap.getReadOnlySectionSize(); heap.setWritableSection(heapSection.getName(), writableSectionOffset); defineDataSymbol(Isolates.IMAGE_HEAP_BEGIN_SYMBOL_NAME, heapSection, 0); defineDataSymbol(Isolates.IMAGE_HEAP_END_SYMBOL_NAME, heapSection, heapSize); heapSectionBuffer = null; heapSectionImpl = null; heap.setReadOnlySection(roDataSection.getName(), roConstantsEndOffset); heap.setWritableSection(rwDataSection.getName(), rwGlobalsEndOffset);
@Override public int getAlignment() { return getElement().getAlignment(); }
@Override public MachOObjectFile getOwner() { return (MachOObjectFile) super.getOwner(); } }