[ELF] - Revert r311310 "[ELF] - Do not forget to fill last bytes of PT_LOADs with trap instructions."

It broke BB:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/11792/steps/test_lld/logs/stdio

llvm-svn: 311314
This commit is contained in:
George Rimar 2017-08-21 08:13:45 +00:00
parent 8902bb8e62
commit 09a6945b48
3 changed files with 4 additions and 29 deletions

View File

@ -1856,7 +1856,7 @@ template <class ELFT> void Writer<ELFT>::writeSectionsBinary() {
}
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);
}

View File

@ -48,15 +48,15 @@ _start:
# DEFAULT: Contents of section .note.test:
# DEFAULT: Contents of section .note.gnu.build-id:
# DEFAULT-NEXT: 04000000 08000000 03000000 474e5500 ............GNU.
# DEFAULT-NEXT: b0148597 ba5eb7e9
# DEFAULT-NEXT: d618a375 bc6301ec
# MD5: Contents of section .note.gnu.build-id:
# MD5-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.
# MD5-NEXT: dce3bcaf 5219454c e89a1fc7 86ab17bd
# MD5-NEXT: 051084fe ce1f30ed e035b79e 11262808
# SHA1: Contents of section .note.gnu.build-id:
# SHA1-NEXT: 04000000 14000000 03000000 474e5500 ............GNU.
# SHA1-NEXT: 2f716666 fe3668fe 370a02a1 579c3eb2
# SHA1-NEXT: c70b9aec 903fd291 8b677cd8 1e04f8b6
# UUID: Contents of section .note.gnu.build-id:
# UUID-NEXT: 04000000 10000000 03000000 474e5500 ............GNU.

View File

@ -1,25 +0,0 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2
# RUN: llvm-readobj -program-headers %t2 | FileCheck %s
# RUN: hexdump -v -s 0x0001ff0 %t2 | FileCheck %s -check-prefix=FILL
# CHECK: ProgramHeader {
# CHECK: Type: PT_LOAD
# CHECK: Offset: 0x1000
# CHECK-NEXT: VirtualAddress:
# CHECK-NEXT: PhysicalAddress:
# CHECK-NEXT: FileSize: 4096
# CHECK-NEXT: MemSize:
# CHECK-NEXT: Flags [
# CHECK-NEXT: PF_R
# CHECK-NEXT: PF_X
# CHECK-NEXT: ]
## Check that executable page is filled with traps at it's end.
# FILL: 0001ff0 cccc cccc cccc cccc cccc cccc cccc cccc
.globl _start
_start:
nop