[PATCH] D45182: Define TrapInst for ppc64
Rafael Avila de Espindola via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 2 13:30:21 PDT 2018
espindola created this revision.
espindola added reviewers: sfertile, ruiu.
Herald added subscribers: kbarton, arichardson, nemanjai, emaste.
This is nice for testing since it is the first TrapInst whose bytes are not all the same.
https://reviews.llvm.org/D45182
Files:
ELF/Arch/PPC64.cpp
test/ELF/fill-trap.s
Index: test/ELF/fill-trap.s
===================================================================
--- test/ELF/fill-trap.s
+++ test/ELF/fill-trap.s
@@ -1,13 +1,25 @@
-# REQUIRES: x86
+# REQUIRES: x86, ppc
# 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: od -Ax -x -N16 -j0x1ff0 %t2 | FileCheck %s -check-prefix=FILL
+# RUN: llvm-readobj -program-headers %t2 | FileCheck --check-prefix=CHECK --check-prefix=X86 %s
+# RUN: od -Ax -x -N16 -j0x1ff0 %t2 | FileCheck %s -check-prefix=FILL_X86
+
+# 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 --check-prefix=CHECK --check-prefix=PPC64LE %s
+# RUN: od -Ax -t x4 -N16 -j0x10ff0 %t.ppc64le | FileCheck %s -check-prefix=FILL_PPC64LE
+
+# 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 --check-prefix=CHECK --check-prefix=PPC64 %s
+# RUN: od -Ax -t x4 -N16 -j0x10ff0 %t.ppc64 | FileCheck %s -check-prefix=FILL_PPC64
# CHECK: ProgramHeader {
# CHECK: Type: PT_LOAD
-# CHECK: Offset: 0x1000
+# X86: Offset: 0x1000{{$}}
+# PPC64LE: Offset: 0x10000{{$}}
+# PPC64: Offset: 0x10000{{$}}
# CHECK-NEXT: VirtualAddress:
# CHECK-NEXT: PhysicalAddress:
# CHECK-NEXT: FileSize: 4096
@@ -18,7 +30,11 @@
# CHECK-NEXT: ]
## Check that executable page is filled with traps at its end.
-# FILL: 001ff0 cccc cccc cccc cccc cccc cccc cccc cccc
+# FILL_X86: 001ff0 cccc cccc cccc cccc cccc cccc cccc cccc
+
+# FILL_PPC64LE: 010ff0 7fe00008 7fe00008 7fe00008 7fe00008
+
+# FILL_PPC64: 010ff0 7fe00008 7fe00008 7fe00008 7fe00008
.globl _start
_start:
Index: ELF/Arch/PPC64.cpp
===================================================================
--- ELF/Arch/PPC64.cpp
+++ ELF/Arch/PPC64.cpp
@@ -87,6 +87,8 @@
// 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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45182.140682.patch
Type: text/x-patch
Size: 2244 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180402/177f26ad/attachment.bin>
More information about the llvm-commits
mailing list