1// REQUIRES: x86
2
3// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
4// RUN: ld.lld -shared --pack-dyn-relocs=android %t.o -o %t.so
5// RUN: llvm-readobj -r %t.so | FileCheck %s
6
7// Bug 37841: Symbol::getVA must work on TLS symbols during the layout loop in
8// finalizeSections. This test uses an atypical IE access in a shared object to
9// access a local TLS symbol, because a more typical access would avoid the
10// bug.
11
12    .globl  foo
13foo:
14    movq    tlsvar@GOTTPOFF(%rip), %rcx
15
16    .section    .tdata,"awT",@progbits
17    .space 0x1234
18tlsvar:
19    .word   42
20
21// CHECK:          Section ({{.+}}) .rela.dyn {
22// CHECK-NEXT:     R_X86_64_TPOFF64 - 0x1234
23// CHECK-NEXT:     }
24