1# REQUIRES: x86 2 3# RUN: split-file %s %t 4# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/exec.s -o %texec.o 5# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/shared.s -o %tshared.o 6# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/ledef.s -o %tdef.o 7# RUN: ld.lld %texec.o -o %t.exec 8# RUN: ld.lld %tshared.o -o %t.shared --shared 9# RUN: llvm-objdump --no-print-imm-hex -d %t.exec | FileCheck %s --check-prefix=EXEC 10# RUN: llvm-objdump --no-print-imm-hex -d %t.shared | FileCheck %s --check-prefix=SHARED 11 12## An undefined weak TLS symbol does not fetch a lazy definition. 13# RUN: ld.lld %texec.o --start-lib %tdef.o --end-lib -o %tlazy 14# RUN: llvm-objdump --no-print-imm-hex -d %tlazy | FileCheck %s --check-prefix=EXEC 15 16## Undefined TLS symbols arbitrarily resolve to 0. 17# EXEC: leaq 16(%rax), %rdx 18## Initial-exec references to undefined weak symbols can be relaxed to LE 19## references. 20# EXEC: leaq 32(%rax), %rax 21# SHARED: leaq 48(%rax), %rcx 22 23# RUN: ld.lld -shared %tdef.o -o %tdef.so 24# RUN: not ld.lld %texec.o %tdef.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR %s 25 26# ERROR: error: relocation R_X86_64_TPOFF32 cannot be used against symbol 'le'; recompile with -fPIC 27 28#--- ledef.s 29.tbss 30.globl le 31le: 32 33#--- exec.s 34.weak le 35leaq le@tpoff+16(%rax), %rdx 36 37.weak ie 38addq ie@gottpoff+32(%rip), %rax 39 40#--- shared.s 41.weak ld 42leaq ld@dtpoff+48(%rax), %rcx 43