1# REQUIRES: x86 2# RUN: split-file %s %t 3 4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/libtlv.s -o %t/libtlv.o 5# RUN: %lld -dylib -install_name @executable_path/libtlv.dylib \ 6# RUN: -lSystem -o %t/libtlv.dylib %t/libtlv.o 7# RUN: llvm-objdump --exports-trie -d --no-show-raw-insn %t/libtlv.dylib | FileCheck %s --check-prefix=DYLIB 8# DYLIB-DAG: _foo [per-thread] 9# DYLIB-DAG: _bar [per-thread] 10 11# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o 12# RUN: %lld -lSystem -L%t -ltlv %t/test.o -o %t/test 13# RUN: llvm-objdump --bind -d --no-show-raw-insn %t/test | FileCheck %s 14 15# CHECK: movq [[#]](%rip), %rax # [[#%x, FOO:]] 16# CHECK-NEXT: movq [[#]](%rip), %rax # [[#%x, BAR:]] 17# CHECK-NEXT: movq [[#]](%rip), %rax # [[#%x, BAZ:]] 18 19# CHECK-LABEL: Bind table: 20# CHECK-DAG: __DATA __thread_ptrs 0x{{0*}}[[#%x, FOO]] pointer 0 libtlv _foo 21# CHECK-DAG: __DATA __thread_ptrs 0x{{0*}}[[#%x, BAR]] pointer 0 libtlv _bar 22# CHECK-DAG: __DATA_CONST __got 0x{{0*}}[[#%x, BAZ]] pointer 0 libtlv _baz 23 24#--- libtlv.s 25.section __DATA,__thread_vars,thread_local_variables 26.globl _foo, _bar, _baz 27_foo: 28_bar: 29 30.text 31_baz: 32 33#--- test.s 34.globl _main 35_main: 36 mov _foo@TLVP(%rip), %rax 37 mov _bar@TLVP(%rip), %rax 38## Add a GOT entry to make sure we don't mix it up with TLVs 39 mov _baz@GOTPCREL(%rip), %rax 40 ret 41