[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / i386-tls-opt-iele-nopic.s
blob8dd0cf69f9549b9666b2c67a95f630c68a46b9a4
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o
3 // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %p/Inputs/tls-opt-iele-i686-nopic.s -o %tso.o
4 // RUN: ld.lld -shared %tso.o -soname=t.so -o %tso
5 // RUN: ld.lld --hash-style=sysv %t.o %tso -o %t1
6 // RUN: llvm-readobj -S -r %t1 | FileCheck --check-prefix=GOTREL %s
7 // RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t1 | FileCheck --check-prefix=DISASM %s
9 // GOTREL: Section {
10 // GOTREL: Index:
11 // GOTREL: Name: .got
12 // GOTREL-NEXT: Type: SHT_PROGBITS
13 // GOTREL-NEXT: Flags [
14 // GOTREL-NEXT: SHF_ALLOC
15 // GOTREL-NEXT: SHF_WRITE
16 // GOTREL-NEXT: ]
17 // GOTREL-NEXT: Address: 0x402250
18 // GOTREL-NEXT: Offset: 0x250
19 // GOTREL-NEXT: Size: 8
20 // GOTREL-NEXT: Link: 0
21 // GOTREL-NEXT: Info: 0
22 // GOTREL-NEXT: AddressAlignment: 4
23 // GOTREL-NEXT: EntrySize: 0
24 // GOTREL-NEXT: }
25 // GOTREL: Relocations [
26 // GOTREL-NEXT: Section ({{.*}}) .rel.dyn {
27 // GOTREL-NEXT: 0x402250 R_386_TLS_TPOFF tlsshared0
28 // GOTREL-NEXT: 0x402254 R_386_TLS_TPOFF tlsshared1
29 // GOTREL-NEXT: }
30 // GOTREL-NEXT: ]
32 // DISASM: Disassembly of section .text:
33 // DISASM-EMPTY:
34 // DISASM-NEXT: <_start>:
35 // DISASM-NEXT: 4011b0: movl $0xfffffff8, %ecx
36 // DISASM-NEXT: movl %gs:(%ecx), %eax
37 // DISASM-NEXT: movl $0xfffffff8, %eax
38 // DISASM-NEXT: movl %gs:(%eax), %eax
39 // DISASM-NEXT: addl $0xfffffff8, %ecx
40 // DISASM-NEXT: movl %gs:(%ecx), %eax
41 // DISASM-NEXT: movl $0xfffffffc, %ecx
42 // DISASM-NEXT: movl %gs:(%ecx), %eax
43 // DISASM-NEXT: movl $0xfffffffc, %eax
44 // DISASM-NEXT: movl %gs:(%eax), %eax
45 // DISASM-NEXT: addl $0xfffffffc, %ecx
46 // DISASM-NEXT: movl %gs:(%ecx), %eax
47 /// &.got[0]
48 // DISASM-NEXT: movl 0x402250, %ecx
49 // DISASM-NEXT: movl %gs:(%ecx), %eax
50 /// &.got[1]
51 // DISASM-NEXT: addl 0x402254, %ecx
52 // DISASM-NEXT: movl %gs:(%ecx), %eax
54 .type tlslocal0,@object
55 .section .tbss,"awT",@nobits
56 .globl tlslocal0
57 .align 4
58 tlslocal0:
59 .long 0
60 .size tlslocal0, 4
62 .type tlslocal1,@object
63 .section .tbss,"awT",@nobits
64 .globl tlslocal1
65 .align 4
66 tlslocal1:
67 .long 0
68 .size tlslocal1, 4
70 .section .text
71 .globl ___tls_get_addr
72 .type ___tls_get_addr,@function
73 ___tls_get_addr:
75 .section .text
76 .globl _start
77 _start:
78 movl tlslocal0@indntpoff,%ecx
79 movl %gs:(%ecx),%eax
81 movl tlslocal0@indntpoff,%eax
82 movl %gs:(%eax),%eax
84 addl tlslocal0@indntpoff,%ecx
85 movl %gs:(%ecx),%eax
87 movl tlslocal1@indntpoff,%ecx
88 movl %gs:(%ecx),%eax
90 movl tlslocal1@indntpoff,%eax
91 movl %gs:(%eax),%eax
93 addl tlslocal1@indntpoff,%ecx
94 movl %gs:(%ecx),%eax
96 movl tlsshared0@indntpoff,%ecx
97 movl %gs:(%ecx),%eax
99 addl tlsshared1@indntpoff,%ecx
100 movl %gs:(%ecx),%eax