[ELF] - Recommit "[ELF] - Do not forget to fill last bytes of PT_LOADs with trap instructions."
With fix: explicitly specify ouput format for hexdump tool call.
Original commit message:
[ELF] - Do not forget to fill last bytes of PT_LOADs with trap instructions.
Previously last 4 bytes of executable loads
were not filled with trap instructions,
patch fixes this bug.
Differential revision: https://reviews.llvm.org/D36262
llvm-svn: 311315
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 2bbf654..e12de22 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1856,7 +1856,7 @@
}
static void fillTrap(uint8_t *I, uint8_t *End) {
- for (; I + 4 < End; I += 4)
+ for (; I + 4 <= End; I += 4)
memcpy(I, &Target->TrapInstr, 4);
}