xref: /aosp_15_r20/external/llvm/test/MC/AArch64/adrp-relocation.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -triple=aarch64-linux-gnu -filetype=obj -o - %s| llvm-readobj -r - | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker        .text
3*9880d681SAndroid Build Coastguard Worker// These should produce an ADRP/ADD pair to calculate the address of
4*9880d681SAndroid Build Coastguard Worker// testfn. The important point is that LLVM shouldn't think it can deal with the
5*9880d681SAndroid Build Coastguard Worker// relocation on the ADRP itself (even though it knows everything about the
6*9880d681SAndroid Build Coastguard Worker// relative offsets of testfn and foo) because its value depends on where this
7*9880d681SAndroid Build Coastguard Worker// object file's .text section gets relocated in memory.
8*9880d681SAndroid Build Coastguard Worker        adrp x0, sym
9*9880d681SAndroid Build Coastguard Worker        adrp x0, :got:sym
10*9880d681SAndroid Build Coastguard Worker        adrp x0, :gottprel:sym
11*9880d681SAndroid Build Coastguard Worker        adrp x0, :tlsdesc:sym
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker        .global sym
14*9880d681SAndroid Build Coastguard Workersym:
15*9880d681SAndroid Build Coastguard Worker// CHECK: R_AARCH64_ADR_PREL_PG_HI21 sym
16*9880d681SAndroid Build Coastguard Worker// CHECK: R_AARCH64_ADR_GOT_PAGE sym
17*9880d681SAndroid Build Coastguard Worker// CHECK: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 sym
18*9880d681SAndroid Build Coastguard Worker// CHECK: R_AARCH64_TLSDESC_ADR_PAGE21 sym
19