[PATCH] D124270: [BOLT] fixed r_aarch64_prelxx test

Alexey Moksyakov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 11:01:40 PDT 2022


yavtuk updated this revision to Diff 424541.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124270/new/

https://reviews.llvm.org/D124270

Files:
  bolt/test/runtime/AArch64/r_aarch64_prelxx.s


Index: bolt/test/runtime/AArch64/r_aarch64_prelxx.s
===================================================================
--- bolt/test/runtime/AArch64/r_aarch64_prelxx.s
+++ bolt/test/runtime/AArch64/r_aarch64_prelxx.s
@@ -1,4 +1,12 @@
 // This test checks processing of R_AARCH64_PREL64/32/16 relocations
+// S + A - P = Value
+// S = P - A + Value
+
+// mul(D1,0x100) == << 8
+// mul(D2,0x10000) == << 16
+// mul(D3,0x1000000) == << 24
+
+// REQUIRES: system-linux
 
 // RUN: %clang %cflags -nostartfiles -nostdlib %s -o %t.exe -Wl,-q \
 // RUN:     -Wl,-z,max-page-size=4
@@ -9,12 +17,25 @@
 // CHECKPREL-NEXT:  R_AARCH64_PREL64      {{.*}} _start + 8
 
 // RUN: llvm-bolt %t.exe -o %t.bolt
-// RUN: llvm-readobj -S --section-data %t.bolt | FileCheck %s
+// RUN: llvm-objdump -D %t.bolt | FileCheck %s --check-prefix=CHECKPREL32
+
+// CHECKPREL32: [[#%x,DATATABLEADDR:]] <datatable>:
+// CHECKPREL32-NEXT: 00:
+// CHECKPREL32-NEXT: 04: [[#%x,D0:]] [[#%x,D1:]] [[#%x,D2:]] [[#%x,D3:]]
 
-// CHECK: Name: .data
-// CHECK: SectionData (
-// CHECK:   0000: FCFF0000 44FF3F00 44FF3F00 00000000
-// CHECK: )
+// 4 is offset in datatable
+// 8 is addend
+// CHECKPREL32: [[#DATATABLEADDR + 4 - 8 + D0 + mul(D1,0x100) + mul(D2,0x10000) + mul(D3,0x1000000)]] <_start>:
+
+// RUN: llvm-objdump -D %t.bolt | FileCheck %s --check-prefix=CHECKPREL64
+// CHECKPREL64: [[#%x,DATATABLEADDR:]] <datatable>:
+// CHECKPREL64-NEXT: 00:
+// CHECKPREL64-NEXT: 04: [[#%x,D0:]] [[#%x,D1:]] [[#%x,D2:]] [[#%x,D3:]]
+// CHECKPREL64-NEXT: 08: [[#%.0x,D0:]] [[#%.0x,D1:]] [[#%.0x,D2:]] [[#%.0x,D3:]]
+
+// 8 is offset in datatable
+// 12 is addend
+// CHECKPREL64: [[#DATATABLEADDR + 8 - 12 + D0 + mul(D1,0x100) + mul(D2,0x10000) + mul(D3,0x1000000)]] <_start>:
 
   .text
   .align 4
@@ -29,7 +50,8 @@
 dummy:
   .word 0
 
-.section .data
+  .data
+  .align 4
 datatable:
   .hword dummy - datatable
   .align 2


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124270.424541.patch
Type: text/x-patch
Size: 1887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220422/5d89bd26/attachment.bin>


More information about the llvm-commits mailing list