Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions lld/test/COFF/nodefaultlib.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# RUN: cp %p/Inputs/hello64.obj %T
# RUN: cp %p/Inputs/std64.lib %T
# RUN: mkdir -p %t.dir
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could one just do mkdir -p %t here? Or is there something else with that name already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we could just mkdir -p %t. Using a %t.<suffix> is the typical convention though from what I've seen and matches everything else in the test.

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

# RUN: not lld-link /out:%t.exe /entry:main /subsystem:console \
# RUN: hello64.obj /defaultlib:std64.lib >& %t.log
Expand All @@ -9,12 +10,12 @@
# 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: lld-link /libpath:%t.dir /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: lld-link /libpath:%t.dir /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
Expand All @@ -24,10 +25,10 @@ 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: lld-link /libpath:%t.dir /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: env LIB=%t.dir 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.
Expand All @@ -37,11 +38,11 @@ MSVC stamps uppercase references in OBJ directives, thus ensure that passing low
UPPERCASE-NOT: OLDNAMES
UPPERCASE-NOT: LIBCMT

# RUN: yaml2obj -o %T/defaultlib.obj %p/Inputs/defaultlib.yaml
# RUN: yaml2obj -o %t.dir/defaultlib.obj %p/Inputs/defaultlib.yaml
# RUN: mkdir -p %t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64
# RUN: cp %p/Inputs/ret42.lib %t.dir/sysroot/VC/Tools/MSVC/1.1.1.1/lib/x64/default.lib

# RUN: lld-link /winsysroot:%t.dir/sysroot /out:%t.exe /entry:main /subsystem:console %T/defaultlib.obj
# RUN: not lld-link /winsysroot:%t.dir/sysroot /out:%t.exe /entry:main /subsystem:console /nodefaultlib:default.lib %T/defaultlib.obj 2>&1 | FileCheck -check-prefix=CHECK4 %s
# RUN: lld-link /winsysroot:%t.dir/sysroot /out:%t.exe /entry:main /subsystem:console %t.dir/defaultlib.obj
# RUN: not lld-link /winsysroot:%t.dir/sysroot /out:%t.exe /entry:main /subsystem:console /nodefaultlib:default.lib %t.dir/defaultlib.obj 2>&1 | FileCheck -check-prefix=CHECK4 %s

CHECK4: error: <root>: undefined symbol: main
12 changes: 7 additions & 5 deletions lld/test/COFF/pdb-options.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
; If /DEBUG is specified but not /pdb, it uses a default name in the current
; directory. This is a bit hacky since but we need to be IN our test specific
; temporary directory when we run this command or we can't test this
# RUN: cd %T
# RUN: lld-link /DEBUG /entry:main /nodefaultlib %t1.obj %t2.obj
# RUN: ls %t1.pdb
# RUN: rm %t*
# RUN: cd %T/..
# RUN: mkdir -p %t.dir
# RUN: cp %t1.obj %t.dir/1.obj
# RUN: cp %t2.obj %t.dir/2.obj
# RUN: cd %t.dir
# RUN: lld-link /DEBUG /entry:main /nodefaultlib %t.dir/1.obj %t.dir/2.obj
# RUN: ls %t.dir/1.pdb
# RUN: rm -r %t*
7 changes: 4 additions & 3 deletions lld/test/COFF/pdb-type-server-invalid-signature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
# VALID-SIGNATURE-NOT: The signature does not match; the file(s) might be out of date

# Test an invalid path reference to a PDB type server; as a fallback LLD should try to load the PDB in the same path as the OBJ
# RUN: yaml2obj %S/Inputs/pdb-type-server-invalid-path.yaml -o %t3.obj
# RUN: cp %S/Inputs/pdb-diff-cl.pdb %T
# RUN: lld-link %t3.obj -out:%t3.exe -debug -pdb:%t3.pdb -nodefaultlib -entry:main 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID-PATH -allow-empty
# RUN: mkdir -p %t.dir
# RUN: yaml2obj %S/Inputs/pdb-type-server-invalid-path.yaml -o %t.dir/3.obj
# RUN: cp %S/Inputs/pdb-diff-cl.pdb %t.dir/pdb-diff-cl.pdb
# RUN: lld-link %t.dir/3.obj -out:%t3.exe -debug -pdb:%t3.pdb -nodefaultlib -entry:main 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID-PATH -allow-empty

