llvm/lld/test/COFF/nodefaultlib.test

# RUN: cp %p/Inputs/hello64.obj %T
# RUN: cp %p/Inputs/std64.lib %T

# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console \
# RUN:   hello64.obj /defaultlib:std64.lib >& %t.log
# RUN: FileCheck -DMSG=%errc_ENOENT -check-prefix=CHECK1 %s < %t.log

# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console \
# RUN:   hello64 /defaultlib:std64.lib >& %t.log
# RUN: FileCheck -DMSG=%errc_ENOENT -check-prefix=CHECK2 %s < %t.log

# RUN: lld-link /libpath:%T /out:%t.exe /entry:main \
# RUN:   /subsystem:console hello64.obj /defaultlib:std64.lib \
# RUN:   /nodefaultlib:std64.lib >& %t.log || true
# RUN: FileCheck -check-prefix=CHECK3 %s < %t.log

# RUN: lld-link /libpath:%T /out:%t.exe /entry:main \
# RUN:   /subsystem:console hello64.obj /defaultlib:std64 \
# RUN:   /nodefaultlib:std64.lib >& %t.log || true
# RUN: FileCheck -check-prefix=CHECK3 %s < %t.log

CHECK1: error: could not open 'hello64.obj': [[MSG]]
CHECK2: error: could not open 'hello64': [[MSG]]
CHECK3: error: undefined symbol: MessageBoxA
CHECK3-NEXT: >>> referenced by {{.*}}hello64.obj:(main)

# RUN: lld-link /libpath:%T /out:%t.exe /entry:main \
# RUN:   /subsystem:console hello64.obj /defaultlib:std64.lib

# RUN: env LIB=%T lld-link /out:%t.exe /entry:main \
# RUN:   /subsystem:console hello64.obj /defaultlib:std64.lib

MSVC stamps uppercase references in OBJ directives, thus ensure that passing lowercase 'libcmt' and 'oldnames' to /nodefaultlib works.
# RUN: lld-link %S/Inputs/precomp.obj %S/Inputs/precomp-a.obj %S/Inputs/precomp-b.obj /nodefaultlib:libcmt /nodefaultlib:oldnames /entry:main /debug /pdb:%t.pdb /out:%t.exe /opt:ref /opt:icf
# RUN: llvm-pdbutil dump -modules %t.pdb | FileCheck %s -check-prefix UPPERCASE

UPPERCASE-NOT: OLDNAMES
UPPERCASE-NOT: LIBCMT