@Override protected boolean elementsCanSharePage(Element s1, Element s2, int off1, int off2) { if (s1 instanceof PECoffSection && s2 instanceof PECoffSection) { PECoffSection es1 = (PECoffSection) s1; PECoffSection es2 = (PECoffSection) s2; boolean flagsCompatible = PECoffSectionFlag.getMemSegmentFlags(es1.getFlags()) == PECoffSectionFlag.getMemSegmentFlags(es2.getFlags()); return flagsCompatible && super.elementsCanSharePage(es1, es2, off1, off2); } else if (s1 instanceof PECoffSection || s2 instanceof PECoffSection) { // If one element is a PECoffSection then don't share pages. // Could try to share READ only PECoffSections with reloctab, symtab etc. return false; } else { // There are no PECoffSections, the page is read-only assert !(s1 instanceof PECoffSection); assert !(s2 instanceof PECoffSection); return true; } }
@Override protected boolean elementsCanSharePage(Element s1, Element s2, int off1, int off2) { assert s1 instanceof ELFSection; assert s2 instanceof ELFSection; ELFSection es1 = (ELFSection) s1; ELFSection es2 = (ELFSection) s2; boolean flagsCompatible = ELFSectionFlag.flagSetAsIfSegmentFlags(es1.getFlags()).equals(ELFSectionFlag.flagSetAsIfSegmentFlags(es2.getFlags())); return flagsCompatible && super.elementsCanSharePage(es1, es2, off1, off2); }
mustStartNewPage |= !el.getOwner().elementsCanSharePage(el, alreadyMapped, fileOffset, (int) alreadyDecided.get(alreadyMapped).getDecidedValue(LayoutDecision.Kind.OFFSET)); el.getOwner().elementsCanSharePage(el, predElement, myOffset, (int) alreadyDecided.get(predElement).getDecidedValue(LayoutDecision.Kind.OFFSET)); boolean predSectionIsAlloc = predElement.isLoadable();