brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · d9a6dbb Raw
89 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 stdcall/fastcall/vectorcall decorated symbols.7 8## Check that we normally warn about these fixups. If -stdcall-fixup:no9## (--disable-stdcall-fixup on the MinGW linker level) is passed, we don't10## do these fixups. If we -stdcall-fixup (--enable-stdcall-fixup on the MinGW11## linker level) is passed, we don't warn about it at all.12 13# RUN: split-file %s %t.dir14 15# RUN: llvm-mc -filetype=obj -triple=i386-windows-gnu %t.dir/lib.s -o %t.lib.o16# RUN: lld-link -safeseh:no -noentry -dll -def:%t.dir/lib.def %t.lib.o -out:%t.lib.dll -implib:%t.implib.lib17# RUN: llvm-mc -filetype=obj -triple=i386-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 2>&1 | FileCheck --check-prefix=LOG %s19# RUN: llvm-readobj --coff-imports %t.main.exe | FileCheck %s20# RUN: not lld-link -lldmingw %t.main.o -out:%t.main.exe %t.lib.dll -opt:noref -stdcall-fixup:no 2>&1 | FileCheck --check-prefix=ERROR %s21# RUN: lld-link -lldmingw %t.main.o -out:%t.main.exe %t.lib.dll -opt:noref -stdcall-fixup 2>&1 | count 022 23#--- lib.s24  .text25  .globl  _stdcall@826  .globl  @fastcall@827  .globl  vectorcall@@828  .globl  __underscored29_stdcall@8:30  movl    8(%esp), %eax31  addl    4(%esp), %eax32  retl    $833@fastcall@8:34  movl    8(%esp), %eax35  addl    4(%esp), %eax36  retl    $837vectorcall@@8:38  movl    8(%esp), %eax39  addl    4(%esp), %eax40  retl    $841__underscored:42  ret43 44#--- lib.def45EXPORTS46stdcall47fastcall48vectorcall49_underscored50 51#--- main.s52.text53.global _mainCRTStartup54_mainCRTStartup:55  pushl   $256  pushl   $157  calll   _stdcall@858  movl    $1, %ecx59  movl    $2, %edx60  calll   @fastcall@861  movl    $1, %ecx62  movl    $2, %edx63  calll   vectorcall@@864  pushl   $265  pushl   $166  calll   __underscored67  addl    $8, %esp68  xorl    %eax, %eax69  popl    %ebp70  retl71 72# CHECK:      Import {73# CHECK-NEXT:   Name: link-dll-stdcall.s.tmp.lib.dll74# CHECK-NEXT:   ImportLookupTableRVA:75# CHECK-NEXT:   ImportAddressTableRVA76# CHECK-NEXT:   Symbol: _underscored77# CHECK-NEXT:   Symbol: fastcall78# CHECK-NEXT:   Symbol: stdcall79# CHECK-NEXT:   Symbol: vectorcall80# CHECK-NEXT: }81 82# LOG-DAG: Resolving vectorcall@@8 by linking to _vectorcall83# LOG-DAG: Resolving @fastcall@8 by linking to _fastcall84# LOG-DAG: Resolving _stdcall@8 by linking to _stdcall85 86# ERROR-DAG: undefined symbol: _stdcall@887# ERROR-DAG: undefined symbol: @fastcall@888# ERROR-DAG: undefined symbol: vectorcall@@889