brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 7121678 Raw
65 lines · plain
1# REQUIRES: x862 3## Test creating a DLL and linking against the DLL without using an import4## library.5 6## Test on i386 with cdecl decorated symbols.7 8## Linking the executable with -opt:noref, to make sure that we don't9## pull in more import entries than what's needed, even if not running GC.10 11# RUN: split-file %s %t.dir12 13# RUN: llvm-mc -filetype=obj -triple=i386-windows-gnu %t.dir/lib.s -o %t.lib.o14# RUN: lld-link -safeseh:no -noentry -dll -def:%t.dir/lib.def %t.lib.o -out:%t.lib.dll -implib:%t.implib.lib15# RUN: llvm-mc -filetype=obj -triple=i386-windows-gnu %t.dir/main.s -o %t.main.o16# RUN: lld-link -lldmingw %t.main.o -out:%t.main.exe %t.lib.dll -opt:noref -verbose 2>&1 | FileCheck --check-prefix=LOG %s17# RUN: llvm-readobj --coff-imports %t.main.exe | FileCheck %s18 19#--- lib.s20.text21.global _func122_func1:23  ret24.global _func225_func2:26  ret27.global _func328_func3:29  ret30.data31.global _variable32_variable:33  .int 4234 35#--- lib.def36EXPORTS37func138func239func340variable41 42#--- main.s43.text44.global _mainCRTStartup45_mainCRTStartup:46  call _func247  movl .refptr._variable, %eax48  movl (%eax), %eax49  ret50 51.section .rdata$.refptr._variable,"dr",discard,.refptr._variable52.globl .refptr._variable53.refptr._variable:54  .long _variable55 56# CHECK:      Import {57# CHECK-NEXT:   Name: link-dll-i386.s.tmp.lib.dll58# CHECK-NEXT:   ImportLookupTableRVA:59# CHECK-NEXT:   ImportAddressTableRVA60# CHECK-NEXT:   Symbol: func261# CHECK-NEXT:   Symbol: variable62# CHECK-NEXT: }63 64# LOG: Automatically importing _variable from link-dll-i386.s.tmp.lib.dll65