llvm-project/lld/test/elf/tls.test

44 lines
1.0 KiB
Plaintext

# REQUIRES: x86
# This tests verifies that TLS variables have correct offsets
RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 -static \
RUN: --output-filetype=yaml --noinhibit-exec | FileCheck %s -check-prefix=YAML
RUN: lld -flavor gnu -target x86_64-linux %p/Inputs/tls.x86-64 -o %t \
RUN: --noinhibit-exec -e main -static && llvm-objdump -d %t | FileCheck %s
// Verify that the TLS accesses have the correct offsets.
YAML: name: main
YAML: references:
YAML: kind: R_X86_64_TPOFF32
YAML: offset: 9
YAML: target: tls1
YAML: kind: R_X86_64_TPOFF32
YAML: offset: 17
YAML: target: tls0
YAML: kind: R_X86_64_TPOFF32
YAML: offset: 25
YAML: target: tls2
YAML: name: GOTTPOFF
YAML: kind: R_X86_64_PC32
YAML: target: [[GOTNAME:[a-zA-Z0-9_]+]]
YAML: type: got
YAML: references:
YAML: kind: R_X86_64_TPOFF64
YAML: target: tls2
// main
CHECK: addl %fs:-4
CHECK: addl %fs:-8
CHECK: addl %fs:-12
// GOTTPOFF
CHECK: movq {{[0-9]+}}(%rip)
// TLSLD
CHECK: movq %fs:0, %rax
CHECK: leaq -8(%rax), %rax