[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / i386-tls-gdiele.s
blob0e4a92d34f865d34b8c043db03498d47f5111bfb
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=i686 %p/Inputs/tls-opt-gdiele-i686.s -o %t.o
3 // RUN: llvm-mc -filetype=obj -triple=i686 %s -o %t1.o
4 // RUN: ld.lld -shared %t.o -soname=t.so -o %t.so
5 // RUN: ld.lld --hash-style=sysv %t1.o %t.so -o %tout
6 // RUN: llvm-readobj -r %tout | FileCheck --check-prefix=NORELOC %s
7 // RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck --check-prefix=DISASM %s
9 // NORELOC: Relocations [
10 // NORELOC-NEXT: Section ({{.*}}) .rel.dyn {
11 // NORELOC-NEXT: 0x402258 R_386_TLS_TPOFF tlsshared0
12 // NORELOC-NEXT: 0x40225C R_386_TLS_TPOFF tlsshared1
13 // NORELOC-NEXT: }
14 // NORELOC-NEXT: ]
16 // DISASM: Disassembly of section .text:
17 // DISASM-EMPTY:
18 // DISASM-NEXT: <_start>:
19 // DISASM-NEXT: 4011d0: movl %gs:0, %eax
20 // DISASM-NEXT: addl -4104(%ebx), %eax
21 // DISASM-NEXT: movl %gs:0, %eax
22 // DISASM-NEXT: addl -4100(%ebx), %eax
23 // DISASM-NEXT: movl %gs:0, %eax
24 // DISASM-NEXT: subl $8, %eax
25 // DISASM-NEXT: movl %gs:0, %eax
26 // DISASM-NEXT: subl $4, %eax
28 .type tlsexe1,@object
29 .section .tbss,"awT",@nobits
30 .globl tlsexe1
31 .align 4
32 tlsexe1:
33 .long 0
34 .size tlsexe1, 4
36 .type tlsexe2,@object
37 .section .tbss,"awT",@nobits
38 .globl tlsexe2
39 .align 4
40 tlsexe2:
41 .long 0
42 .size tlsexe2, 4
44 .section .text
45 .globl ___tls_get_addr
46 .type ___tls_get_addr,@function
47 ___tls_get_addr:
49 .section .text
50 .globl _start
51 _start:
52 //GD->IE
53 leal tlsshared0@tlsgd(,%ebx,1),%eax
54 call ___tls_get_addr@plt
55 leal tlsshared1@tlsgd(,%ebx,1),%eax
56 call ___tls_get_addr@plt
57 //GD->LE
58 leal tlsexe1@tlsgd(,%ebx,1),%eax
59 call ___tls_get_addr@plt
60 leal tlsexe2@tlsgd(,%ebx,1),%eax
61 call ___tls_get_addr@plt