[PATCH] D122100: [BOLT] AArch64: Read all static relocations

Vladislav Khmelevsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 3 09:04:19 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3b1314f4de63: [BOLT] AArch64: Read all static relocations (authored by yota9).

Changed prior to commit:
  https://reviews.llvm.org/D122100?vs=416780&id=420062#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122100

Files:
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/test/AArch64/constant-island-alignment.s
  bolt/test/AArch64/constant_island_pie_update.s


Index: bolt/test/AArch64/constant_island_pie_update.s
===================================================================
--- /dev/null
+++ bolt/test/AArch64/constant_island_pie_update.s
@@ -0,0 +1,38 @@
+// This test checks that the constant island value is updated if it
+// has dynamic relocation.
+
+# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
+# RUN:   %s -o %t.o
+# RUN: %clang %cflags -fPIC -pie %t.o -o %t.exe -Wl,-q -nostdlib -Wl,-z,notext
+# RUN: llvm-bolt %t.exe -o %t.bolt -use-old-text=0 -lite=0
+# RUN: llvm-objdump -j .text -dR %t.bolt | FileCheck %s
+
+# CHECK: R_AARCH64_RELATIVE *ABS*+0x[[#%x,ADDR:]]
+# CHECK: [[#ADDR]] <exitLocal>:
+# CHECK: {{.*}} <$d>:
+# CHECK-NEXT: {{.*}} .word 0x{{[0]+}}[[#ADDR]]
+# CHECK-NEXT: {{.*}} .word 0x00000000
+
+  .text
+  .align 4
+  .local exitLocal
+  .type exitLocal, %function
+exitLocal:
+  add x1, x1, #1
+  add x1, x1, #1
+  ret
+  .size exitLocal, .-exitLocal
+
+  .global _start
+  .type _start, %function
+_start:
+  mov x0, #0
+  adr x1, .Lci
+  ldr x1, [x1]
+  blr x1
+  mov x0, #1
+  bl exitLocal
+  nop
+.Lci:
+  .xword exitLocal
+  .size _start, .-_start
Index: bolt/test/AArch64/constant-island-alignment.s
===================================================================
--- bolt/test/AArch64/constant-island-alignment.s
+++ bolt/test/AArch64/constant-island-alignment.s
@@ -5,7 +5,7 @@
 # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
 # RUN:   %s -o %t.o
 # RUN: %clang %cflags -fPIC -pie %t.o -o %t.exe -Wl,-q \
-# RUN:    -nostartfiles -nodefaultlibs -lc
+# RUN:    -nostartfiles -nodefaultlibs -Wl,-z,notext
 # RUN: llvm-bolt %t.exe -o %t.bolt -use-old-text=0 -lite=0 -trap-old-code
 # RUN: llvm-objdump -d --disassemble-symbols='$d' %t.bolt | FileCheck %s
 
@@ -21,7 +21,7 @@
 .type exitOk, %function
 exitOk:
   mov x0, #0
-  bl exit
+  ret
 
 .global _start
 .type _start, %function
@@ -29,8 +29,8 @@
   adrp x0, .Lci
   ldr x0, [x0, #:lo12:.Lci]
   blr x0
-  mov x1, #1
-  bl exit
+  mov x0, #1
+  ret
   nop
 # CHECK: {{0|8}} <$d>:
 .Lci:
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -2350,7 +2350,7 @@
         continue;
     }
 
-    if (BC->getDynamicRelocationAt(Rel.getOffset())) {
+    if (!IsAArch64 && BC->getDynamicRelocationAt(Rel.getOffset())) {
       LLVM_DEBUG(
           dbgs() << "BOLT-DEBUG: address 0x"
                  << Twine::utohexstr(Rel.getOffset())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122100.420062.patch
Type: text/x-patch
Size: 2547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220403/e851da4f/attachment.bin>


More information about the llvm-commits mailing list