[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / i386-tlsdesc-ld.s
blob6898ef7710c2c5f4c3f34ec6611a9d2f0e0bceb2
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=i386 %s -o %t.o
4 # RUN: ld.lld -shared -z now %t.o -o %t.so
5 # RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=LD-REL %s
6 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.so | FileCheck --check-prefix=LD %s
8 # RUN: ld.lld -z now %t.o -o %t
9 # RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
10 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
12 ## Check _TLS_MODULE_BASE_ used by LD produces a dynamic relocation with a value of 0.
13 # LD-REL: .rel.dyn {
14 # LD-REL-NEXT: R_386_TLS_DESC -
15 # LD-REL-NEXT: }
17 ## 0x2318-0x1267 = 4273
18 ## dtpoff(a) = 8, dtpoff(b) = 12
19 # LD: leal -8(%ebx), %eax
20 # LD-NEXT: calll *(%eax)
21 # LD-NEXT: leal 8(%eax), %ecx
22 # LD-NEXT: leal 12(%eax), %edx
24 ## When producing an executable, the LD code sequence can be relaxed to LE.
25 ## It is the same as GD->LE.
26 ## tpoff(_TLS_MODULE_BASE_) = 0, tpoff(a) = -8, tpoff(b) = -4
28 # NOREL: no relocations
30 # LE: leal 0, %eax
31 # LE-NEXT: nop
32 # LE-NEXT: leal -8(%eax), %ecx
33 # LE-NEXT: leal -4(%eax), %edx
34 # LE-NEXT: addl %gs:0, %ecx
35 # LE-NEXT: addl %gs:0, %edx
37 leal _TLS_MODULE_BASE_@tlsdesc(%ebx), %eax
38 call *_TLS_MODULE_BASE_@tlscall(%eax)
39 leal a@dtpoff(%eax), %ecx
40 leal b@dtpoff(%eax), %edx
41 addl %gs:0, %ecx
42 addl %gs:0, %edx
44 .section .tbss
45 .zero 8
47 .zero 4
49 .zero 4