[lld] r330386 - Fix trap instruction on pp64.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 18:21:24 PDT 2018


Author: rafael
Date: Thu Apr 19 18:21:24 2018
New Revision: 330386

URL: http://llvm.org/viewvc/llvm-project?rev=330386&view=rev
Log:
Fix trap instruction on pp64.

The test was passing on a big endian host, but just because od with x4
was compensating for it.

Modified:
    lld/trunk/ELF/Arch/PPC64.cpp
    lld/trunk/test/ELF/fill-trap-ppc.s

Modified: lld/trunk/ELF/Arch/PPC64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC64.cpp?rev=330386&r1=330385&r2=330386&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC64.cpp (original)
+++ lld/trunk/ELF/Arch/PPC64.cpp Thu Apr 19 18:21:24 2018
@@ -94,7 +94,8 @@ PPC64::PPC64() {
   // use 0x10000000 as the starting address.
   DefaultImageBase = 0x10000000;
 
-  TrapInstr = 0x7fe00008;
+  TrapInstr =
+      (Config->IsLE == sys::IsLittleEndianHost) ? 0x7fe00008 : 0x0800e07f;
 }
 
 static uint32_t getEFlags(InputFile *File) {

Modified: lld/trunk/test/ELF/fill-trap-ppc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/fill-trap-ppc.s?rev=330386&r1=330385&r2=330386&view=diff
==============================================================================
--- lld/trunk/test/ELF/fill-trap-ppc.s (original)
+++ lld/trunk/test/ELF/fill-trap-ppc.s Thu Apr 19 18:21:24 2018
@@ -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:




More information about the llvm-commits mailing list