# INVALID-PATH-NOT: warning: Cannot use debug info for '{{.*}}3.obj' [LNK4099]
# INVALID-PATH-NOT: failed to load reference 'c:\some_invalid_path_AABB98765\pdb-diff-cl.pdb': [[MSG]]
Expand Down
14 changes: 8 additions & 6 deletions lld/test/COFF/wrap-lto-2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,30 @@
;; the wrapped symbol, when LTO or ThinLTO is involved. It checks for various
;; combinations of bitcode and regular objects.

; RUN: mkdir -p %t.dir

;; LTO + LTO
; RUN: lld-link -out:%t.bc-bc.exe %t.main.bc -libpath:%T %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: lld-link -out:%t.bc-bc.exe %t.main.bc -libpath:%t.dir %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.bc-bc.exe | FileCheck %s --check-prefixes=CHECK,JMP

;; LTO + Object
; RUN: lld-link -out:%t.bc-obj.exe %t.main.bc -libpath:%T %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: lld-link -out:%t.bc-obj.exe %t.main.bc -libpath:%t.dir %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.bc-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP

;; Object + LTO
; RUN: lld-link -out:%t.obj-bc.exe %t.main.obj -libpath:%T %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: lld-link -out:%t.obj-bc.exe %t.main.obj -libpath:%t.dir %t.bc.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.obj-bc.exe | FileCheck %s --check-prefixes=CHECK,CALL

;; ThinLTO + ThinLTO
; RUN: lld-link -out:%t.thin-thin.exe %t.main.thin -libpath:%T %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: lld-link -out:%t.thin-thin.exe %t.main.thin -libpath:%t.dir %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.thin-thin.exe | FileCheck %s --check-prefixes=CHECK,JMP

;; ThinLTO + Object
; RUN: lld-link -out:%t.thin-obj.exe %t.main.thin -libpath:%T %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: lld-link -out:%t.thin-obj.exe %t.main.thin -libpath:%t.dir %t.obj.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.thin-obj.exe | FileCheck %s --check-prefixes=CHECK,JMP

;; Object + ThinLTO
; RUN: lld-link -out:%t.obj-thin.exe %t.main.obj -libpath:%T %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: lld-link -out:%t.obj-thin.exe %t.main.obj -libpath:%t.dir %t.thin.lib -entry:entry -subsystem:console -wrap:bar -debug:symtab -lldsavetemps
; RUN: llvm-objdump -d %t.obj-thin.exe | FileCheck %s --check-prefixes=CHECK,CALL

;; Make sure that calls in entry() are not eliminated and that bar is
Expand Down
3 changes: 2 additions & 1 deletion lld/test/COFF/wrap-with-archive.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
// RUN: rm -f %t.lib
// RUN: llvm-ar rcs %t.lib %t.wrap.obj %t.other.obj

// RUN: lld-link -out:%t.exe %t.main.obj -libpath:%T %t.lib -entry:entry -subsystem:console -wrap:foo
// RUN: mkdir -p %t.dir
// RUN: lld-link -out:%t.exe %t.main.obj -libpath:%t.dir %t.lib -entry:entry -subsystem:console -wrap:foo

// Note: No real definition of foo exists here, but that works fine as long
// as there's no actual references to __real_foo.
Expand Down
3 changes: 2 additions & 1 deletion lld/test/wasm/lto/save-temps.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
; RUN: cd %T
; RUN: mkdir -p %t.dir
; RUN: cd %t.dir
; RUN: rm -f a.out a.out.lto.bc a.out.lto.o
; RUN: llvm-as %s -o %t.o
; RUN: llvm-as %p/Inputs/save-temps.ll -o %t2.o
Expand Down