brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 997c5b0 Raw
67 lines · plain
1# REQUIRES: x862 3## Test creating a DLL and linking against the DLL without using an import4## library.5 6## Explicitly creating an import library but naming it differently than the7## DLL, to avoid any risk of implicitly referencing it instead of the DLL8## itself.9 10## Linking the executable with -opt:noref, to make sure that we don't11## pull in more import entries than what's needed, even if not running GC.12 13# RUN: split-file %s %t.dir14 15# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-gnu %t.dir/lib.s -o %t.lib.o16# RUN: lld-link -noentry -dll -def:%t.dir/lib.def %t.lib.o -out:%t.lib.dll -implib:%t.implib.lib17# RUN: llvm-mc -filetype=obj -triple=x86_64-windows-gnu %t.dir/main.s -o %t.main.o18# RUN: lld-link -lldmingw %t.main.o -out:%t.main.exe %t.lib.dll -opt:noref -verbose 2>&1 | FileCheck --check-prefix=LOG %s19# RUN: llvm-readobj --coff-imports %t.main.exe | FileCheck %s20 21#--- lib.s22.text23.global func124func1:25  ret26.global func227func2:28  ret29.global func330func3:31  ret32.data33.global variable34variable:35  .int 4236 37#--- lib.def38EXPORTS39func140func241func342variable43 44#--- main.s45.text46.global mainCRTStartup47mainCRTStartup:48  call func249  movq .refptr.variable(%rip), %rax50  movl (%rax), %eax51  ret52 53.section .rdata$.refptr.variable,"dr",discard,.refptr.variable54.globl .refptr.variable55.refptr.variable:56  .quad variable57 58# CHECK:      Import {59# CHECK-NEXT:   Name: link-dll.s.tmp.lib.dll60# CHECK-NEXT:   ImportLookupTableRVA:61# CHECK-NEXT:   ImportAddressTableRVA62# CHECK-NEXT:   Symbol: func263# CHECK-NEXT:   Symbol: variable64# CHECK-NEXT: }65 66# LOG: Automatically importing variable from link-dll.s.tmp.lib.dll67