From: Rafael Espindola Date: Mon, 2 Apr 2018 21:11:13 +0000 (+0000) Subject: Define TrapInst for ppc64. X-Git-Tag: llvmorg-7.0.0-rc1~9176 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e7d6fc2c6e0e3f229c5060a985b17015738da07;p=platform%2Fupstream%2Fllvm.git Define TrapInst for ppc64. This is nice for testing since it is the first TrapInst whose bytes are not all the same. llvm-svn: 329014 --- diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp index 8480915..0da898d 100644 --- a/lld/ELF/Arch/PPC64.cpp +++ b/lld/ELF/Arch/PPC64.cpp @@ -93,6 +93,8 @@ PPC64::PPC64() { // And because the lowest non-zero 256M boundary is 0x10000000, PPC64 linkers // use 0x10000000 as the starting address. DefaultImageBase = 0x10000000; + + TrapInstr = 0x7fe00008; } static uint32_t getEFlags(InputFile *File) { diff --git a/lld/test/ELF/fill-trap-ppc.s b/lld/test/ELF/fill-trap-ppc.s new file mode 100644 index 0000000..f885f73 --- /dev/null +++ b/lld/test/ELF/fill-trap-ppc.s @@ -0,0 +1,30 @@ +# REQUIRES: ppc + +# RUN: llvm-mc -filetype=obj -triple=powerpc64le-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t.ppc64le +# RUN: llvm-readobj -program-headers %t.ppc64le | FileCheck %s +# RUN: od -Ax -t x4 -N16 -j0x10ff0 %t.ppc64le | FileCheck %s -check-prefix=FILL + +# RUN: llvm-mc -filetype=obj -triple=powerpc64-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t.ppc64 +# RUN: llvm-readobj -program-headers %t.ppc64 | FileCheck %s +# RUN: od -Ax -t x4 -N16 -j0x10ff0 %t.ppc64 | FileCheck %s -check-prefix=FILL + +# CHECK: ProgramHeader { +# CHECK: Type: PT_LOAD +# CHECK: Offset: 0x10000{{$}} +# 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 its end. +# FILL: 010ff0 7fe00008 7fe00008 7fe00008 7fe00008 + +.globl _start +_start: + nop