38 lines · plain
1# REQUIRES: aarch642# RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o3# RUN: ld.lld -shared %t.o -o %tout4# RUN: llvm-objdump --no-print-imm-hex -D --no-show-raw-insn %tout | FileCheck %s5# RUN: llvm-readobj -r %tout | FileCheck %s --check-prefix=CHECK-RELOCS6 7# Test that when we take the address of a preemptible ifunc in a shared object8# we get R_AARCH64_GLOB_DAT to the symbol as it could be defined in another9# link unit and preempt our definition.10.text11.globl myfunc12.type myfunc,@gnu_indirect_function13myfunc:14 ret15 16.text17.globl main18.type main,@function19main:20 adrp x8, :got:myfunc21 ldr x8, [x8, :got_lo12:myfunc]22 ret23# CHECK: 0000000000010284 <main>:24## myfunc's got entry = page(0x20330)-page(0x10284) + 0x330 = 65536 + 81625# CHECK-NEXT: 10284: adrp x8, 0x2000026# CHECK-NEXT: 10288: ldr x8, [x8, #816]27# CHECK-NEXT: 1028c: ret28 29# CHECK: Disassembly of section .got:30# CHECK-EMPTY:31# CHECK-NEXT: 0000000000020330 <.got>:32 33# CHECK-RELOCS: Relocations [34# CHECK-RELOCS-NEXT: Section {{.*}} .rela.dyn {35# CHECK-RELOCS-NEXT: 0x20330 R_AARCH64_GLOB_DAT myfunc 0x036# CHECK-RELOCS-NEXT: }37# CHECK-RELOCS-NEXT: ]38