Merge remote-tracking branch 'origin/patch'

This commit is contained in:
ghidra1 2021-07-16 17:47:45 -04:00
commit e7cee41533

View file

@ -2707,8 +2707,11 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
if (block == null) { if (block == null) {
// Create new zeroed segment block with no bytes from file // Create new zeroed segment block with no bytes from file
String blockName = String.format("%s%d", SEGMENT_NAME_PREFIX, i); String blockName = String.format("%s%d", SEGMENT_NAME_PREFIX, i);
memory.createInitializedBlock(blockName, expandStart, expandSize, (byte) 0, MemoryBlock newBlock = memory.createInitializedBlock(blockName, expandStart,
expandSize, (byte) 0,
monitor, false); monitor, false);
newBlock.setSourceName(BLOCK_SOURCE_NAME);
newBlock.setComment("Zero-initialized segment");
} }
else { else {
// Expand tail end of segment which had portion loaded from file // Expand tail end of segment which had portion loaded from file
@ -2716,7 +2719,8 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
MemoryBlock expandBlock = MemoryBlock expandBlock =
memory.createInitializedBlock(block.getName() + ".expand", expandStart, memory.createInitializedBlock(block.getName() + ".expand", expandStart,
expandSize, (byte) 0, monitor, false); expandSize, (byte) 0, monitor, false);
memory.join(block, expandBlock); MemoryBlock extBlock = memory.join(block, expandBlock);
extBlock.setComment(extBlock.getComment() + " (zero-extended)");
joinProgramTreeFragments(oldBlockEnd, expandStart); joinProgramTreeFragments(oldBlockEnd, expandStart);
} }
} }
@ -2819,8 +2823,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
long addr = elfProgramHeader.getVirtualAddress(); long addr = elfProgramHeader.getVirtualAddress();
long loadSizeBytes = elfProgramHeader.getAdjustedLoadSize(); long loadSizeBytes = elfProgramHeader.getAdjustedLoadSize();
long fullSizeBytes = long fullSizeBytes = elfProgramHeader.getAdjustedMemorySize();
elfProgramHeader.getAdjustedMemorySize() * space.getAddressableUnitSize();
boolean maintainExecuteBit = elf.e_shnum() == 0; boolean maintainExecuteBit = elf.e_shnum() == 0;
@ -3289,7 +3292,7 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
@Override @Override
protected MemoryBlock createUninitializedBlock(MemoryLoadable loadable, boolean isOverlay, protected MemoryBlock createUninitializedBlock(MemoryLoadable loadable, boolean isOverlay,
String name, Address start, long dataLength, String comment, boolean r, boolean w, String name, Address start, long dataLength, String comment, boolean r, boolean w,
boolean x) throws IOException, AddressOverflowException, CancelledException { boolean x) throws IOException, AddressOverflowException {
// TODO: MemoryBlockUtil poorly and inconsistently handles duplicate name errors (can throw RuntimeException). // TODO: MemoryBlockUtil poorly and inconsistently handles duplicate name errors (can throw RuntimeException).
// Are we immune from such errors? If not, how should they be handled? // Are we immune from such errors? If not, how should they be handled?