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 8 9// NORELOC: Relocations [ 10// NORELOC-NEXT: Section ({{.*}}) .rel.dyn { 11// NORELOC-NEXT: 0x402258 R_386_TLS_TPOFF tlsshared0 0x0 12// NORELOC-NEXT: 0x40225C R_386_TLS_TPOFF tlsshared1 0x0 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 28.type tlsexe1,@object 29.section .tbss,"awT",@nobits 30.globl tlsexe1 31.align 4 32tlsexe1: 33 .long 0 34 .size tlsexe1, 4 35 36.type tlsexe2,@object 37.section .tbss,"awT",@nobits 38.globl tlsexe2 39.align 4 40tlsexe2: 41 .long 0 42 .size tlsexe2, 4 43 44.section .text 45.globl ___tls_get_addr 46.type ___tls_get_addr,@function 47___tls_get_addr: 48 49.section .text 50.globl _start 51_start: 52//GD->IE 53leal tlsshared0@tlsgd(,%ebx,1),%eax 54call ___tls_get_addr@plt 55leal tlsshared1@tlsgd(,%ebx,1),%eax 56call ___tls_get_addr@plt 57//GD->LE 58leal tlsexe1@tlsgd(,%ebx,1),%eax 59call ___tls_get_addr@plt 60leal tlsexe2@tlsgd(,%ebx,1),%eax 61call ___tls_get_addr@plt 62