[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / tls-weak-undef.s
blob242d9223e41329c9bfafb40d7464ba785efea78f
1 # REQUIRES: x86
3 # RUN: split-file %s %t
4 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/exec.s -o %texec.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/shared.s -o %tshared.o
6 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/ledef.s -o %tdef.o
7 # RUN: ld.lld %texec.o -o %t.exec
8 # RUN: ld.lld %tshared.o -o %t.shared --shared
9 # RUN: llvm-objdump --no-print-imm-hex -d %t.exec | FileCheck %s --check-prefix=EXEC
10 # RUN: llvm-objdump --no-print-imm-hex -d %t.shared | FileCheck %s --check-prefix=SHARED
12 ## An undefined weak TLS symbol does not fetch a lazy definition.
13 # RUN: ld.lld %texec.o --start-lib %tdef.o --end-lib -o %tlazy
14 # RUN: llvm-objdump --no-print-imm-hex -d %tlazy | FileCheck %s --check-prefix=EXEC
16 ## Undefined TLS symbols arbitrarily resolve to 0.
17 # EXEC: leaq 16(%rax), %rdx
18 ## Initial-exec references to undefined weak symbols can be relaxed to LE
19 ## references.
20 # EXEC: leaq 32(%rax), %rax
21 # SHARED: leaq 48(%rax), %rcx
23 # RUN: ld.lld -shared %tdef.o -o %tdef.so
24 # RUN: not ld.lld %texec.o %tdef.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR %s
26 # ERROR: error: relocation R_X86_64_TPOFF32 cannot be used against symbol 'le'; recompile with -fPIC
28 #--- ledef.s
29 .tbss
30 .globl le
31 le:
33 #--- exec.s
34 .weak le
35 leaq le@tpoff+16(%rax), %rdx
37 .weak ie
38 addq ie@gottpoff+32(%rip), %rax
40 #--- shared.s
41 .weak ld
42 leaq ld@dtpoff+48(%rax), %rcx