public void setImpl(ElementImpl impl) { assert impl == null; this.impl = impl; if (impl.isLoadable()) { flags.add(ELFSectionFlag.ALLOC); } else { flags.remove(ELFSectionFlag.ALLOC); } }
public void setImpl(ElementImpl impl) { assert impl == null; this.impl = impl; // Use READ to signify a loadable section if (impl.isLoadable()) { flags.add(PECoffSectionFlag.READ); } else { flags.remove(PECoffSectionFlag.READ); } }
@Override public boolean isLoadable() { /* * NOTE the following distinction: whether a section is loadable is a property of the * section (abstractly). (This is also why we we delegate to the impl.) * * Whether an PECoff section is explicitly loaded is a property of the PHT contents. The * code in ObjectFile WILL assign vaddrs for all loadable sections! So * isExplicitlyLoaded is actually irrelevant. */ // if we are our own impl, just go with what the flags say if (getImpl() == this) { return flags.contains(PECoffSectionFlag.READ); } // otherwise, the impl and flags should agree boolean implIsLoadable = getImpl().isLoadable(); // our constructors and impl-setter are responsible for syncing flags with impl assert implIsLoadable == flags.contains(PECoffSectionFlag.READ); return implIsLoadable; }
@Override public boolean isLoadable() { if (getImpl() == this) { return true; } return getImpl().isLoadable(); }
@Override public boolean isLoadable() { /* * NOTE the following distinction: whether a section is loadable is a property of the * section (abstractly). (This is also why we we delegate to the impl.) * * Whether an ELF section is explicitly loaded is a property of the PHT contents. The * code in ObjectFile WILL assign vaddrs for all loadable sections! So * isExplicitlyLoaded is actually irrelevant. */ // if we are our own impl, just go with what the flags say if (getImpl() == this) { return flags.contains(ELFSectionFlag.ALLOC); } // otherwise, the impl and flags should agree boolean implIsLoadable = getImpl().isLoadable(); // our constructors and impl-setter are responsible for syncing flags with impl assert implIsLoadable == flags.contains(ELFSectionFlag.ALLOC); return implIsLoadable; }
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);