[llvm] [BOLT] Fix long jump negative offset issue. (PR #67132)
Vladislav Khmelevsky via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 24 09:22:42 PDT 2023
================
@@ -0,0 +1,111 @@
+# This test checks long call negative offset boundary(0x8000000) for aarch64.
+
+# REQUIRES: system-linux
+
+# RUN: %clang %s -o %t.exe -nostartfiles -fuse-ld=lld -Wl,-z,now,-q \
+# RUN: -Wl,--script=%p/Inputs/long-jmp-offset-boundary.ld
+# RUN: llvm-bolt %t.exe -o %t.bolt.exe -skip-funcs="foo.*"
+# RUN: llvm-objdump -d %t.bolt.exe | FileCheck %s
+# CHECK: 0000000000000100 <foo>:
+# CHECK: 8000100: {{.*}} bl 0x100 <foo>
+
+ .text
+ .section foo_section,"ax", at progbits
+ .globl foo
+ .p2align 2
+ .type foo, at function
+foo:
+ .cfi_startproc
+// %bb.0:
+ ret
+.Lfunc_end0:
+ .size foo, .Lfunc_end0-foo
+ .cfi_endproc
+
+ .section main_section,"ax", at progbits
+ .globl main // -- Begin function main
+ .p2align 2
+ .type main, at function
+main:
+ .cfi_startproc
+// %bb.0:
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+ ldr w0, [sp, #8]
+ ldr w1, [sp, #4]
+
+ mov w8, #100
+ str w8, [sp, #8]
+ mov w8, #200
+ str w8, [sp, #4]
+
+ bl foo
+ ret
+.Lfunc_end1:
+ .size main, .Lfunc_end1-main
----------------
yota9 wrote:
JFYI you may just use .size main, .-main
https://github.com/llvm/llvm-project/pull/67132
More information about the llvm-commits
mailing list