[PATCH] D45830: Fix trap instruction on pp64
Rafael Avila de Espindola via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 19 11:48:14 PDT 2018
espindola created this revision.
espindola added reviewers: ruiu, sfertile.
Herald added subscribers: kbarton, arichardson, nemanjai, emaste.
The test was passing on a big endian host, but just because od with x4 was compensating for it.
https://reviews.llvm.org/D45830
Files:
ELF/Arch/PPC64.cpp
test/ELF/fill-trap-ppc.s
Index: test/ELF/fill-trap-ppc.s
===================================================================
--- test/ELF/fill-trap-ppc.s
+++ test/ELF/fill-trap-ppc.s
@@ -3,12 +3,12 @@
# 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: od -Ax -t x1 -N16 -j0x10ff0 %t.ppc64le | FileCheck %s -check-prefix=LE
# 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
+# RUN: od -Ax -t x1 -N16 -j0x10ff0 %t.ppc64 | FileCheck %s -check-prefix=BE
# CHECK: ProgramHeader {
# CHECK: Type: PT_LOAD
@@ -23,7 +23,8 @@
# CHECK-NEXT: ]
## Check that executable page is filled with traps at its end.
-# FILL: 010ff0 7fe00008 7fe00008 7fe00008 7fe00008
+# LE: 010ff0 08 00 e0 7f 08 00 e0 7f 08 00 e0 7f 08 00 e0 7f
+# BE: 010ff0 7f e0 00 08 7f e0 00 08 7f e0 00 08 7f e0 00 08
.globl _start
_start:
Index: ELF/Arch/PPC64.cpp
===================================================================
--- ELF/Arch/PPC64.cpp
+++ ELF/Arch/PPC64.cpp
@@ -94,7 +94,8 @@
// use 0x10000000 as the starting address.
DefaultImageBase = 0x10000000;
- TrapInstr = 0x7fe00008;
+ bool IsBE = Config->EKind != ELF64LEKind;
+ TrapInstr = IsBE == sys::IsBigEndianHost ? 0x7fe00008 : 0x0800e07f;
}
static uint32_t getEFlags(InputFile *File) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45830.143139.patch
Type: text/x-patch
Size: 1611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180419/8b685faf/attachment.bin>
More information about the llvm-commits
mailing list