summaryrefslogtreecommitdiffstats
path: root/lld/test/elf/tls.test
blob: 0eb6393fe9db0be752de28f437ea58939d9374a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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:  type: got
YAML:  references:
YAML:   kind: R_X86_64_TPOFF64
YAML:   target: tls2

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_]+]]


// 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
OpenPOWER on IntegriCloud