# RUN: mkdir -p %T
# RUN: llvm-mc -triple x86_64-unknown-windows-msvc -filetype obj -o %T/object.obj %S/Inputs/object.s

# RUN: lld-link /dll /machine:x64 /def:%S/Inputs/named.def /out:%T/library.dll %T/object.obj /entry:f /subsystem:CONSOLE
# RUN: llvm-ar t %T/library.lib | FileCheck %s -check-prefix CHECK-DEFAULT-DLL-EXT

# RUN: lld-link /machine:x64 /def:%S/Inputs/named.def /out:%T/library.lib
# RUN: llvm-ar t %T/library.lib | FileCheck %s -check-prefix CHECK-DEFAULT-DLL-EXT

CHECK-DEFAULT-DLL-EXT: library.dll
CHECK-DEFAULT-DLL-EXT: library.dll
CHECK-DEFAULT-DLL-EXT: library.dll
CHECK-DEFAULT-DLL-EXT: library.dll

# RUN: lld-link /machine:x64 /def:%S/Inputs/named.def /out:%T/library.exe %T/object.obj /entry:f /subsystem:CONSOLE
# RUN: llvm-ar t %T/library.lib | FileCheck %s -check-prefix CHECK-DEFAULT-EXE-EXT

CHECK-DEFAULT-EXE-EXT: library.exe
CHECK-DEFAULT-EXE-EXT: library.exe
CHECK-DEFAULT-EXE-EXT: library.exe
CHECK-DEFAULT-EXE-EXT: library.exe

# RUN: lld-link /dll /machine:x64 /def:%S/Inputs/extension.def /out:%T/extension.dll /entry:f /subsystem:CONSOLE
# RUN: llvm-ar t %T/extension.lib | FileCheck %s -check-prefix CHECK-EXTENSION

# RUN: lld-link /machine:x64 /def:%S/Inputs/extension.def /out:%T/extension.exe /entry:f /subsystem:CONSOLE
# RUN: llvm-ar t %T/extension.lib | FileCheck %s -check-prefix CHECK-EXTENSION

# RUN: lld-link /machine:x64 /def:%S/Inputs/extension.def /out:%T/extension.lib
# RUN: llvm-ar t %T/extension.lib | FileCheck %s -check-prefix CHECK-EXTENSION

CHECK-EXTENSION: library.ext
CHECK-EXTENSION: library.ext
CHECK-EXTENSION: library.ext
CHECK-EXTENSION: library.ext

# RUN: lld-link /dll /machine:x64 /def:%S/Inputs/default.def /out:%T/default.dll /entry:f /subsystem:CONSOLE
# RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-OUTPUT-NAME-DLL

# RUN: lld-link /machine:x64 /def:%S/Inputs/default.def /out:%T/default.lib
# RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-OUTPUT-NAME-DLL

CHECK-OUTPUT-NAME-DLL: default.dll
CHECK-OUTPUT-NAME-DLL: default.dll
CHECK-OUTPUT-NAME-DLL: default.dll
CHECK-OUTPUT-NAME-DLL: default.dll

# RUN: lld-link /machine:x64 /def:%S/Inputs/default.def /out:%T/default.exe %T/object.obj /entry:f /subsystem:CONSOLE
# RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-OUTPUT-NAME-EXE

CHECK-OUTPUT-NAME-EXE: default.exe
CHECK-OUTPUT-NAME-EXE: default.exe
CHECK-OUTPUT-NAME-EXE: default.exe
CHECK-OUTPUT-NAME-EXE: default.exe

# RUN: lld-link /machine:x64 /out:%T/default.exe %T/object.obj /entry:f /subsystem:CONSOLE
# RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-NODEF-EXE

CHECK-NODEF-EXE: default.exe
CHECK-NODEF-EXE: default.exe
CHECK-NODEF-EXE: default.exe
CHECK-NODEF-EXE: default.exe

# RUN: lld-link /machine:x64 /dll /out:%T/default.dll %T/object.obj /entry:f /subsystem:CONSOLE
# RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix CHECK-NODEF-DLL

CHECK-NODEF-DLL: default.dll
CHECK-NODEF-DLL: default.dll
CHECK-NODEF-DLL: default.dll
CHECK-NODEF-DLL: default.dll

