85 lines · plain
1# REQUIRES: aarch642 3## Test that the branch-to-branch optimization follows the links4## from f1 -> f2 -> f3 and updates all references to point to f3.5 6# RUN: llvm-mc -filetype=obj -triple=aarch64-pc-linux %s -o %t.o7# RUN: ld.lld %t.o -o %t --branch-to-branch --emit-relocs8# RUN: llvm-objdump -d -s %t | FileCheck --check-prefixes=CHECK,B2B %s9# RUN: llvm-objdump -r %t | FileCheck --check-prefixes=RELOC,B2B-RELOC %s10# RUN: ld.lld %t.o -o %t -O2 --emit-relocs11# RUN: llvm-objdump -d -s %t | FileCheck --check-prefixes=CHECK,B2B %s12# RUN: llvm-objdump -r %t | FileCheck --check-prefixes=RELOC,B2B-RELOC %s13 14## Test that branch-to-branch is disabled by default.15 16# RUN: ld.lld %t.o -o %t --emit-relocs17# RUN: llvm-objdump -d -s %t | FileCheck --check-prefixes=CHECK,NOB2B %s18# RUN: llvm-objdump -r %t | FileCheck --check-prefixes=RELOC,NOB2B-RELOC %s19# RUN: ld.lld %t.o -o %t -O2 --no-branch-to-branch --emit-relocs20# RUN: llvm-objdump -d -s %t | FileCheck --check-prefixes=CHECK,NOB2B %s21# RUN: llvm-objdump -r %t | FileCheck --check-prefixes=RELOC,NOB2B-RELOC %s22 23## Test that branch-to-branch is disabled for preemptible symbols.24 25# RUN: ld.lld %t.o -o %t --branch-to-branch -shared --emit-relocs26# RUN: llvm-objdump -d -s %t | FileCheck --check-prefixes=CHECK,NOB2B %s27# RUN: llvm-objdump -r %t | FileCheck --check-prefixes=RELOC,NOB2B-RELOC %s28 29.section .rodata.vtable,"a"30.globl vtable31vtable:32# B2B: Contents of section .rodata:33# RELOC: RELOCATION RECORDS FOR [.rodata]:34# RELOC-NEXT: OFFSET35# B2B-NEXT: [[VF:[0-9a-f]{8}]]36# B2B-RELOC-NEXT: R_AARCH64_PLT32 f337# NOB2B-RELOC-NEXT: R_AARCH64_PLT32 f138.4byte f1@PLT - vtable39# B2B-SAME: [[VF]]40# B2B-RELOC-NEXT: R_AARCH64_PLT32 f3+0x441# NOB2B-RELOC-NEXT: R_AARCH64_PLT32 f2+0x442.4byte f2@PLT - vtable43# B2B-SAME: [[VF]]44# RELOC-NEXT: R_AARCH64_PLT32 f3+0x845.4byte f3@PLT - vtable46 47.section .text._start,"ax"48.globl _start49# CHECK: <_start>:50# RELOC: RELOCATION RECORDS FOR [.text]:51# RELOC-NEXT: OFFSET52_start:53.cfi_startproc54# B2B: bl {{.*}} <f3>55# B2B-RELOC-NEXT: R_AARCH64_CALL26 f356# NOB2B: bl {{.*}} <f1{{.*}}>57# NOB2B-RELOC-NEXT: R_AARCH64_CALL26 f158bl f159# B2B: b {{.*}} <f3>60# B2B-RELOC-NEXT: R_AARCH64_JUMP26 f361# NOB2B: b {{.*}} <f2{{.*}}>62# NOB2B-RELOC-NEXT: R_AARCH64_JUMP26 f263b f264.cfi_endproc65 66.section .text.f1,"ax"67.globl f168f1:69# B2B-RELOC-NEXT: R_AARCH64_JUMP26 f370# NOB2B-RELOC-NEXT: R_AARCH64_JUMP26 f271b f272 73.section .text.f2,"ax"74.globl f275# CHECK: <f2>:76f2:77# CHECK-NEXT: b {{.*}} <f3{{.*}}>78# RELOC-NEXT: R_AARCH64_JUMP26 f379b f380 81.section .text.f3,"ax"82.globl f383f3:84ret85