• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=i686 %s -o %t.o
3# RUN: ld.lld %t.o -o %t
4# RUN: ld.lld %t.o -shared -o %t.so
5# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefix=DIS
6# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELOC
7# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck %s --check-prefix=DISSHARED
8# RUN: llvm-readobj -r %t.so | FileCheck %s --check-prefix=RELOCSHARED
9
10.section ".tdata", "awT", @progbits
11.globl var
12.globl var1
13var:
14.long 0
15var1:
16.long 1
17
18.section test, "awx"
19.global _start
20_start:
21 movl $var@tpoff, %edx
22 movl %gs:0, %ecx
23 subl %edx, %eax
24 movl $var1@tpoff, %edx
25 movl %gs:0, %ecx
26 subl %edx, %eax
27
28 movl %gs:0, %ecx
29 leal var@ntpoff(%ecx), %eax
30 movl %gs:0, %ecx
31 leal var1@ntpoff+123(%ecx), %eax
32
33# DIS:      Disassembly of section test:
34# DIS-EMPTY:
35# DIS-NEXT: <_start>:
36# DIS-NEXT: 402134:       movl    $8, %edx
37# DIS-NEXT: 402139:       movl    %gs:0, %ecx
38# DIS-NEXT: 402140:       subl    %edx, %eax
39# DIS-NEXT: 402142:       movl    $4, %edx
40# DIS-NEXT: 402147:       movl    %gs:0, %ecx
41# DIS-NEXT: 40214e:       subl    %edx, %eax
42# DIS-NEXT: 402150:       movl    %gs:0, %ecx
43# DIS-NEXT: 402157:       leal    -8(%ecx), %eax
44# DIS-NEXT: 40215d:       movl    %gs:0, %ecx
45# DIS-NEXT: 402164:       leal    119(%ecx), %eax
46
47# RELOC: Relocations [
48# RELOC-NEXT: ]
49
50# DISSHARED: Disassembly of section test:
51# DISSHARED-EMPTY:
52# DISSHARED-NEXT: <_start>:
53# DISSHARED-NEXT: 2218:       movl    $0, %edx
54# DISSHARED-NEXT: 221d:       movl    %gs:0, %ecx
55# DISSHARED-NEXT: 2224:       subl    %edx, %eax
56# DISSHARED-NEXT: 2226:       movl    $0, %edx
57# DISSHARED-NEXT: 222b:       movl    %gs:0, %ecx
58# DISSHARED-NEXT: 2232:       subl    %edx, %eax
59# DISSHARED-NEXT: 2234:       movl    %gs:0, %ecx
60# DISSHARED-NEXT: 223b:       leal    (%ecx), %eax
61# DISSHARED-NEXT: 2241:       movl    %gs:0, %ecx
62# DISSHARED-NEXT: 2248:       leal    123(%ecx), %eax
63
64# RELOCSHARED:      Relocations [
65# RELOCSHARED-NEXT: Section (5) .rel.dyn {
66# RELOCSHARED-NEXT:   0x2219 R_386_TLS_TPOFF32 var 0x0
67# RELOCSHARED-NEXT:   0x223D R_386_TLS_TPOFF var 0x0
68# RELOCSHARED-NEXT:   0x2227 R_386_TLS_TPOFF32 var1 0x0
69# RELOCSHARED-NEXT:   0x224A R_386_TLS_TPOFF var1 0x0
70# RELOCSHARED-NEXT:  }
71# RELOCSHARED-NEXT: ]
72