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 --no-print-imm-hex -d --no-show-raw-insn %tout | FileCheck --check-prefix=DISASM %s 8 9// NORELOC: Relocations [ 10// NORELOC-NEXT: Section ({{.*}}) .rel.dyn { 11// NORELOC-NEXT: 0x402270 R_386_TLS_TPOFF tlsshared0 12// NORELOC-NEXT: 0x402274 R_386_TLS_TPOFF tlsshared1 13// NORELOC-NEXT: } 14// NORELOC-NEXT: ] 15 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 27// DISASM-NEXT: movl %gs:0, %eax 28// DISASM-NEXT: addl -4100(%ebx), %eax 29// DISASM-NEXT: movl %gs:0, %eax 30// DISASM-NEXT: subl $4, %eax 31 32.type tlsexe1,@object 33.section .tbss,"awT",@nobits 34.globl tlsexe1 35.align 4 36tlsexe1: 37 .long 0 38 .size tlsexe1, 4 39 40.type tlsexe2,@object 41.section .tbss,"awT",@nobits 42.globl tlsexe2 43.align 4 44tlsexe2: 45 .long 0 46 .size tlsexe2, 4 47 48.section .text 49.globl ___tls_get_addr 50.type ___tls_get_addr,@function 51___tls_get_addr: 52 53.section .text 54.globl _start 55_start: 56//GD->IE 57leal tlsshared0@tlsgd(,%ebx,1),%eax 58call ___tls_get_addr@plt 59leal tlsshared1@tlsgd(,%ebx,1),%eax 60call ___tls_get_addr@plt 61//GD->LE 62leal tlsexe1@tlsgd(,%ebx,1),%eax 63call ___tls_get_addr@plt 64leal tlsexe2@tlsgd(,%ebx,1),%eax 65call ___tls_get_addr@plt 66 67// -fno-plt GD->IE and GD->LE 68leal tlsshared1@tlsgd(%edx),%eax 69call *___tls_get_addr@GOT(%edx) 70leal tlsexe2@tlsgd(%edx),%eax 71call *___tls_get_addr@GOT(%edx) 72