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 8 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: 0x402258 18// GOTREL-NEXT: Offset: 0x258 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: 0x402258 R_386_TLS_TPOFF tlsshared0 0x0 28// GOTREL-NEXT: 0x40225C R_386_TLS_TPOFF tlsshared1 0x0 29// GOTREL-NEXT: } 30// GOTREL-NEXT: ] 31 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 0x402258, %ecx 49// DISASM-NEXT: movl %gs:(%ecx), %eax 50/// &.got[1] 51// DISASM-NEXT: addl 0x40225c, %ecx 52// DISASM-NEXT: movl %gs:(%ecx), %eax 53 54.type tlslocal0,@object 55.section .tbss,"awT",@nobits 56.globl tlslocal0 57.align 4 58tlslocal0: 59 .long 0 60 .size tlslocal0, 4 61 62.type tlslocal1,@object 63.section .tbss,"awT",@nobits 64.globl tlslocal1 65.align 4 66tlslocal1: 67 .long 0 68 .size tlslocal1, 4 69 70.section .text 71.globl ___tls_get_addr 72.type ___tls_get_addr,@function 73___tls_get_addr: 74 75.section .text 76.globl _start 77_start: 78movl tlslocal0@indntpoff,%ecx 79movl %gs:(%ecx),%eax 80 81movl tlslocal0@indntpoff,%eax 82movl %gs:(%eax),%eax 83 84addl tlslocal0@indntpoff,%ecx 85movl %gs:(%ecx),%eax 86 87movl tlslocal1@indntpoff,%ecx 88movl %gs:(%ecx),%eax 89 90movl tlslocal1@indntpoff,%eax 91movl %gs:(%eax),%eax 92 93addl tlslocal1@indntpoff,%ecx 94movl %gs:(%ecx),%eax 95 96movl tlsshared0@indntpoff,%ecx 97movl %gs:(%ecx),%eax 98 99addl tlsshared1@indntpoff,%ecx 100movl %gs:(%ecx),%eax 101