|
| 1 | +REQUIRES: x86 |
| 2 | +RUN: split-file %s %t.dir && cd %t.dir |
| 3 | + |
| 4 | +RUN: llvm-mc -filetype=obj -triple=x86_64-windows test.s -o test.obj |
| 5 | +RUN: llvm-lib -machine:amd64 -out:test.lib -def:test.def |
| 6 | +RUN: lld-link -out:out1.dll -dll -noentry test.obj test.lib |
| 7 | +RUN: llvm-readobj --coff-imports out1.dll | FileCheck --check-prefix=IMPORT %s |
| 8 | +IMPORT: Symbol: expfunc |
| 9 | + |
| 10 | +RUN: llvm-mc -filetype=obj -triple=x86_64-windows func.s -o func.obj |
| 11 | +RUN: lld-link -out:out2.dll -dll -noentry func.obj -export:func,EXPORTAS,expfunc |
| 12 | +RUN: llvm-readobj --coff-exports out2.dll | FileCheck --check-prefix=EXPORT %s |
| 13 | +EXPORT: Name: expfunc |
| 14 | + |
| 15 | +RUN: llvm-readobj out2.lib | FileCheck --check-prefix=IMPLIB %s |
| 16 | +IMPLIB: Name type: export as |
| 17 | +IMPLIB-NEXT: Export name: expfunc |
| 18 | +IMPLIB-NEXT: Symbol: __imp_func |
| 19 | +IMPLIB-NEXT: Symbol: func |
| 20 | + |
| 21 | +RUN: llvm-mc -filetype=obj -triple=x86_64-windows drectve.s -o drectve.obj |
| 22 | +RUN: lld-link -out:out3.dll -dll -noentry func.obj drectve.obj |
| 23 | +RUN: llvm-readobj --coff-exports out3.dll | FileCheck --check-prefix=EXPORT %s |
| 24 | +RUN: llvm-readobj out3.lib | FileCheck --check-prefix=IMPLIB %s |
| 25 | + |
| 26 | +RUN: lld-link -out:out4.dll -dll -noentry func.obj -def:test.def |
| 27 | +RUN: llvm-readobj --coff-exports out4.dll | FileCheck --check-prefix=EXPORT %s |
| 28 | +RUN: llvm-readobj out4.lib | FileCheck --check-prefix=IMPLIB %s |
| 29 | + |
| 30 | +RUN: lld-link -out:out5.dll -dll -noentry func.obj -def:test2.def |
| 31 | +RUN: llvm-readobj --coff-exports out5.dll | FileCheck --check-prefix=FORWARD-EXPORT %s |
| 32 | +FORWARD-EXPORT: Export { |
| 33 | +FORWARD-EXPORT-NEXT: Ordinal: 1 |
| 34 | +FORWARD-EXPORT-NEXT: Name: expfunc |
| 35 | +FORWARD-EXPORT-NEXT: ForwardedTo: otherdll.otherfunc |
| 36 | +FORWARD-EXPORT-NEXT: } |
| 37 | + |
| 38 | +RUN: llvm-readobj out5.lib | FileCheck --check-prefix=FORWARD-IMPLIB %s |
| 39 | +FORWARD-IMPLIB: Name type: export as |
| 40 | +FORWARD-IMPLIB-NEXT: Export name: expfunc |
| 41 | +FORWARD-IMPLIB-NEXT: Symbol: __imp_func |
| 42 | +FORWARD-IMPLIB-NEXT: Symbol: func |
| 43 | + |
| 44 | +RUN: lld-link -out:out6.dll -dll -noentry func.obj -export:func=otherdll.otherfunc,EXPORTAS,expfunc |
| 45 | +RUN: llvm-readobj --coff-exports out6.dll | FileCheck --check-prefix=FORWARD-EXPORT %s |
| 46 | +RUN: llvm-readobj out6.lib | FileCheck --check-prefix=FORWARD-IMPLIB %s |
| 47 | + |
| 48 | + |
| 49 | +RUN: lld-link -out:out7.dll -dll -noentry func.obj -export:func,DATA,@5,EXPORTAS,expfunc |
| 50 | +RUN: llvm-readobj --coff-exports out7.dll | FileCheck --check-prefix=ORD %s |
| 51 | +ORD: Ordinal: 5 |
| 52 | +ORD-NEXT: Name: expfunc |
| 53 | + |
| 54 | +RUN: llvm-readobj out7.lib | FileCheck --check-prefix=ORD-IMPLIB %s |
| 55 | +ORD-IMPLIB: Type: data |
| 56 | +ORD-IMPLIB-NEXT: Name type: export as |
| 57 | +ORD-IMPLIB-NEXT: Export name: expfunc |
| 58 | +ORD-IMPLIB-NEXT: Symbol: __imp_func |
| 59 | + |
| 60 | + |
| 61 | +RUN: not lld-link -out:err.dll -dll -noentry func.obj "-export:func,EXPORTAS," |
| 62 | +RUN: not lld-link -out:err.dll -dll -noentry func.obj "-export:func,EXPORTAS,expfunc,DATA" |
| 63 | + |
| 64 | +#--- test.s |
| 65 | + .section ".test", "rd" |
| 66 | + .rva __imp_func |
| 67 | + |
| 68 | +#--- test.def |
| 69 | +LIBRARY test.dll |
| 70 | +EXPORTS |
| 71 | + func EXPORTAS expfunc |
| 72 | + |
| 73 | +#--- test2.def |
| 74 | +LIBRARY test.dll |
| 75 | +EXPORTS |
| 76 | + func=otherdll.otherfunc EXPORTAS expfunc |
| 77 | + |
| 78 | +#--- func.s |
| 79 | + .text |
| 80 | + .globl func |
| 81 | + .p2align 2, 0x0 |
| 82 | +func: |
| 83 | + movl $1, %eax |
| 84 | + retq |
| 85 | + |
| 86 | +#--- drectve.s |
| 87 | + .section .drectve, "yn" |
| 88 | + .ascii " -export:func,EXPORTAS,expfunc" |
0 commit comments