108 lines · plain
1REQUIRES: x862RUN: split-file %s %t.dir && cd %t.dir3 4Link to an import library containing EXPORTAS and verify that we use proper name for the import.5 6RUN: llvm-mc -filetype=obj -triple=x86_64-windows test.s -o test.obj7RUN: llvm-lib -machine:amd64 -out:test.lib -def:test.def8RUN: lld-link -out:out1.dll -dll -noentry test.obj test.lib9RUN: llvm-readobj --coff-imports out1.dll | FileCheck --check-prefix=IMPORT %s10IMPORT: Symbol: expfunc11 12Pass -export argument with EXPORTAS.13 14RUN: llvm-mc -filetype=obj -triple=x86_64-windows func.s -o func.obj15RUN: lld-link -out:out2.dll -dll -noentry func.obj -export:func,EXPORTAS,expfunc16RUN: llvm-readobj --coff-exports out2.dll | FileCheck --check-prefix=EXPORT %s17EXPORT: Name: expfunc18 19RUN: llvm-readobj out2.lib | FileCheck --check-prefix=IMPLIB %s20IMPLIB: Name type: export as21IMPLIB-NEXT: Export name: expfunc22IMPLIB-NEXT: Symbol: __imp_func23IMPLIB-NEXT: Symbol: func24 25Use .drectve section with EXPORTAS.26 27RUN: llvm-mc -filetype=obj -triple=x86_64-windows drectve.s -o drectve.obj28RUN: lld-link -out:out3.dll -dll -noentry func.obj drectve.obj29RUN: llvm-readobj --coff-exports out3.dll | FileCheck --check-prefix=EXPORT %s30RUN: llvm-readobj out3.lib | FileCheck --check-prefix=IMPLIB %s31 32Use a .def file with EXPORTAS.33 34RUN: lld-link -out:out4.dll -dll -noentry func.obj -def:test.def35RUN: llvm-readobj --coff-exports out4.dll | FileCheck --check-prefix=EXPORT %s36RUN: llvm-readobj out4.lib | FileCheck --check-prefix=IMPLIB %s37 38Use a .def file with EXPORTAS in a forwarding export.39 40RUN: lld-link -out:out5.dll -dll -noentry func.obj -def:test2.def41RUN: llvm-readobj --coff-exports out5.dll | FileCheck --check-prefix=FORWARD-EXPORT %s42FORWARD-EXPORT: Export {43FORWARD-EXPORT-NEXT: Ordinal: 144FORWARD-EXPORT-NEXT: Name: expfunc45FORWARD-EXPORT-NEXT: ForwardedTo: otherdll.otherfunc46FORWARD-EXPORT-NEXT: }47 48RUN: llvm-readobj out5.lib | FileCheck --check-prefix=FORWARD-IMPLIB %s49FORWARD-IMPLIB: Name type: export as50FORWARD-IMPLIB-NEXT: Export name: expfunc51FORWARD-IMPLIB-NEXT: Symbol: __imp_func52FORWARD-IMPLIB-NEXT: Symbol: func53 54Pass -export argument with EXPORTAS in a forwarding export.55 56RUN: lld-link -out:out6.dll -dll -noentry func.obj -export:func=otherdll.otherfunc,EXPORTAS,expfunc57RUN: llvm-readobj --coff-exports out6.dll | FileCheck --check-prefix=FORWARD-EXPORT %s58RUN: llvm-readobj out6.lib | FileCheck --check-prefix=FORWARD-IMPLIB %s59 60Pass -export argument with EXPORTAS in a data export.61 62RUN: lld-link -out:out7.dll -dll -noentry func.obj -export:func,DATA,@5,EXPORTAS,expfunc63RUN: llvm-readobj --coff-exports out7.dll | FileCheck --check-prefix=ORD %s64ORD: Ordinal: 565ORD-NEXT: Name: expfunc66 67RUN: llvm-readobj out7.lib | FileCheck --check-prefix=ORD-IMPLIB %s68ORD-IMPLIB: Type: data69ORD-IMPLIB-NEXT: Name type: export as70ORD-IMPLIB-NEXT: Export name: expfunc71ORD-IMPLIB-NEXT: Symbol: __imp_func72 73Check invalid EXPORTAS syntax.74 75RUN: not lld-link -out:err1.dll -dll -noentry func.obj -export:func,EXPORTAS, 2>&1 | \76RUN: FileCheck --check-prefix=ERR1 %s77ERR1: error: invalid EXPORTAS value: {{$}}78 79RUN: not lld-link -out:err2.dll -dll -noentry func.obj -export:func,EXPORTAS,expfunc,DATA 2>&1 | \80RUN: FileCheck --check-prefix=ERR2 %s81ERR2: error: invalid EXPORTAS value: expfunc,DATA82 83#--- test.s84 .section ".test", "rd"85 .rva __imp_func86 87#--- test.def88LIBRARY test.dll89EXPORTS90 func EXPORTAS expfunc91 92#--- test2.def93LIBRARY test.dll94EXPORTS95 func=otherdll.otherfunc EXPORTAS expfunc96 97#--- func.s98 .text99 .globl func100 .p2align 2, 0x0101func:102 movl $1, %eax103 retq104 105#--- drectve.s106 .section .drectve, "yn"107 .ascii " -export:func,EXPORTAS,expfunc"108