64 lines · plain
1# REQUIRES: aarch642# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %s -o %t.o3# RUN: ld.lld %t.o -o %t4# RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn -d %t | FileCheck %s5# RUN: llvm-readobj --symbols %t | FileCheck --check-prefix=CHECK-SYM %s6 7## Test the local exec relocations that map to:8## R_AARCH64_TLSLE_MOVW_TPREL_G29## R_AARCH64_TLSLE_MOVW_TPREL_G110## R_AARCH64_TLSLE_MOVW_TPREL_G1_NC11## R_AARCH64_TLSLE_MOVW_TPREL_G012## R_AARCH64_TLSLE_MOVW_TPREL_G0_NC13## They calculate the same value as the other TPREL relocations, namely the14## offset from the thread pointer TP. The G0, G1 and G2 refer to partitions15## of the result with G2 bits [47:32], G1 bits [31:16] and G0 bits [15:0]16## the NC variant does not check for overflow.17## In AArch64 the structure of the TLS at runtime is:18## | TCB | Alignment Padding | TLS Block |19## With TP pointing to the start of the TCB. All offsets will be positive.20 21.text22## Access variable in first partition23movz x0, #:tprel_g0:v024## TCB + 0 == 1625# CHECK: mov x0, #1626 27# CHECK-SYM: Name: v028# CHECK-SYM-NEXT: Value: 0x029 30## Access variable in second partition31movz x0, #:tprel_g1:v132movk x0, #:tprel_g0_nc:v133 34## TCB + 65536 across movz and movk35# CHECK-NEXT: mov x0, #6553636# CHECK-NEXT: movk x0, #1637 38# CHECK-SYM: Name: v139# CHECK-SYM-NEXT: Value: 0x1000040 41## Access variable in third partition42movz x0, #:tprel_g2:v243movk x0, #:tprel_g1_nc:v244movk x0, #:tprel_g0_nc:v245 46## TCB + 65536 + 4294967296 across movz and 2 movk instructions47# CHECK-NEXT: mov x0, #429496729648# CHECK-NEXT: movk x0, #1, lsl #1649# CHECK-NEXT: movk x0, #1650 51# CHECK-SYM: Name: v252# CHECK-SYM-NEXT: Value: 0x10001000053 54.section .tbss,"awT",@nobits55.balign 1656v0:57.quad 058.space 0x10000 - 859v1:60.quad 061.space 0x100000000 - 862v2:63.quad 064