1# REQUIRES: aarch64 2# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %p/Inputs/aarch64-tstbr14-reloc.s -o %t1 3# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %t2 4# RUN: ld.lld %t1 %t2 -o %t 5# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s 6# RUN: ld.lld -shared %t1 %t2 -o %t3 7# RUN: llvm-objdump -d --no-show-raw-insn %t3 | FileCheck --check-prefix=DSO %s 8# RUN: llvm-readobj -S -r %t3 | FileCheck -check-prefix=DSOREL %s 9 10# CHECK: <_foo>: 11# CHECK-NEXT: 210120: nop 12# CHECK-NEXT: 210124: nop 13# CHECK-NEXT: 210128: nop 14# CHECK-NEXT: 21012c: nop 15# CHECK: <_bar>: 16# CHECK-NEXT: 210130: nop 17# CHECK-NEXT: 210134: nop 18# CHECK-NEXT: 210138: nop 19# CHECK: <_start>: 20# CHECK-NEXT: 21013c: tbnz w3, #15, 0x210120 <_foo> 21# CHECK-NEXT: 210140: tbnz w3, #15, 0x210130 <_bar> 22# CHECK-NEXT: 210144: tbz x6, #45, 0x210120 <_foo> 23# CHECK-NEXT: 210148: tbz x6, #45, 0x210130 <_bar> 24 25#DSOREL: Section { 26#DSOREL: Index: 27#DSOREL: Name: .got.plt 28#DSOREL-NEXT: Type: SHT_PROGBITS 29#DSOREL-NEXT: Flags [ 30#DSOREL-NEXT: SHF_ALLOC 31#DSOREL-NEXT: SHF_WRITE 32#DSOREL-NEXT: ] 33#DSOREL-NEXT: Address: 0x30420 34#DSOREL-NEXT: Offset: 0x420 35#DSOREL-NEXT: Size: 40 36#DSOREL-NEXT: Link: 0 37#DSOREL-NEXT: Info: 0 38#DSOREL-NEXT: AddressAlignment: 8 39#DSOREL-NEXT: EntrySize: 0 40#DSOREL-NEXT: } 41#DSOREL: Relocations [ 42#DSOREL-NEXT: Section ({{.*}}) .rela.plt { 43#DSOREL-NEXT: 0x30438 R_AARCH64_JUMP_SLOT _foo 44#DSOREL-NEXT: 0x30440 R_AARCH64_JUMP_SLOT _bar 45#DSOREL-NEXT: } 46#DSOREL-NEXT:] 47 48#DSO: Disassembly of section .text: 49#DSO-EMPTY: 50#DSO-NEXT: <_foo>: 51#DSO-NEXT: 102f8: nop 52#DSO-NEXT: 102fc: nop 53#DSO-NEXT: 10300: nop 54#DSO-NEXT: 10304: nop 55#DSO: <_bar>: 56#DSO-NEXT: 10308: nop 57#DSO-NEXT: 1030c: nop 58#DSO-NEXT: 10310: nop 59#DSO: <_start>: 60#DSO-NEXT: 10314: tbnz w3, #15, 0x10350 <_foo@plt> 61#DSO-NEXT: 10318: tbnz w3, #15, 0x10360 <_bar@plt> 62#DSO-NEXT: 1031c: tbz x6, #45, 0x10350 <_foo@plt> 63#DSO-NEXT: 10320: tbz x6, #45, 0x10360 <_bar@plt> 64#DSO-EMPTY: 65#DSO-NEXT: Disassembly of section .plt: 66#DSO-EMPTY: 67#DSO-NEXT: <.plt>: 68#DSO-NEXT: 10330: stp x16, x30, [sp, #-16]! 69#DSO-NEXT: 10334: adrp x16, #131072 70#DSO-NEXT: 10338: ldr x17, [x16, #1072] 71#DSO-NEXT: 1033c: add x16, x16, #1072 72#DSO-NEXT: 10340: br x17 73#DSO-NEXT: 10344: nop 74#DSO-NEXT: 10348: nop 75#DSO-NEXT: 1034c: nop 76#DSO-EMPTY: 77#DSO-NEXT: <_foo@plt>: 78#DSO-NEXT: 10350: adrp x16, #131072 79#DSO-NEXT: 10354: ldr x17, [x16, #1080] 80#DSO-NEXT: 10358: add x16, x16, #1080 81#DSO-NEXT: 1035c: br x17 82#DSO-EMPTY: 83#DSO-NEXT: <_bar@plt>: 84#DSO-NEXT: 10360: adrp x16, #131072 85#DSO-NEXT: 10364: ldr x17, [x16, #1088] 86#DSO-NEXT: 10368: add x16, x16, #1088 87#DSO-NEXT: 1036c: br x17 88 89.globl _start 90_start: 91 tbnz w3, #15, _foo 92 tbnz w3, #15, _bar 93 tbz x6, #45, _foo 94 tbz x6, #45, _bar 95