2 # RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o
3 # RUN: ld.lld -shared %t.o -o %tout
4 # RUN: llvm-objdump -D --no-show-raw-insn %tout | FileCheck %s
5 # RUN: llvm-readobj -r %tout | FileCheck %s --check-prefix=CHECK-RELOCS
7 # Test that when we take the address of a preemptible ifunc in a shared object
8 # we get R_AARCH64_GLOB_DAT to the symbol as it could be defined in another
9 # link unit and preempt our definition.
12 .type myfunc,@gnu_indirect_function
21 ldr x8
, [x8
, :got_lo12
:myfunc
]
23 # CHECK: 0000000000010284 <main>:
24 ## myfunc's got entry = page(0x20330)-page(0x10284) + 0x330 = 65536 + 816
25 # CHECK-NEXT: 10284: adrp x8, 0x20000
26 # CHECK-NEXT: 10288: ldr x8, [x8, #816]
27 # CHECK-NEXT: 1028c: ret
29 # CHECK: Disassembly of section .got:
31 # CHECK-NEXT: 0000000000020330 <.got>:
33 # CHECK-RELOCS: Relocations [
34 # CHECK-RELOCS-NEXT: Section {{.*}} .rela.dyn {
35 # CHECK-RELOCS-NEXT: 0x20330 R_AARCH64_GLOB_DAT myfunc 0x0
36 # CHECK-RELOCS-NEXT: }
37 # CHECK-RELOCS-NEXT: ]