Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -filetype=obj < %s | llvm-readobj -s -r | FileCheck %s
      2 
      3 define i64 @testfn() nounwind {
      4 entry:
      5   ret i64 0
      6 }
      7 
      8 define i64 @foo() nounwind {
      9 entry:
     10   %bar = alloca i64 ()*, align 8
     11   store i64 ()* @testfn, i64 ()** %bar, align 8
     12   %call = call i64 @testfn()
     13   ret i64 %call
     14 }
     15 
     16 ; The above should produce an ADRP/ADD pair to calculate the address of
     17 ; testfn. The important point is that LLVM shouldn't think it can deal with the
     18 ; relocation on the ADRP itself (even though it knows everything about the
     19 ; relative offsets of testfn and foo) because its value depends on where this
     20 ; object file's .text section gets relocated in memory.
     21 
     22 ; CHECK:      Relocations [
     23 ; CHECK-NEXT:   Section (2) .rela.text {
     24 ; CHECK-NEXT:     0x10 R_AARCH64_ADR_PREL_PG_HI21 testfn 0x0
     25 ; CHECK-NEXT:     0x14 R_AARCH64_ADD_ABS_LO12_NC testfn 0x0
     26 ; CHECK-NEXT:   }
     27 ; CHECK-NEXT: ]
     28