1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=i686 %s -o %t.o 3# RUN: ld.lld %t.o -o %t 4# RUN: ld.lld %t.o -pie -o %t.pie 5# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t | FileCheck %s --check-prefix=DIS 6# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELOC 7# RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.pie | FileCheck %s --check-prefix=DIS 8# RUN: llvm-readobj -r %t.pie | FileCheck %s --check-prefix=RELOC 9 10## Reject local-exec TLS relocations for -shared. 11# RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error: 12 13# ERR: error: relocation R_386_TLS_LE_32 against var cannot be used with -shared 14# ERR: error: relocation R_386_TLS_LE_32 against var1 cannot be used with -shared 15# ERR: error: relocation R_386_TLS_LE against var cannot be used with -shared 16# ERR: error: relocation R_386_TLS_LE against var1 cannot be used with -shared 17 18.section ".tdata", "awT", @progbits 19.globl var 20.globl var1 21var: 22.long 0 23var1: 24.long 1 25 26.section test, "awx" 27.global _start 28_start: 29 movl $var@tpoff, %edx 30 movl %gs:0, %ecx 31 subl %edx, %eax 32 movl $var1@tpoff, %edx 33 movl %gs:0, %ecx 34 subl %edx, %eax 35 36 movl %gs:0, %ecx 37 leal var@ntpoff(%ecx), %eax 38 movl %gs:0, %ecx 39 leal var1@ntpoff+123(%ecx), %eax 40 41# DIS: Disassembly of section test: 42# DIS-EMPTY: 43# DIS-NEXT: <_start>: 44# DIS-NEXT: movl $8, %edx 45# DIS-NEXT: movl %gs:0, %ecx 46# DIS-NEXT: subl %edx, %eax 47# DIS-NEXT: movl $4, %edx 48# DIS-NEXT: movl %gs:0, %ecx 49# DIS-NEXT: subl %edx, %eax 50# DIS-NEXT: movl %gs:0, %ecx 51# DIS-NEXT: leal -8(%ecx), %eax 52# DIS-NEXT: movl %gs:0, %ecx 53# DIS-NEXT: leal 119(%ecx), %eax 54 55# RELOC: Relocations [ 56# RELOC-NEXT: ] 57