llvm-project/bolt/test/AArch64/long-jmp-offset-boundary.s
qijitao bae41ff57e
[BOLT] Fix long jump negative offset issue. (#67132)
In instruction encoding, the relative offset address of the PC is
signed, that is, the number of positive offset bits and the number of
negative offset bits is asymmetric. Therefore, the maximum and minimum
values are used to replace Mask to determine the boundary.

Co-authored-by: qijitao <qijitao@hisilicon.com>
2023-10-08 01:06:10 +04:00

32 lines
863 B
ArmAsm

# This test checks long call negative offset boundary(0x8000000) for aarch64.
# REQUIRES: system-linux
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown \
# RUN: %s -o %t.o
# RUN: %clang %cflags %t.o -o %t.exe -nostartfiles -fuse-ld=lld -Wl,-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 -j .text --print-imm-hex %t.bolt.exe | FileCheck %s
# The default alignment of the new program header table and the new text is
# HugePageSize(2MB).
# CHECK: [[#%x,ADDR:]]: [[#]] bl
# CHECK-SAME: 0x[[#ADDR-0x8000000]] <foo>
.text
.section foo_section,"ax",@progbits
.globl foo
.type foo,@function
foo:
ret
.size foo, .-foo
.section main_section,"ax",@progbits
.globl _start
.type _start,@function
_start:
bl foo
ret
.size _start, .-_start