1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o 3# RUN: echo 'movq tls1@GOTTPOFF(%rip), %rax' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o 4# RUN: ld.lld %t1.o %t.o -o /dev/null 5# RUN: ld.lld %t.o %t1.o -o /dev/null 6# RUN: ld.lld --start-lib %t.o --end-lib %t1.o -o /dev/null 7# RUN: ld.lld %t1.o --start-lib %t.o --end-lib -o /dev/null 8 9## The TLS definition mismatches a non-TLS reference. 10# RUN: echo '.type tls1,@object; movq tls1,%rax' | llvm-mc -filetype=obj -triple=x86_64 - -o %t2.o 11# RUN: not ld.lld %t2.o %t.o -o /dev/null 2>&1 | FileCheck %s 12# RUN: not ld.lld %t.o %t2.o -o /dev/null 2>&1 | FileCheck %s 13 14## We fail to flag the STT_NOTYPE reference. This usually happens with hand-written 15## assembly because compiler-generated code properly sets symbol types. 16# RUN: echo 'movq tls1,%rax' | llvm-mc -filetype=obj -triple=x86_64 - -o %t3.o 17# RUN: ld.lld %t3.o %t.o -o /dev/null 18 19## Overriding a TLS definition with a non-TLS definition does not make sense. 20## We fail to flag this case. 21# RUN: ld.lld --defsym tls1=42 %t.o -o /dev/null 2>&1 | count 0 22 23## Part of PR36049: This should probably be allowed. 24# RUN: ld.lld --defsym tls1=tls2 %t.o -o /dev/null 2>&1 | count 0 25 26## An undefined symbol in module-level inline assembly of a bitcode file 27## is considered STT_NOTYPE. We should not error. 28# RUN: echo 'target triple = "x86_64-pc-linux-gnu" \ 29# RUN: target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" \ 30# RUN: module asm "movq tls1@GOTTPOFF(%rip), %rax"' | llvm-as - -o %t.bc 31# RUN: ld.lld %t.o %t.bc -o /dev/null 32# RUN: ld.lld %t.bc %t.o -o /dev/null 33 34# CHECK: error: TLS attribute mismatch: tls1 35# CHECK-NEXT: >>> in {{.*}}.tmp.o 36# CHECK-NEXT: >>> in {{.*}} 37 38.globl _start 39_start: 40 addl $1, %fs:tls1@TPOFF 41 addl $2, %fs:tls2@TPOFF 42 43.tbss 44.globl tls1, tls2 45 .space 8 46tls1: 47 .space 4 48tls2: 49 .space 4 50