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.
14 # LD-REL-NEXT: R_386_TLS_DESC -
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
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