[lld] 81cebfd - [ELF][test] Change -o %t to -o /dev/null if the output is not needed

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 21:55:34 PST 2020


Author: Fangrui Song
Date: 2020-02-12T21:54:50-08:00
New Revision: 81cebfd0080e3873d0cef5ee5215b8c97332ff96

URL: https://github.com/llvm/llvm-project/commit/81cebfd0080e3873d0cef5ee5215b8c97332ff96
DIFF: https://github.com/llvm/llvm-project/commit/81cebfd0080e3873d0cef5ee5215b8c97332ff96.diff

LOG: [ELF][test] Change -o %t to -o /dev/null if the output is not needed

Added: 
    

Modified: 
    lld/test/ELF/aarch64-bti-pac-cli-error.s
    lld/test/ELF/aarch64-prel16.s
    lld/test/ELF/aarch64-prel32.s
    lld/test/ELF/abs-conflict.s
    lld/test/ELF/allow-multiple-definition.s
    lld/test/ELF/amdgpu-abi-version-err.s
    lld/test/ELF/arm-tag-vfp-args-illegal.s
    lld/test/ELF/arm-target1.s
    lld/test/ELF/arm-tls-norelax-gd-le.s
    lld/test/ELF/arm-v5-reloc-error.s
    lld/test/ELF/auxiliary.s
    lld/test/ELF/bad-archive.s
    lld/test/ELF/basic.s
    lld/test/ELF/compress-debug-sections.s
    lld/test/ELF/compressed-debug-input-err.s
    lld/test/ELF/conflict-debug-variable-file-index.s
    lld/test/ELF/conflict-debug-variable.s
    lld/test/ELF/conflict.s
    lld/test/ELF/copy-errors.s
    lld/test/ELF/debug-line-obj.s
    lld/test/ELF/debug-line-str.s
    lld/test/ELF/defsym.s
    lld/test/ELF/duplicated-synthetic-sym.s
    lld/test/ELF/dynamic-list-locals.s
    lld/test/ELF/dynamic-list-unexpected-end.s
    lld/test/ELF/eh-frame-value-format9.s
    lld/test/ELF/execute-only-mixed-data.s
    lld/test/ELF/gc-sections-no-undef-error.s
    lld/test/ELF/gdb-index-invalid-ranges.s
    lld/test/ELF/gdb-index-parse-fail.s
    lld/test/ELF/global-offset-table-position-redef-err.s
    lld/test/ELF/got32-i386.s
    lld/test/ELF/got32x-i386.s
    lld/test/ELF/hexagon-jump-error.s
    lld/test/ELF/hidden-shared-err.s
    lld/test/ELF/i386-pic-plt.s
    lld/test/ELF/image-base.s
    lld/test/ELF/incompatible.s
    lld/test/ELF/invalid-local-symbol-in-dso.s
    lld/test/ELF/invalid/bad-reloc-target.test
    lld/test/ELF/invalid/broken-relaxation-x64.test
    lld/test/ELF/invalid/comdat-broken.test
    lld/test/ELF/invalid/common-symbol-alignment.test
    lld/test/ELF/invalid/invalid-debug-relocations.test
    lld/test/ELF/invalid/invalid-elf.test
    lld/test/ELF/invalid/invalid-file-class.test
    lld/test/ELF/invalid/invalid-soname.test
    lld/test/ELF/invalid/linkorder-invalid-sec.test
    lld/test/ELF/invalid/mips-invalid-options-descriptor.test
    lld/test/ELF/invalid/multiple-relocations-sections.test
    lld/test/ELF/invalid/non-terminated-string.test
    lld/test/ELF/invalid/reloc-section-reordered.test
    lld/test/ELF/invalid/section-alignment.test
    lld/test/ELF/invalid/section-alignment2.s
    lld/test/ELF/invalid/section-index.test
    lld/test/ELF/invalid/sht-group-wrong-section.test
    lld/test/ELF/invalid/sht-group.test
    lld/test/ELF/invalid/symbol-name.test
    lld/test/ELF/invalid/symtab-sh-info.s
    lld/test/ELF/invalid/verdef-no-symtab.test
    lld/test/ELF/libsearch.s
    lld/test/ELF/linkerscript/address-expr-symbols.s
    lld/test/ELF/linkerscript/align1.test
    lld/test/ELF/linkerscript/alignof.test
    lld/test/ELF/linkerscript/at5.test
    lld/test/ELF/linkerscript/broken-memory-declaration.s
    lld/test/ELF/linkerscript/diag1.test
    lld/test/ELF/linkerscript/diag2.test
    lld/test/ELF/linkerscript/diag3.test
    lld/test/ELF/linkerscript/diag4.test
    lld/test/ELF/linkerscript/diag5.test
    lld/test/ELF/linkerscript/diag6.test
    lld/test/ELF/linkerscript/discard-section-err.s
    lld/test/ELF/linkerscript/eh-frame-reloc-out-of-range.test
    lld/test/ELF/linkerscript/exclude-multiple.s
    lld/test/ELF/linkerscript/expr-invalid-sec.test
    lld/test/ELF/linkerscript/group.s
    lld/test/ELF/linkerscript/huge-temporary-file.s
    lld/test/ELF/linkerscript/info-section-type.s
    lld/test/ELF/linkerscript/insert-broken.test
    lld/test/ELF/linkerscript/insert-not-exist.test
    lld/test/ELF/linkerscript/linkerscript.s
    lld/test/ELF/linkerscript/lma-overflow.test
    lld/test/ELF/linkerscript/loadaddr.s
    lld/test/ELF/linkerscript/locationcountererr.test
    lld/test/ELF/linkerscript/memory-data-commands.test
    lld/test/ELF/linkerscript/memory-err.s
    lld/test/ELF/linkerscript/memory.s
    lld/test/ELF/linkerscript/numbers.s
    lld/test/ELF/linkerscript/operators.test
    lld/test/ELF/linkerscript/orphan-report.s
    lld/test/ELF/linkerscript/overlapping-sections.s
    lld/test/ELF/linkerscript/overlay-reject.test
    lld/test/ELF/linkerscript/overlay-reject2.test
    lld/test/ELF/linkerscript/page-size.s
    lld/test/ELF/linkerscript/phdrs.s
    lld/test/ELF/linkerscript/region-alias.s
    lld/test/ELF/linkerscript/sections-padding.s
    lld/test/ELF/linkerscript/version-script.s
    lld/test/ELF/local-undefined-symbol.s
    lld/test/ELF/lto/bitcode-nodatalayout.ll
    lld/test/ELF/lto/combined-lto-object-name.ll
    lld/test/ELF/lto/duplicated.ll
    lld/test/ELF/lto/irmover-error.ll
    lld/test/ELF/lto/ltopasses-custom.ll
    lld/test/ELF/lto/mix-platforms.ll
    lld/test/ELF/lto/mix-platforms2.ll
    lld/test/ELF/lto/opt-level.ll
    lld/test/ELF/lto/setting-dso-local.ll
    lld/test/ELF/lto/thinlto-cant-write-index.ll
    lld/test/ELF/lto/thinlto-emit-imports.ll
    lld/test/ELF/lto/thinlto-prefix-replace.ll
    lld/test/ELF/map-file.s
    lld/test/ELF/mergeable-errors.s
    lld/test/ELF/mips-elf-flags-err.s
    lld/test/ELF/mips-micro-bad-cross-calls.s
    lld/test/ELF/no-inhibit-exec.s
    lld/test/ELF/ppc64-bsymbolic-toc-restore.s
    lld/test/ELF/ppc64-error-missaligned-dq.s
    lld/test/ELF/ppc64-error-missaligned-ds.s
    lld/test/ELF/ppc64-error-toc-restore.s
    lld/test/ELF/ppc64-error-toc-tail-call.s
    lld/test/ELF/ppc64-split-stack-adjust-fail.s
    lld/test/ELF/ppc64-split-stack-adjust-overflow.s
    lld/test/ELF/ppc64-split-stack-adjust-size-success.s
    lld/test/ELF/protected-data-access.s
    lld/test/ELF/push-state.s
    lld/test/ELF/relocatable-common.s
    lld/test/ELF/relro-non-contiguous-script-data.s
    lld/test/ELF/riscv-branch.s
    lld/test/ELF/riscv-call.s
    lld/test/ELF/riscv-hi20-lo12.s
    lld/test/ELF/riscv-jal.s
    lld/test/ELF/riscv-pcrel-hilo.s
    lld/test/ELF/riscv-reloc-64-pic.s
    lld/test/ELF/sectionstart.s
    lld/test/ELF/symbol-ordering-file-cgprofile-conflicts.s
    lld/test/ELF/sysroot.s
    lld/test/ELF/undef-shared2.s
    lld/test/ELF/undef.s
    lld/test/ELF/undefined-glob.s
    lld/test/ELF/unresolved-symbols.s
    lld/test/ELF/version-exclude-libs.s
    lld/test/ELF/version-script-err.s
    lld/test/ELF/version-script.s
    lld/test/ELF/vs-diagnostics-duplicate.s
    lld/test/ELF/vs-diagnostics-undefined-symbol-1.s
    lld/test/ELF/vs-diagnostics-undefined-symbol-2.s
    lld/test/ELF/vs-diagnostics-undefined-symbol-3.s
    lld/test/ELF/warn-backrefs.s
    lld/test/ELF/weak-and-strong-undef.s
    lld/test/ELF/x86-64-dyn-rel-error.s
    lld/test/ELF/x86-64-split-stack-prologue-adjust-fail.s
    lld/test/ELF/zdefs.s
    lld/test/ELF/znotext-weak-undef.s
    lld/test/ELF/ztext.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/aarch64-bti-pac-cli-error.s b/lld/test/ELF/aarch64-bti-pac-cli-error.s
index f3ad7d14bbdc..8155097674e7 100644
--- a/lld/test/ELF/aarch64-bti-pac-cli-error.s
+++ b/lld/test/ELF/aarch64-bti-pac-cli-error.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc --triple=x86_64-pc-linux --filetype=obj -o %t.o %s
-# RUN: not ld.lld -z pac-plt -z force-bti %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld -z pac-plt -z force-bti %t.o -o /dev/null 2>&1 | FileCheck %s
 #
 ## Check that we error if -z pac-plt and -z force-bti are used when target is not
 ## aarch64

diff  --git a/lld/test/ELF/aarch64-prel16.s b/lld/test/ELF/aarch64-prel16.s
index af96bf3df7e3..078336f6ae38 100644
--- a/lld/test/ELF/aarch64-prel16.s
+++ b/lld/test/ELF/aarch64-prel16.s
@@ -24,8 +24,8 @@ _start:
 //         S + A - P = 0x8000
 // CHECK-NEXT: 202158 ffff0080
 
-// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o %t2 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
+// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
 // OVERFLOW1: relocation R_AARCH64_PREL16 out of range: -32769 is not in [-32768, 65535]; references foo
 
-// RUN: not ld.lld -z max-page-size=4096 %t.o %t257.o -o %t2 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
+// RUN: not ld.lld -z max-page-size=4096 %t.o %t257.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
 // OVERFLOW2: relocation R_AARCH64_PREL16 out of range: 65536 is not in [-32768, 65535]; references foo

diff  --git a/lld/test/ELF/aarch64-prel32.s b/lld/test/ELF/aarch64-prel32.s
index 02e2ad39ed8f..760f60040ce5 100644
--- a/lld/test/ELF/aarch64-prel32.s
+++ b/lld/test/ELF/aarch64-prel32.s
@@ -24,8 +24,8 @@ _start:
 //         S + A - P = 0x80000000
 // CHECK-NEXT: 202158 ffffffff 00000080
 
-// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o %t2 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
+// RUN: not ld.lld -z max-page-size=4096 %t.o %t255.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW1
 // OVERFLOW1: relocation R_AARCH64_PREL32 out of range: -2147483649 is not in [-2147483648, 4294967295]; references foo
 
-// RUN: not ld.lld -z max-page-size=4096 %t.o %t257.o -o %t2 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
+// RUN: not ld.lld -z max-page-size=4096 %t.o %t257.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OVERFLOW2
 // OVERFLOW2: relocation R_AARCH64_PREL32 out of range: 4294967296 is not in [-2147483648, 4294967295]; references foo

diff  --git a/lld/test/ELF/abs-conflict.s b/lld/test/ELF/abs-conflict.s
index ea435cc956c0..4c6a62e96b63 100644
--- a/lld/test/ELF/abs-conflict.s
+++ b/lld/test/ELF/abs-conflict.s
@@ -11,7 +11,7 @@ foo = 0x123
 
 // RUN: echo ".global foo; foo = 0x124" >  %t2.s
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %t2.s -o %t2.o
-// RUN: not ld.lld %t.o %t2.o -o %t.so -shared 2>&1 | FileCheck --check-prefix=DUP %s
+// RUN: not ld.lld %t.o %t2.o -o /dev/null -shared 2>&1 | FileCheck --check-prefix=DUP %s
 
 // DUP:      duplicate symbol: foo
 // DUP-NEXT: >>> defined in {{.*}}.o

diff  --git a/lld/test/ELF/allow-multiple-definition.s b/lld/test/ELF/allow-multiple-definition.s
index 46a7290f88f4..fac5986cc300 100644
--- a/lld/test/ELF/allow-multiple-definition.s
+++ b/lld/test/ELF/allow-multiple-definition.s
@@ -2,8 +2,8 @@
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/allow-multiple-definition.s -o %t2
-# RUN: not ld.lld %t1 %t2 -o %t3
-# RUN: not ld.lld --allow-multiple-definition --no-allow-multiple-definition %t1 %t2 -o %t3
+# RUN: not ld.lld %t1 %t2 -o /dev/null
+# RUN: not ld.lld --allow-multiple-definition --no-allow-multiple-definition %t1 %t2 -o /dev/null
 # RUN: ld.lld --allow-multiple-definition --fatal-warnings %t1 %t2 -o %t3
 # RUN: ld.lld --allow-multiple-definition --fatal-warnings %t2 %t1 -o %t4
 # RUN: llvm-objdump -d %t3 | FileCheck %s

diff  --git a/lld/test/ELF/amdgpu-abi-version-err.s b/lld/test/ELF/amdgpu-abi-version-err.s
index a670ec75bf1f..e110eada84d5 100644
--- a/lld/test/ELF/amdgpu-abi-version-err.s
+++ b/lld/test/ELF/amdgpu-abi-version-err.s
@@ -1,7 +1,7 @@
 # REQUIRES: amdgpu
 # RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj %s -o %t-0.o
 # RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=-code-object-v3 -filetype=obj %s -o %t-1.o
-# RUN: not ld.lld -shared %t-0.o %t-1.o -o %t.so 2>&1 | FileCheck %s
+# RUN: not ld.lld -shared %t-0.o %t-1.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: ld.lld: error: incompatible ABI version: {{.*}}-1.o
 

diff  --git a/lld/test/ELF/arm-tag-vfp-args-illegal.s b/lld/test/ELF/arm-tag-vfp-args-illegal.s
index 471a024b3c09..b661d57b13b3 100644
--- a/lld/test/ELF/arm-tag-vfp-args-illegal.s
+++ b/lld/test/ELF/arm-tag-vfp-args-illegal.s
@@ -1,6 +1,6 @@
 // REQUIRES:arm
 // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
-// RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 // CHECK: arm-tag-vfp-args-illegal.s.tmp.o: unknown Tag_ABI_VFP_args value: 5
         .arch armv7-a

diff  --git a/lld/test/ELF/arm-target1.s b/lld/test/ELF/arm-target1.s
index 99b52b0a7bd6..3bd8cb645dc2 100644
--- a/lld/test/ELF/arm-target1.s
+++ b/lld/test/ELF/arm-target1.s
@@ -4,13 +4,13 @@
 // RUN: ld.lld -shared %t.o -o %t2.so --target1-rel
 // RUN: llvm-objdump -t -d %t2.so | FileCheck %s \
 // RUN:   --check-prefix=RELATIVE
-// RUN: not ld.lld -shared %t.o -o %t3.so 2>&1 | FileCheck %s \
+// RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s \
 // RUN:   --check-prefix=ABS
 
 // RUN: ld.lld -shared %t.o -o %t2.so --target1-abs --target1-rel
 // RUN: llvm-objdump -t -d %t2.so | FileCheck %s \
 // RUN:   --check-prefix=RELATIVE
-// RUN: not ld.lld -shared %t.o -o %t3.so --target1-rel --target1-abs 2>&1 \
+// RUN: not ld.lld -shared %t.o -o /dev/null --target1-rel --target1-abs 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=ABS
 
 // RELOC: Relocations [

diff  --git a/lld/test/ELF/arm-tls-norelax-gd-le.s b/lld/test/ELF/arm-tls-norelax-gd-le.s
index 5698bb1fdb8e..0cac059cddbd 100644
--- a/lld/test/ELF/arm-tls-norelax-gd-le.s
+++ b/lld/test/ELF/arm-tls-norelax-gd-le.s
@@ -37,5 +37,5 @@ x:
 
 
 // Without any definition of __tls_get_addr we get an error
-// RUN: not ld.lld  %t.o -o %t 2>&1 | FileCheck --check-prefix=ERR %s
+// RUN: not ld.lld  %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
 // ERR: error: undefined symbol: __tls_get_addr

diff  --git a/lld/test/ELF/arm-v5-reloc-error.s b/lld/test/ELF/arm-v5-reloc-error.s
index 90ea36d3df12..6b69e3b2d8fd 100644
--- a/lld/test/ELF/arm-v5-reloc-error.s
+++ b/lld/test/ELF/arm-v5-reloc-error.s
@@ -5,7 +5,7 @@
 // RUN:       .text_low : { *(.text_low) *(.text_low2) } \
 // RUN:       .text_high 0x2000000 : { *(.text_high) *(.text_high2) } \
 // RUN:       } " > %t.script
-// RUN: not ld.lld --script %t.script %t -o %t2 2>&1 | FileCheck %s
+// RUN: not ld.lld --script %t.script %t -o /dev/null 2>&1 | FileCheck %s
 
 // CHECK: error: relocation R_ARM_THM_JUMP24 to far not supported for Armv5 or Armv6 targets
 

diff  --git a/lld/test/ELF/auxiliary.s b/lld/test/ELF/auxiliary.s
index 86551e3e84bf..5a74060cc851 100644
--- a/lld/test/ELF/auxiliary.s
+++ b/lld/test/ELF/auxiliary.s
@@ -10,6 +10,6 @@
 # CHECK-NEXT: 0x000000007FFFFFFD AUXILIARY     Auxiliary library: [aaa]
 # CHECK-NEXT: 0x000000007FFFFFFD AUXILIARY     Auxiliary library: [bbb]
 
-# RUN: not ld.lld %t.o -f aaa --auxiliary bbb -o %t 2>&1 \
+# RUN: not ld.lld %t.o -f aaa --auxiliary bbb -o /dev/null 2>&1 \
 # RUN:    | FileCheck -check-prefix=ERR %s
 # ERR: -f may not be used without -shared

diff  --git a/lld/test/ELF/bad-archive.s b/lld/test/ELF/bad-archive.s
index 6d70e5542678..ba6d674c2fa6 100644
--- a/lld/test/ELF/bad-archive.s
+++ b/lld/test/ELF/bad-archive.s
@@ -6,8 +6,8 @@
 // RUN: echo "!<arch>" > %t.a
 // RUN: echo "foo" >> %t.a
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-// RUN: not ld.lld %t.o %t.a -o %t 2>&1 | FileCheck -DFILE=%t.a %s
-// RUN: not ld.lld %t.o --whole-archive %t.a -o %t 2>&1 | FileCheck -DFILE=%t.a %s
+// RUN: not ld.lld %t.o %t.a -o /dev/null 2>&1 | FileCheck -DFILE=%t.a %s
+// RUN: not ld.lld %t.o --whole-archive %t.a -o /dev/null 2>&1 | FileCheck -DFILE=%t.a %s
 // CHECK: error: [[FILE]]: failed to parse archive: truncated or malformed archive (remaining size of archive too small for next archive member header at offset 8)
 
 .globl _start

diff  --git a/lld/test/ELF/basic.s b/lld/test/ELF/basic.s
index 1343ab0febd9..7ed0ec624d7a 100644
--- a/lld/test/ELF/basic.s
+++ b/lld/test/ELF/basic.s
@@ -218,15 +218,15 @@ _start:
 # RUN:   --check-prefix=INVRSP
 # INVRSP: invalid response file quoting: patatino
 
-# RUN: not ld.lld %t.foo -o %t2 2>&1 | \
+# RUN: not ld.lld %t.foo -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=MISSING %s
 # MISSING: cannot open {{.*}}.foo: {{[Nn]}}o such file or directory
 
-# RUN: not ld.lld -o %t2 2>&1 | \
+# RUN: not ld.lld -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=NO_INPUT %s
 # NO_INPUT: ld.lld{{.*}}: no input files
 
-# RUN: not ld.lld %t.no.such.file -o %t2 2>&1 | \
+# RUN: not ld.lld %t.no.such.file -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=CANNOT_OPEN %s
 # CANNOT_OPEN: cannot open {{.*}}.no.such.file: {{[Nn]}}o such file or directory
 
@@ -237,12 +237,12 @@ _start:
 # UNKNOWN: unknown argument '--foo'
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: not ld.lld %t %t -o %t2 2>&1 | FileCheck --check-prefix=DUP %s
+# RUN: not ld.lld %t %t -o /dev/null 2>&1 | FileCheck --check-prefix=DUP %s
 # DUP:      duplicate symbol: _start
 # DUP-NEXT: >>> defined at {{.*}}:(.text+0x0)
 # DUP-NEXT: >>> defined at {{.*}}:(.text+0x0)
 
-# RUN: not ld.lld %t -o %t -m wrong_emul_fbsd 2>&1 | FileCheck --check-prefix=UNKNOWN_EMUL %s
+# RUN: not ld.lld %t -o /dev/null -m wrong_emul_fbsd 2>&1 | FileCheck --check-prefix=UNKNOWN_EMUL %s
 # UNKNOWN_EMUL: unknown emulation: wrong_emul_fbsd
 
 # RUN: not ld.lld %t --lto-partitions=0 2>&1 | FileCheck --check-prefix=NOTHREADS %s

diff  --git a/lld/test/ELF/compress-debug-sections.s b/lld/test/ELF/compress-debug-sections.s
index cbc6a9862825..93e834660cf8 100644
--- a/lld/test/ELF/compress-debug-sections.s
+++ b/lld/test/ELF/compress-debug-sections.s
@@ -26,7 +26,7 @@
 # RUN: llvm-objdump -s %t2 | FileCheck %s --check-prefix=ZLIBCONTENT
 # RUN: llvm-readobj -S %t2 | FileCheck %s --check-prefix=ZLIBFLAGS
 
-# RUN: not ld.lld %t.o -o %t1 --compress-debug-sections=zlib-gabi 2>&1 | \
+# RUN: not ld.lld %t.o -o /dev/null --compress-debug-sections=zlib-gabi 2>&1 | \
 # RUN:   FileCheck -check-prefix=ERR %s
 # ERR: unknown --compress-debug-sections value: zlib-gabi
 

diff  --git a/lld/test/ELF/compressed-debug-input-err.s b/lld/test/ELF/compressed-debug-input-err.s
index 191075e7c7c7..89773eca59d7 100644
--- a/lld/test/ELF/compressed-debug-input-err.s
+++ b/lld/test/ELF/compressed-debug-input-err.s
@@ -1,7 +1,7 @@
 # REQUIRES: zlib, x86
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null -shared 2>&1 | FileCheck %s
 
 ## Check we are able to report zlib uncompress errors.
 # CHECK: error: {{.*}}.o:(.debug_str): uncompress failed: zlib error: Z_DATA_ERROR

diff  --git a/lld/test/ELF/conflict-debug-variable-file-index.s b/lld/test/ELF/conflict-debug-variable-file-index.s
index c7bd8bbcbafb..199fcb199ac2 100644
--- a/lld/test/ELF/conflict-debug-variable-file-index.s
+++ b/lld/test/ELF/conflict-debug-variable-file-index.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: not ld.lld %t.o %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s
 
 ## Check we are able to report errors even if DW_AT_decl_file
 ## contains invalid file name index.

diff  --git a/lld/test/ELF/conflict-debug-variable.s b/lld/test/ELF/conflict-debug-variable.s
index 244ac146a01b..a9188fc0cf2f 100644
--- a/lld/test/ELF/conflict-debug-variable.s
+++ b/lld/test/ELF/conflict-debug-variable.s
@@ -1,7 +1,7 @@
 // REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: llvm-dwarfdump %t.o | FileCheck -check-prefix=INPUT %s
-# RUN: not ld.lld %t.o %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # INPUT:     .debug_info contents:
 # INPUT:       DW_TAG_variable
@@ -32,7 +32,7 @@
 # CHECK-NEXT: >>>            {{.*}}:(.bss+0x0)
 
 ## Check that stripping debug sections does not break error reporting.
-# RUN: not ld.lld --strip-debug %t.o %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld --strip-debug %t.o %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # Used reduced output from following code and gcc 7.1.0
 # to produce this input file:

diff  --git a/lld/test/ELF/conflict.s b/lld/test/ELF/conflict.s
index 6cfb8f557ad3..66a7f3912dbe 100644
--- a/lld/test/ELF/conflict.s
+++ b/lld/test/ELF/conflict.s
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
-# RUN: not ld.lld %t1.o %t1.o -o %t2 2>&1 | FileCheck -check-prefix=DEMANGLE %s
+# RUN: not ld.lld %t1.o %t1.o -o /dev/null 2>&1 | FileCheck -check-prefix=DEMANGLE %s
 
 # DEMANGLE:       duplicate symbol: mul(double, double)
 # DEMANGLE-NEXT:  >>> defined at {{.*}}:(.text+0x0)
@@ -10,7 +10,7 @@
 # DEMANGLE-NEXT:  >>> defined at {{.*}}:(.text+0x0)
 # DEMANGLE-NEXT:  >>> defined at {{.*}}:(.text+0x0)
 
-# RUN: not ld.lld %t1.o %t1.o -o %t2 --no-demangle 2>&1 | \
+# RUN: not ld.lld %t1.o %t1.o -o /dev/null --no-demangle 2>&1 | \
 # RUN:   FileCheck -check-prefix=NO_DEMANGLE %s
 
 # NO_DEMANGLE:      duplicate symbol: _Z3muldd
@@ -20,15 +20,15 @@
 # NO_DEMANGLE-NEXT: >>> defined at {{.*}}:(.text+0x0)
 # NO_DEMANGLE-NEXT: >>> defined at {{.*}}:(.text+0x0)
 
-# RUN: not ld.lld %t1.o %t1.o -o %t2 --demangle --no-demangle 2>&1 | \
+# RUN: not ld.lld %t1.o %t1.o -o /dev/null --demangle --no-demangle 2>&1 | \
 # RUN:   FileCheck -check-prefix=NO_DEMANGLE %s
-# RUN: not ld.lld %t1.o %t1.o -o %t2 --no-demangle --demangle 2>&1 | \
+# RUN: not ld.lld %t1.o %t1.o -o /dev/null --no-demangle --demangle 2>&1 | \
 # RUN:   FileCheck -check-prefix=DEMANGLE %s
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/conflict.s -o %t2.o
 # RUN: rm -f %t3.a
 # RUN: llvm-ar rcs %t3.a %t2.o
-# RUN: not ld.lld %t1.o %t3.a -u baz -o %t2 2>&1 | FileCheck -check-prefix=ARCHIVE %s
+# RUN: not ld.lld %t1.o %t3.a -u baz -o /dev/null 2>&1 | FileCheck -check-prefix=ARCHIVE %s
 
 # ARCHIVE:      duplicate symbol: foo
 # ARCHIVE-NEXT: >>> defined at {{.*}}:(.text+0x0)

diff  --git a/lld/test/ELF/copy-errors.s b/lld/test/ELF/copy-errors.s
index bf3c79255e8b..5b68307ab88b 100644
--- a/lld/test/ELF/copy-errors.s
+++ b/lld/test/ELF/copy-errors.s
@@ -2,7 +2,7 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/protected-shared.s -o %t2.o
 // RUN: ld.lld %t2.o -o %t2.so -shared
-// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o %t2.so -o /dev/null 2>&1 | FileCheck %s
 
 // CHECK: error: cannot preempt symbol: bar
 // CHECK: >>> defined in {{.*}}.so

diff  --git a/lld/test/ELF/debug-line-obj.s b/lld/test/ELF/debug-line-obj.s
index 020678bb6319..b4b627ca1431 100644
--- a/lld/test/ELF/debug-line-obj.s
+++ b/lld/test/ELF/debug-line-obj.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -dwarf-version=5 %s -o %t.o
-# RUN: not ld.lld %t.o -o %t1 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # When compiling with -ffunction-sections, .debug_line may contain descriptions
 # of locations from the 
diff erent text sections. Until relocated such

diff  --git a/lld/test/ELF/debug-line-str.s b/lld/test/ELF/debug-line-str.s
index af5eee4f5abd..b303e8c71c10 100644
--- a/lld/test/ELF/debug-line-str.s
+++ b/lld/test/ELF/debug-line-str.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -dwarf-version=5 %s -o %t.o
-# RUN: not ld.lld %t.o -o %t1 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # Check we do not crash and able to report the source location.
 

diff  --git a/lld/test/ELF/defsym.s b/lld/test/ELF/defsym.s
index 380b7f37aefc..3e06e83eb39d 100644
--- a/lld/test/ELF/defsym.s
+++ b/lld/test/ELF/defsym.s
@@ -11,7 +11,7 @@
 
 ## Check we are reporting the error correctly and don't crash
 ## when handling the second --defsym.
-# RUN: not ld.lld -o %t2 %t.o --defsym ERR+ \
+# RUN: not ld.lld -o /dev/null %t.o --defsym ERR+ \
 #        --defsym foo2=foo1 2>&1 | FileCheck %s --check-prefix=ERR
 # ERR: error: -defsym: syntax error: ERR+
 
@@ -75,16 +75,16 @@
 # EXPR-NEXT:   Section: Absolute
 # EXPR-NEXT: }
 
-# RUN: not ld.lld -o %t %t.o --defsym=foo2=und 2>&1 | FileCheck %s -check-prefix=ERR1
+# RUN: not ld.lld -o /dev/null %t.o --defsym=foo2=und 2>&1 | FileCheck %s -check-prefix=ERR1
 # ERR1: error: -defsym:1: symbol not found: und
 
-# RUN: not ld.lld -o %t %t.o --defsym=xxx=yyy,zzz 2>&1 | FileCheck %s -check-prefix=ERR2
+# RUN: not ld.lld -o /dev/null %t.o --defsym=xxx=yyy,zzz 2>&1 | FileCheck %s -check-prefix=ERR2
 # ERR2: -defsym:1: EOF expected, but got ,
 
-# RUN: not ld.lld -o %t %t.o --defsym=foo 2>&1 | FileCheck %s -check-prefix=ERR3
+# RUN: not ld.lld -o /dev/null %t.o --defsym=foo 2>&1 | FileCheck %s -check-prefix=ERR3
 # ERR3: error: -defsym: syntax error: foo
 
-# RUN: not ld.lld -o %t %t.o --defsym= 2>&1 | FileCheck %s -check-prefix=ERR4
+# RUN: not ld.lld -o /dev/null %t.o --defsym= 2>&1 | FileCheck %s -check-prefix=ERR4
 # ERR4: error: -defsym: syntax error:
 
 .globl foo1

diff  --git a/lld/test/ELF/duplicated-synthetic-sym.s b/lld/test/ELF/duplicated-synthetic-sym.s
index bc4f5cf7650a..64e71614e6d6 100644
--- a/lld/test/ELF/duplicated-synthetic-sym.s
+++ b/lld/test/ELF/duplicated-synthetic-sym.s
@@ -5,8 +5,8 @@
 // RUN: cd %t.dir
 // RUN: echo > file.bin
 
-// RUN: not ld.lld %t.o --format=binary file.bin -o %t.elf 2>&1 | FileCheck %s
-// RUN: not ld.lld %t.o --format binary file.bin -o %t.elf 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o --format=binary file.bin -o /dev/null 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o --format binary file.bin -o /dev/null 2>&1 | FileCheck %s
 
 // CHECK:      duplicate symbol: _binary_file_bin_start
 // CHECK-NEXT: defined at {{.*}}.o:(.text+0x0)

diff  --git a/lld/test/ELF/dynamic-list-locals.s b/lld/test/ELF/dynamic-list-locals.s
index 36ac849f514d..9773c9491961 100644
--- a/lld/test/ELF/dynamic-list-locals.s
+++ b/lld/test/ELF/dynamic-list-locals.s
@@ -2,6 +2,6 @@
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 # RUN: echo "{ local: *; };" > %t.list
-# RUN: not ld.lld -dynamic-list %t.list -shared %t.o -o %t.so 2>&1 | FileCheck %s
+# RUN: not ld.lld -dynamic-list %t.list -shared %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}:1: "local:" scope not supported in --dynamic-list

diff  --git a/lld/test/ELF/dynamic-list-unexpected-end.s b/lld/test/ELF/dynamic-list-unexpected-end.s
index f485a662dbf9..7560890ce0d5 100644
--- a/lld/test/ELF/dynamic-list-unexpected-end.s
+++ b/lld/test/ELF/dynamic-list-unexpected-end.s
@@ -2,6 +2,6 @@
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 # RUN: echo "{ }; foo;" > %t.list
-# RUN: not ld.lld -dynamic-list %t.list -shared %t.o -o %t.so 2>&1 | FileCheck %s
+# RUN: not ld.lld -dynamic-list %t.list -shared %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}:1: EOF expected, but got foo

diff  --git a/lld/test/ELF/eh-frame-value-format9.s b/lld/test/ELF/eh-frame-value-format9.s
index 1b9ce6944eea..11c4789bc3e1 100644
--- a/lld/test/ELF/eh-frame-value-format9.s
+++ b/lld/test/ELF/eh-frame-value-format9.s
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-# RUN: not ld.lld --eh-frame-hdr %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld --eh-frame-hdr %t.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: error: unknown FDE size encoding
 
 .section .eh_frame, "ax"

diff  --git a/lld/test/ELF/execute-only-mixed-data.s b/lld/test/ELF/execute-only-mixed-data.s
index b57695493dd6..32248bdf2815 100644
--- a/lld/test/ELF/execute-only-mixed-data.s
+++ b/lld/test/ELF/execute-only-mixed-data.s
@@ -7,7 +7,7 @@
 // RUN:  .text : { *(.text) *(.rodata.foo) } \
 // RUN:  .rodata : { *(.rodata.bar) } \
 // RUN: }" > %t.lds
-// RUN: not ld.lld -T%t.lds %t.o -o %t -execute-only 2>&1 | FileCheck %s
+// RUN: not ld.lld -T%t.lds %t.o -o /dev/null -execute-only 2>&1 | FileCheck %s
 
 // RUN: echo "SECTIONS \
 // RUN: { \

diff  --git a/lld/test/ELF/gc-sections-no-undef-error.s b/lld/test/ELF/gc-sections-no-undef-error.s
index 31945241a77a..d142998b7f50 100644
--- a/lld/test/ELF/gc-sections-no-undef-error.s
+++ b/lld/test/ELF/gc-sections-no-undef-error.s
@@ -4,7 +4,7 @@
 
 # Sanity check that the link will fail with the undefined error without
 # gc-sections.
-# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: error: undefined symbol: undefined
 
 # RUN: ld.lld %t.o --gc-sections -o %t

diff  --git a/lld/test/ELF/gdb-index-invalid-ranges.s b/lld/test/ELF/gdb-index-invalid-ranges.s
index 1aac98d87cf6..f14617131492 100644
--- a/lld/test/ELF/gdb-index-invalid-ranges.s
+++ b/lld/test/ELF/gdb-index-invalid-ranges.s
@@ -1,9 +1,9 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: not ld.lld --gdb-index -e main %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld --gdb-index -e main %t.o -o /dev/null 2>&1 | FileCheck %s
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gdb-index-invalid-ranges.obj.s -o %t2.o
 # RUN: llvm-ar rc %t.a %t.o
-# RUN: not ld.lld --gdb-index -e main %t2.o %t.a -o %t 2>&1 | FileCheck --check-prefix=ARCHIVE %s
+# RUN: not ld.lld --gdb-index -e main %t2.o %t.a -o /dev/null 2>&1 | FileCheck --check-prefix=ARCHIVE %s
 
 # CHECK: ld.lld: error: {{.*}}gdb-index-invalid-ranges.s.tmp.o:(.debug_info): decoding address ranges: invalid range list entry at offset 0x10
 # ARCHIVE: ld.lld: error: {{.*}}gdb-index-invalid-ranges.s.tmp.a(gdb-index-invalid-ranges.s.tmp.o):(.debug_info): decoding address ranges: invalid range list entry at offset 0x10

diff  --git a/lld/test/ELF/gdb-index-parse-fail.s b/lld/test/ELF/gdb-index-parse-fail.s
index 8b06a8d9228e..22ac5cc8a839 100644
--- a/lld/test/ELF/gdb-index-parse-fail.s
+++ b/lld/test/ELF/gdb-index-parse-fail.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
-# RUN: not ld.lld --gdb-index %t1.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld --gdb-index %t1.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}:(.debug_info): invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix
 

diff  --git a/lld/test/ELF/global-offset-table-position-redef-err.s b/lld/test/ELF/global-offset-table-position-redef-err.s
index fb2e506c1af6..65d58c580e24 100644
--- a/lld/test/ELF/global-offset-table-position-redef-err.s
+++ b/lld/test/ELF/global-offset-table-position-redef-err.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-# RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
+# RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # On some targets the location of the _GLOBAL_OFFSET_TABLE_ symbol table can
 # matter for the correctness of some relocations. Follow the example of ld.gold

diff  --git a/lld/test/ELF/got32-i386.s b/lld/test/ELF/got32-i386.s
index 7506d9ac5918..6c0b87aff399 100644
--- a/lld/test/ELF/got32-i386.s
+++ b/lld/test/ELF/got32-i386.s
@@ -19,5 +19,5 @@ _start:
 # CHECK:       _start:
 # CHECK-NEXT:   4010f5: 8b 1d {{.*}}  movl 4202748, %ebx
 
-# RUN: not ld.lld %t.o -o %t -pie 2>&1 | FileCheck %s --check-prefix=ERR
+# RUN: not ld.lld %t.o -o /dev/null -pie 2>&1 | FileCheck %s --check-prefix=ERR
 # ERR: error: symbol 'foo' cannot be preempted; recompile with -fPIE

diff  --git a/lld/test/ELF/got32x-i386.s b/lld/test/ELF/got32x-i386.s
index a3b75101c593..8c8e24fd2e41 100644
--- a/lld/test/ELF/got32x-i386.s
+++ b/lld/test/ELF/got32x-i386.s
@@ -41,6 +41,6 @@
 # CHECK-NEXT:   401121: 8b 80 {{.*}} movl -4100(%eax), %eax
 # CHECK-NEXT:   401127: 8b 83 {{.*}} movl -4100(%ebx), %eax
 
-# RUN: not ld.lld %S/Inputs/i386-got32x-baseless.elf -o %t1 -pie 2>&1 | \
+# RUN: not ld.lld %S/Inputs/i386-got32x-baseless.elf -o /dev/null -pie 2>&1 | \
 # RUN:   FileCheck %s --check-prefix=ERR
 # ERR-COUNT-2: error: symbol 'foo' cannot be preempted; recompile with -fPIE

diff  --git a/lld/test/ELF/hexagon-jump-error.s b/lld/test/ELF/hexagon-jump-error.s
index edbf8a8f0f12..ad8ddbf8ede5 100644
--- a/lld/test/ELF/hexagon-jump-error.s
+++ b/lld/test/ELF/hexagon-jump-error.s
@@ -1,6 +1,6 @@
 # REQUIRES: hexagon
 # RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
-# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck --implicit-check-not "out of range" %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck --implicit-check-not "out of range" %s
 
 	.globl	_start
 	.type	_start, @function

diff  --git a/lld/test/ELF/hidden-shared-err.s b/lld/test/ELF/hidden-shared-err.s
index cbdec478d4da..a19c0a0d6e57 100644
--- a/lld/test/ELF/hidden-shared-err.s
+++ b/lld/test/ELF/hidden-shared-err.s
@@ -5,11 +5,11 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/hidden-shared-err2.s -o %t3.o
 
 # RUN: ld.lld -shared -o %t2.so %t2.o
-# RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
-# RUN: not ld.lld %t2.so %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o %t2.so -o /dev/null 2>&1 | FileCheck %s
+# RUN: not ld.lld %t2.so %t.o -o /dev/null 2>&1 | FileCheck %s
 
-# RUN: not ld.lld %t.o %t3.o %t2.so -o %t 2>&1 | FileCheck %s
-# RUN: not ld.lld %t3.o %t.o %t2.so -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o %t3.o %t2.so -o /dev/null 2>&1 | FileCheck %s
+# RUN: not ld.lld %t3.o %t.o %t2.so -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: undefined hidden symbol: foo
 

diff  --git a/lld/test/ELF/i386-pic-plt.s b/lld/test/ELF/i386-pic-plt.s
index 0d32436899a5..87638b9b3df6 100644
--- a/lld/test/ELF/i386-pic-plt.s
+++ b/lld/test/ELF/i386-pic-plt.s
@@ -3,7 +3,7 @@
 // RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %p/Inputs/i386-pic-plt.s -o %t2.o
 // RUN: ld.lld -shared %t2.o -o %t2.so
 // RUN: ld.lld %t.o %t2.so -o %t
-// RUN: not ld.lld %t.o %t2.so -o %t -pie 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o %t2.so -o /dev/null -pie 2>&1 | FileCheck %s
 
 // CHECK: error: symbol 'foo' cannot be preempted; recompile with -fPIE
 

diff  --git a/lld/test/ELF/image-base.s b/lld/test/ELF/image-base.s
index f19f900e79b8..8396eaf1082a 100644
--- a/lld/test/ELF/image-base.s
+++ b/lld/test/ELF/image-base.s
@@ -3,7 +3,7 @@
 # RUN: ld.lld -image-base=0x1000000 %t -o %t1
 # RUN: llvm-readobj -l %t1 | FileCheck %s
 
-# RUN: not ld.lld -image-base=ABC %t -o %t1 2>&1 | FileCheck --check-prefix=ERR %s
+# RUN: not ld.lld -image-base=ABC %t -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
 # ERR: error: -image-base: number expected, but got ABC
 
 # RUN: ld.lld -image-base=0x1000 -z max-page-size=0x2000 %t -o %t1 2>&1 | FileCheck --check-prefix=WARN %s

diff  --git a/lld/test/ELF/incompatible.s b/lld/test/ELF/incompatible.s
index 283146a7ee4f..b7e784a0657c 100644
--- a/lld/test/ELF/incompatible.s
+++ b/lld/test/ELF/incompatible.s
@@ -4,43 +4,43 @@
 // RUN: ld.lld -shared %tb.o -o %ti686.so
 // RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %tc.o
 
-// RUN: not ld.lld %ta.o %tb.o -o %t 2>&1 | \
+// RUN: not ld.lld %ta.o %tb.o -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=A-AND-B %s
 // A-AND-B: b.o is incompatible with {{.*}}a.o
 
-// RUN: not ld.lld %tb.o %tc.o -o %t 2>&1 | \
+// RUN: not ld.lld %tb.o %tc.o -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=B-AND-C %s
 // B-AND-C: c.o is incompatible with {{.*}}b.o
 
-// RUN: not ld.lld %ta.o %ti686.so -o %t 2>&1 | \
+// RUN: not ld.lld %ta.o %ti686.so -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=A-AND-SO %s
 // A-AND-SO: i686.so is incompatible with {{.*}}a.o
 
-// RUN: not ld.lld %tc.o %ti686.so -o %t 2>&1 | \
+// RUN: not ld.lld %tc.o %ti686.so -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=C-AND-SO %s
 // C-AND-SO: i686.so is incompatible with {{.*}}c.o
 
-// RUN: not ld.lld %ti686.so %tc.o -o %t 2>&1 | \
+// RUN: not ld.lld %ti686.so %tc.o -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=SO-AND-C %s
 // SO-AND-C: c.o is incompatible with {{.*}}i686.so
 
-// RUN: not ld.lld -m elf64ppc %ta.o -o %t 2>&1 | \
+// RUN: not ld.lld -m elf64ppc %ta.o -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=A-ONLY %s
 // A-ONLY: a.o is incompatible with elf64ppc
 
-// RUN: not ld.lld -m elf64ppc %tb.o -o %t 2>&1 | \
+// RUN: not ld.lld -m elf64ppc %tb.o -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=B-ONLY %s
 // B-ONLY: b.o is incompatible with elf64ppc
 
-// RUN: not ld.lld -m elf64ppc %tc.o -o %t 2>&1 | \
+// RUN: not ld.lld -m elf64ppc %tc.o -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=C-ONLY %s
 // C-ONLY: c.o is incompatible with elf64ppc
 
-// RUN: not ld.lld -m elf_i386 %tc.o %ti686.so -o %t 2>&1 | \
+// RUN: not ld.lld -m elf_i386 %tc.o %ti686.so -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=C-AND-SO-I386 %s
 // C-AND-SO-I386: c.o is incompatible with elf_i386
 
-// RUN: not ld.lld -m elf_i386 %ti686.so %tc.o -o %t 2>&1 | \
+// RUN: not ld.lld -m elf_i386 %ti686.so %tc.o -o /dev/null 2>&1 | \
 // RUN:   FileCheck --check-prefix=SO-AND-C-I386 %s
 // SO-AND-C-I386: c.o is incompatible with elf_i386
 
@@ -51,7 +51,7 @@
 // RUN: rm -f %t.a
 // RUN: llvm-ar rc %t.a %ta.o
 // RUN: llvm-mc -filetype=obj -triple=i686-linux %s -o %tb.o
-// RUN: not ld.lld %t.a %tb.o 2>&1 -o %t | FileCheck --check-prefix=ARCHIVE %s
+// RUN: not ld.lld %t.a %tb.o 2>&1 -o /dev/null | FileCheck --check-prefix=ARCHIVE %s
 // ARCHIVE: .a({{.*}}a.o) is incompatible with {{.*}}b.o
 .global _start
 _start:

diff  --git a/lld/test/ELF/invalid-local-symbol-in-dso.s b/lld/test/ELF/invalid-local-symbol-in-dso.s
index dc6bff7bd792..42784608c29d 100644
--- a/lld/test/ELF/invalid-local-symbol-in-dso.s
+++ b/lld/test/ELF/invalid-local-symbol-in-dso.s
@@ -6,7 +6,7 @@
 # WARN: found local symbol 'foo' in global part of symbol table in file {{.*}}local-symbol-in-dso.so
 
 # RUN: llvm-mc %s -o %t.o -filetype=obj -triple x86_64-pc-linux
-# RUN: not ld.lld %t.o %p/Inputs/local-symbol-in-dso.so -o %t
+# RUN: not ld.lld %t.o %p/Inputs/local-symbol-in-dso.so -o /dev/null
 
 .globl main
 main:

diff  --git a/lld/test/ELF/invalid/bad-reloc-target.test b/lld/test/ELF/invalid/bad-reloc-target.test
index 7fafe5e70773..a8a752589929 100644
--- a/lld/test/ELF/invalid/bad-reloc-target.test
+++ b/lld/test/ELF/invalid/bad-reloc-target.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj --docnum=1 %s -o %t1.o
-# RUN: not ld.lld %t1.o -o %t1 2>&1 | FileCheck %s
+# RUN: not ld.lld %t1.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: error: {{.*}}.o: unsupported relocation reference
 
 --- !ELF
@@ -25,7 +25,7 @@ Symbols:
     Binding:     STB_GLOBAL
 
 # RUN: yaml2obj --docnum=2 %s -o %t2.o
-# RUN: not ld.lld %t2.o -o %t2 2>&1 | FileCheck %s --check-prefix=ERR2
+# RUN: not ld.lld %t2.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2
 # ERR2: error: {{.*}}.o: invalid relocated section index: 99
 
 --- !ELF
@@ -53,7 +53,7 @@ Symbols:
 ## Relocation refers to a symbol with index larger than
 ## symbol table size. Check we report it.
 # RUN: yaml2obj --docnum=3 %s -o %t2.o
-# RUN: not ld.lld %t2.o -o %t2 2>&1 | FileCheck %s --check-prefix=ERR3
+# RUN: not ld.lld %t2.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR3
 # ERR3: error: {{.*}}.o: invalid symbol index
 
 --- !ELF

diff  --git a/lld/test/ELF/invalid/broken-relaxation-x64.test b/lld/test/ELF/invalid/broken-relaxation-x64.test
index 7ff9bb2838cf..1bd7fe0cc36d 100644
--- a/lld/test/ELF/invalid/broken-relaxation-x64.test
+++ b/lld/test/ELF/invalid/broken-relaxation-x64.test
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 
 # RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld %t.o -o %t.exe 2>&1 | FileCheck --check-prefix=ERR %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
 # ERR: R_X86_64_GOTTPOFF must be used in MOVQ or ADDQ instructions only
 # ERR: R_X86_64_GOTTPOFF must be used in MOVQ or ADDQ instructions only
 

diff  --git a/lld/test/ELF/invalid/comdat-broken.test b/lld/test/ELF/invalid/comdat-broken.test
index 3bae4d5b326b..02941070dc0d 100644
--- a/lld/test/ELF/invalid/comdat-broken.test
+++ b/lld/test/ELF/invalid/comdat-broken.test
@@ -1,8 +1,8 @@
 # REQUIRES: x86
 
 # RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld %t.o -o %t.exe 2>&1 | FileCheck %s
-# RUN: not ld.lld %t.o %t.o -o %t.exe 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}.o: unsupported SHT_GROUP format
 

diff  --git a/lld/test/ELF/invalid/common-symbol-alignment.test b/lld/test/ELF/invalid/common-symbol-alignment.test
index cb8a35a956c2..2e6d1f10242e 100644
--- a/lld/test/ELF/invalid/common-symbol-alignment.test
+++ b/lld/test/ELF/invalid/common-symbol-alignment.test
@@ -1,7 +1,7 @@
 ## If an object contains a common symbol with zero alignment,
 ## check we report it.
 # RUN: yaml2obj --docnum=1 %s -o %t1.o
-# RUN: not ld.lld %t1.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t1.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: common symbol 'bar' has invalid alignment: 0
 
 --- !ELF
@@ -19,7 +19,7 @@ Symbols:
 ## If an object contains a common symbol with alignment greater
 ## than UINT32_MAX, check we report it.
 # RUN: yaml2obj --docnum=2 %s -o %t2.o
-# RUN: not ld.lld %t2.o -o %t 2>&1 | FileCheck %s --check-prefix=BIG
+# RUN: not ld.lld %t2.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=BIG
 # BIG: common symbol 'bar' has invalid alignment: 271644049215
 
 --- !ELF

diff  --git a/lld/test/ELF/invalid/invalid-debug-relocations.test b/lld/test/ELF/invalid/invalid-debug-relocations.test
index 71e4135e6086..640cabbed65a 100644
--- a/lld/test/ELF/invalid/invalid-debug-relocations.test
+++ b/lld/test/ELF/invalid/invalid-debug-relocations.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld -gdb-index %t.o -o %t.exe 2>&1 | FileCheck %s
+# RUN: not ld.lld -gdb-index %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}invalid-debug-relocations.test.tmp.o:(.debug_info+0x0): unknown relocation (255) against symbol _start
 

diff  --git a/lld/test/ELF/invalid/invalid-elf.test b/lld/test/ELF/invalid/invalid-elf.test
index bcbdc3683bec..848a430eb053 100644
--- a/lld/test/ELF/invalid/invalid-elf.test
+++ b/lld/test/ELF/invalid/invalid-elf.test
@@ -1,5 +1,5 @@
 # RUN: rm -rf %t && mkdir -p %t
 # RUN: echo > %t/empty.o
 # RUN: llvm-ar --format=gnu cr %t/not-elf.a %t/empty.o
-# RUN: not ld.lld --whole-archive %t/not-elf.a -o %t2 2>&1 | FileCheck %s
+# RUN: not ld.lld --whole-archive %t/not-elf.a -o /dev/null 2>&1 | FileCheck %s
 # CHECK: not-elf.a(empty.o): not an ELF file

diff  --git a/lld/test/ELF/invalid/invalid-file-class.test b/lld/test/ELF/invalid/invalid-file-class.test
index a271d3717ce4..1b40d69181b0 100644
--- a/lld/test/ELF/invalid/invalid-file-class.test
+++ b/lld/test/ELF/invalid/invalid-file-class.test
@@ -12,8 +12,8 @@
 # RUN: echo -e -n "\x7f\x45\x4c\x46\x00\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00" > %t/invalid.o
 
 # RUN: llvm-ar --format=gnu cr %t/invalid-class.a %t/invalid.o
-# RUN: not ld.lld -whole-archive %t/invalid-class.a -o %t2 2>&1 | FileCheck %s
+# RUN: not ld.lld -whole-archive %t/invalid-class.a -o /dev/null 2>&1 | FileCheck %s
 # CHECK: invalid-class.a(invalid.o): corrupted ELF file: invalid file class
 
-# RUN: not ld.lld %t/invalid.o -o %t2 2>&1 | FileCheck %s --check-prefix=OBJ
+# RUN: not ld.lld %t/invalid.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=OBJ
 # OBJ: invalid.o: corrupted ELF file: invalid file class

diff  --git a/lld/test/ELF/invalid/invalid-soname.test b/lld/test/ELF/invalid/invalid-soname.test
index bf4b33c87d06..fdf61e66b008 100644
--- a/lld/test/ELF/invalid/invalid-soname.test
+++ b/lld/test/ELF/invalid/invalid-soname.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: yaml2obj %s -o %t.so
-# RUN: not ld.lld %t.so -o %t.exe 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.so -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}.so: invalid DT_SONAME entry
 

diff  --git a/lld/test/ELF/invalid/linkorder-invalid-sec.test b/lld/test/ELF/invalid/linkorder-invalid-sec.test
index d4aa376639c3..a2f4ee8f5bc2 100644
--- a/lld/test/ELF/invalid/linkorder-invalid-sec.test
+++ b/lld/test/ELF/invalid/linkorder-invalid-sec.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld %t.o -o %t.exe 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: invalid sh_link index: 12345
 
 --- !ELF

diff  --git a/lld/test/ELF/invalid/mips-invalid-options-descriptor.test b/lld/test/ELF/invalid/mips-invalid-options-descriptor.test
index ce797c978cd4..2e37729f3455 100644
--- a/lld/test/ELF/invalid/mips-invalid-options-descriptor.test
+++ b/lld/test/ELF/invalid/mips-invalid-options-descriptor.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t1.o
-# RUN: not ld.lld %t1.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t1.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: error: {{.*}}1.o: zero option descriptor size
 
 ## YAML has a description of ODK_NULL (Undefined) MIPS option,

diff  --git a/lld/test/ELF/invalid/multiple-relocations-sections.test b/lld/test/ELF/invalid/multiple-relocations-sections.test
index deb0a4de984f..3f8f66307375 100644
--- a/lld/test/ELF/invalid/multiple-relocations-sections.test
+++ b/lld/test/ELF/invalid/multiple-relocations-sections.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t1.o
-# RUN: not ld.lld %t1.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t1.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: error: {{.*}}1.o: multiple relocation sections to one section are not supported
 
 ## The file has two relocation sections referring to a single target section.

diff  --git a/lld/test/ELF/invalid/non-terminated-string.test b/lld/test/ELF/invalid/non-terminated-string.test
index 82e94fe1457c..beb8e955469d 100644
--- a/lld/test/ELF/invalid/non-terminated-string.test
+++ b/lld/test/ELF/invalid/non-terminated-string.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not ld.lld %t -o %tout 2>&1 | FileCheck %s
+# RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: {{.*}}:(.merge): string is not null terminated
 

diff  --git a/lld/test/ELF/invalid/reloc-section-reordered.test b/lld/test/ELF/invalid/reloc-section-reordered.test
index 286d6612b768..6bc11ae2c7c1 100644
--- a/lld/test/ELF/invalid/reloc-section-reordered.test
+++ b/lld/test/ELF/invalid/reloc-section-reordered.test
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 
 # RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld %t.o -o %t.exe 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: unsupported relocation reference
 
 ## YAML below lists .rela.text before .text, we do not support it.

diff  --git a/lld/test/ELF/invalid/section-alignment.test b/lld/test/ELF/invalid/section-alignment.test
index 48da12243ac8..f5505a8d29bb 100644
--- a/lld/test/ELF/invalid/section-alignment.test
+++ b/lld/test/ELF/invalid/section-alignment.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not ld.lld %t -o %tout 2>&1 | FileCheck %s
+# RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
 
 ## In current lld implementation, we do not accept sh_addralign
 ## larger than UINT32_MAX.

diff  --git a/lld/test/ELF/invalid/section-alignment2.s b/lld/test/ELF/invalid/section-alignment2.s
index df997d2f5f7e..c130bbbaa071 100644
--- a/lld/test/ELF/invalid/section-alignment2.s
+++ b/lld/test/ELF/invalid/section-alignment2.s
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld %t.o -o %tout 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}.o:(.text): sh_addralign is not a power of 2
 

diff  --git a/lld/test/ELF/invalid/section-index.test b/lld/test/ELF/invalid/section-index.test
index 80d89ef39ab9..cc8c6d067265 100644
--- a/lld/test/ELF/invalid/section-index.test
+++ b/lld/test/ELF/invalid/section-index.test
@@ -2,7 +2,7 @@
 ## check we report it.
 
 # RUN: yaml2obj %s -o %t1.o
-# RUN: not ld.lld %t1.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t1.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: {{.*}}1.o: invalid section index: 256
 
 !ELF

diff  --git a/lld/test/ELF/invalid/sht-group-wrong-section.test b/lld/test/ELF/invalid/sht-group-wrong-section.test
index dba266a1ff07..46209a213902 100644
--- a/lld/test/ELF/invalid/sht-group-wrong-section.test
+++ b/lld/test/ELF/invalid/sht-group-wrong-section.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld %t.o %t.o -o %t.exe 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: error: {{.*}}.o: invalid section index in group: 12345
 
 --- !ELF

diff  --git a/lld/test/ELF/invalid/sht-group.test b/lld/test/ELF/invalid/sht-group.test
index ac155fa08ba6..9041bb61b3e9 100644
--- a/lld/test/ELF/invalid/sht-group.test
+++ b/lld/test/ELF/invalid/sht-group.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld %t.o -o %t.exe 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: invalid symbol index
 
 --- !ELF

diff  --git a/lld/test/ELF/invalid/symbol-name.test b/lld/test/ELF/invalid/symbol-name.test
index 0a1cb7e4b90f..1ae76f0bd81e 100644
--- a/lld/test/ELF/invalid/symbol-name.test
+++ b/lld/test/ELF/invalid/symbol-name.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t.o
-# RUN: not ld.lld %t.o -o %t.exe 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: error: {{.*}}.o: invalid symbol name offset
 
 ## YAML below contains symbol with name offset in st_name

diff  --git a/lld/test/ELF/invalid/symtab-sh-info.s b/lld/test/ELF/invalid/symtab-sh-info.s
index 9b9cd4e9964b..ed5d2b472bd7 100644
--- a/lld/test/ELF/invalid/symtab-sh-info.s
+++ b/lld/test/ELF/invalid/symtab-sh-info.s
@@ -2,7 +2,7 @@
 ## zero entry that must exist in a valid object, so sh_info can't be null.
 ## Check we report a proper error for that case.
 # RUN: yaml2obj --docnum=1 %s -o %t.o
-# RUN: not ld.lld %t.o -o %t2 2>&1 | FileCheck %s --check-prefix=ERR1
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR1
 # ERR1: invalid sh_info in symbol table
 
 --- !ELF
@@ -22,7 +22,7 @@ Symbols:
 ## sh_info has value 2 what says that non-local symbol `foo` is local.
 ## Check we report this case.
 # RUN: yaml2obj --docnum=2 %s -o %t.o
-# RUN: not ld.lld %t.o -o %t2 2>&1 | FileCheck --check-prefix=ERR2 %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR2 %s
 # ERR2: broken object: getLocalSymbols returns a non-local symbol
 
 --- !ELF
@@ -42,7 +42,7 @@ Symbols:
 ## sh_info has value 0xff what is larger than number of symbols in a .symtab.
 ## Check we report this case.
 # RUN: yaml2obj --docnum=3 %s -o %t.o
-# RUN: not ld.lld %t.o -o %t2 2>&1 | FileCheck --check-prefix=ERR1 %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR1 %s
 
 --- !ELF
 FileHeader:

diff  --git a/lld/test/ELF/invalid/verdef-no-symtab.test b/lld/test/ELF/invalid/verdef-no-symtab.test
index 536515dbab66..d32d6de7a6e5 100644
--- a/lld/test/ELF/invalid/verdef-no-symtab.test
+++ b/lld/test/ELF/invalid/verdef-no-symtab.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not ld.lld %t -o %tout 2>&1 | FileCheck %s
+# RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
 
 ## When we have SHT_GNU_versym section, it is should be associated
 ## with symbol table section.

diff  --git a/lld/test/ELF/libsearch.s b/lld/test/ELF/libsearch.s
index 246a5d13951e..417953491b67 100644
--- a/lld/test/ELF/libsearch.s
+++ b/lld/test/ELF/libsearch.s
@@ -20,13 +20,13 @@
 // Should link normally, because _bar is not used
 // RUN: ld.lld -o %t3 %t.o
 // Should not link because of undefined symbol _bar
-// RUN: not ld.lld -o %t3 %t.o %tbar.o 2>&1 \
+// RUN: not ld.lld -o /dev/null %t.o %tbar.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=UNDEFINED %s
 // UNDEFINED: error: undefined symbol: _bar
 // UNDEFINED: >>> referenced by {{.*}}:(.bar+0x0)
 
 // Should fail if cannot find specified library (without -L switch)
-// RUN: not ld.lld -o %t3 %t.o -lls 2>&1 \
+// RUN: not ld.lld -o /dev/null %t.o -lls 2>&1 \
 // RUN:   | FileCheck --check-prefix=NOLIB %s
 // NOLIB: unable to find library -lls
 
@@ -65,7 +65,7 @@
 // Should not search for dynamic libraries if -Bstatic is specified
 // RUN: ld.lld -o %t3 %t.o -L%t.dir -Bstatic -lls
 // RUN: llvm-readobj --symbols %t3 | FileCheck --check-prefix=STATIC %s
-// RUN: not ld.lld -o %t3 %t.o -L%t.dir -Bstatic -lls2 2>&1 \
+// RUN: not ld.lld -o /dev/null %t.o -L%t.dir -Bstatic -lls2 2>&1 \
 // RUN:   | FileCheck --check-prefix=NOLIB2 %s
 // NOLIB2: unable to find library -lls2
 
@@ -94,7 +94,7 @@
 // -nostdlib
 // RUN: echo 'SEARCH_DIR("'%t.dir'")' > %t.script
 // RUN: ld.lld -o %t3 %t.o -script %t.script -lls
-// RUN: not ld.lld -o %t3 %t.o -script %t.script -lls -nostdlib \
+// RUN: not ld.lld -o /dev/null %t.o -script %t.script -lls -nostdlib \
 // RUN:   2>&1 | FileCheck --check-prefix=NOSTDLIB %s
 // NOSTDLIB: unable to find library -lls
 

diff  --git a/lld/test/ELF/linkerscript/address-expr-symbols.s b/lld/test/ELF/linkerscript/address-expr-symbols.s
index 0b76c91a5c8b..40ad1bb32836 100644
--- a/lld/test/ELF/linkerscript/address-expr-symbols.s
+++ b/lld/test/ELF/linkerscript/address-expr-symbols.s
@@ -2,14 +2,14 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 
 # RUN: echo "SECTIONS { .bar (foo) : { } };" > %t.script
-# RUN: not ld.lld -o %t --script %t.script %t.o 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck %s
 # CHECK: symbol not found: foo
 
 # RUN: echo "SECTIONS { .bar : AT(foo) { } };" > %t.script
-# RUN: not ld.lld -o %t --script %t.script %t.o 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck %s
 
 # RUN: echo "SECTIONS { .bar : ALIGN(foo) { } };" > %t.script
-# RUN: not ld.lld -o %t --script %t.script %t.o 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck %s
 
 # RUN: echo "SECTIONS { .bar : SUBALIGN(foo) { } };" > %t.script
-# RUN: not ld.lld -o %t --script %t.script %t.o 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck %s

diff  --git a/lld/test/ELF/linkerscript/align1.test b/lld/test/ELF/linkerscript/align1.test
index 70d1141022ab..bc3a89cbbcca 100644
--- a/lld/test/ELF/linkerscript/align1.test
+++ b/lld/test/ELF/linkerscript/align1.test
@@ -36,9 +36,9 @@ SECTIONS {
 
 ## Test we fail gracefuly when alignment value is not a power of 2 (#1).
 # RUN: echo "SECTIONS { . = 0x123; . = ALIGN(0x123, 3); .aaa : { *(.aaa) } }" > %t.script
-# RUN: not ld.lld -o %t6 --script %t.script %t.o 2>&1 | FileCheck -check-prefix=ERR %s
+# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck -check-prefix=ERR %s
 
 # RUN: echo "SECTIONS { . = 0x123; . = ALIGN(3); .aaa : { *(.aaa) } }" > %t.script
-# RUN: not ld.lld -o %t7 --script %t.script %t.o 2>&1 | FileCheck -check-prefix=ERR %s
+# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck -check-prefix=ERR %s
 
 # ERR: {{.*}}.script:1: alignment must be power of 2

diff  --git a/lld/test/ELF/linkerscript/alignof.test b/lld/test/ELF/linkerscript/alignof.test
index 0e3abf6133c9..07263df44a02 100644
--- a/lld/test/ELF/linkerscript/alignof.test
+++ b/lld/test/ELF/linkerscript/alignof.test
@@ -19,6 +19,6 @@ SECTIONS {
 ## Check that we error out if trying to get alignment of
 ## section that does not exist.
 # RUN: echo "SECTIONS { _aaa = ALIGNOF(.foo); }" > %t.script
-# RUN: not ld.lld -o %t1 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR %s
 # ERR: {{.*}}.script:1: undefined section .foo

diff  --git a/lld/test/ELF/linkerscript/at5.test b/lld/test/ELF/linkerscript/at5.test
index 8e1ed93bcad9..6b61006a5a52 100644
--- a/lld/test/ELF/linkerscript/at5.test
+++ b/lld/test/ELF/linkerscript/at5.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
-# RUN: not ld.lld -o %t.exe %t.o --script %s 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null %t.o --script %s 2>&1 | FileCheck %s
 
 MEMORY {
   FLASH (ax) : ORIGIN = 0x2000, LENGTH = 0x100

diff  --git a/lld/test/ELF/linkerscript/broken-memory-declaration.s b/lld/test/ELF/linkerscript/broken-memory-declaration.s
index 197c9cd22b6d..cb4b50a44b1b 100644
--- a/lld/test/ELF/linkerscript/broken-memory-declaration.s
+++ b/lld/test/ELF/linkerscript/broken-memory-declaration.s
@@ -3,11 +3,11 @@
 ## Check we do not crash.
 
 # RUN: echo "MEMORY { FLASH (rx) : ORIGIN = 0x1000< LENGTH" > %t.script
-# RUN: not ld.lld -o %t --script %t.script 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null --script %t.script 2>&1 | FileCheck %s
 # CHECK: unexpected EOF
 
 # RUN: echo "MEMORY { FLASH (rx) : ORIGIN = 0x1000< ORIGIN" > %t.script
-# RUN: not ld.lld -o %t --script %t.script 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null --script %t.script 2>&1 | FileCheck %s
 
 # RUN: echo "MEMORY { FLASH (rx) : ORIGIN = 0x1000, LENGTH = CONSTANT" > %t.script
-# RUN: not ld.lld -o %t --script %t.script 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null --script %t.script 2>&1 | FileCheck %s

diff  --git a/lld/test/ELF/linkerscript/diag1.test b/lld/test/ELF/linkerscript/diag1.test
index 73a627ff4ef5..829bc5a1bffa 100644
--- a/lld/test/ELF/linkerscript/diag1.test
+++ b/lld/test/ELF/linkerscript/diag1.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
-# RUN: not ld.lld -shared %t.o -o %t --script %s 2>&1 | FileCheck -strict-whitespace %s
+# RUN: not ld.lld -shared %t.o -o /dev/null --script %s 2>&1 | FileCheck -strict-whitespace %s
 
 SECTIONS {
   .text + { *(.text) }

diff  --git a/lld/test/ELF/linkerscript/diag2.test b/lld/test/ELF/linkerscript/diag2.test
index 05cd4c3a752a..aeb623dbb7f4 100644
--- a/lld/test/ELF/linkerscript/diag2.test
+++ b/lld/test/ELF/linkerscript/diag2.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
-# RUN: not ld.lld -shared %t.o -o %t --script %s 2>&1 | FileCheck -strict-whitespace %s
+# RUN: not ld.lld -shared %t.o -o /dev/null --script %s 2>&1 | FileCheck -strict-whitespace %s
 
 UNKNOWN_TAG {
   .text : { *(.text) }

diff  --git a/lld/test/ELF/linkerscript/diag3.test b/lld/test/ELF/linkerscript/diag3.test
index 8ffc9d4d864c..8a0d552b1a89 100644
--- a/lld/test/ELF/linkerscript/diag3.test
+++ b/lld/test/ELF/linkerscript/diag3.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
-# RUN: not ld.lld -shared %t.o -o %t --script %s 2>&1 | FileCheck -strict-whitespace %s
+# RUN: not ld.lld -shared %t.o -o /dev/null --script %s 2>&1 | FileCheck -strict-whitespace %s
 
 SECTIONS {
   .text : { *(.text) }

diff  --git a/lld/test/ELF/linkerscript/diag4.test b/lld/test/ELF/linkerscript/diag4.test
index 484bdf26fe72..b04b6c6bd8ff 100644
--- a/lld/test/ELF/linkerscript/diag4.test
+++ b/lld/test/ELF/linkerscript/diag4.test
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
 # RUN: echo "INCLUDE \"%s\"" > %t.script
-# RUN: not ld.lld -shared %t.o -o %t --script %t.script 2>&1 | FileCheck -strict-whitespace %s
+# RUN: not ld.lld -shared %t.o -o /dev/null --script %t.script 2>&1 | FileCheck -strict-whitespace %s
 
 SECTIONS {
   .text : { *(.text) }

diff  --git a/lld/test/ELF/linkerscript/diag5.test b/lld/test/ELF/linkerscript/diag5.test
index 38a774e747ab..ebeee087d65e 100644
--- a/lld/test/ELF/linkerscript/diag5.test
+++ b/lld/test/ELF/linkerscript/diag5.test
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
 # RUN: echo "INCLUDE \"%s\"" > %t.script
-# RUN: not ld.lld -shared %t.o -o %t --script %t.script 2>&1 | FileCheck -strict-whitespace %s
+# RUN: not ld.lld -shared %t.o -o /dev/null --script %t.script 2>&1 | FileCheck -strict-whitespace %s
 
 SECTIONS {
   .text : { *(.text) }

diff  --git a/lld/test/ELF/linkerscript/diag6.test b/lld/test/ELF/linkerscript/diag6.test
index e4ad4d96d1dd..276fd1e3cc73 100644
--- a/lld/test/ELF/linkerscript/diag6.test
+++ b/lld/test/ELF/linkerscript/diag6.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
-# RUN: not ld.lld -shared %t.o -o %t --script %s 2>&1 | FileCheck %s
+# RUN: not ld.lld -shared %t.o -o /dev/null --script %s 2>&1 | FileCheck %s
 
 SECTIONS /*
 

diff  --git a/lld/test/ELF/linkerscript/discard-section-err.s b/lld/test/ELF/linkerscript/discard-section-err.s
index dd3c666e115b..155d34f884ea 100644
--- a/lld/test/ELF/linkerscript/discard-section-err.s
+++ b/lld/test/ELF/linkerscript/discard-section-err.s
@@ -3,7 +3,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 
 # RUN: echo "SECTIONS { /DISCARD/ : { *(.shstrtab) } }" > %t.script
-# RUN: not ld.lld -o %t --script %t.script %t.o 2>&1 | \
+# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | \
 # RUN:   FileCheck -check-prefix=SHSTRTAB %s
 # SHSTRTAB: discarding .shstrtab section is not allowed
 
@@ -27,7 +27,7 @@
 # RUN: llvm-readobj -S %t | FileCheck /dev/null --implicit-check-not='Name: .rela.dyn'
 
 # RUN: echo "SECTIONS { /DISCARD/ : { *(.relr.dyn) } }" > %t.script
-# RUN: not ld.lld -pie --pack-dyn-relocs=relr -o %t --script %t.script %t.o 2>&1 | \
+# RUN: not ld.lld -pie --pack-dyn-relocs=relr -o /dev/null --script %t.script %t.o 2>&1 | \
 # RUN:   FileCheck -check-prefix=RELRDYN %s
 # RELRDYN: discarding .relr.dyn section is not allowed
 

diff  --git a/lld/test/ELF/linkerscript/eh-frame-reloc-out-of-range.test b/lld/test/ELF/linkerscript/eh-frame-reloc-out-of-range.test
index 7f4df21fd4c4..9b8e6c8e4b65 100644
--- a/lld/test/ELF/linkerscript/eh-frame-reloc-out-of-range.test
+++ b/lld/test/ELF/linkerscript/eh-frame-reloc-out-of-range.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/eh-frame-reloc-out-of-range.s -o %t.o
-# RUN: not ld.lld %t.o -T %s -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -T %s -o /dev/null 2>&1 | FileCheck %s
 
 PHDRS { eh PT_LOAD; text PT_LOAD; }
 SECTIONS { . = 0x10000;

diff  --git a/lld/test/ELF/linkerscript/exclude-multiple.s b/lld/test/ELF/linkerscript/exclude-multiple.s
index 46ec18cfa125..e8e4348c947f 100644
--- a/lld/test/ELF/linkerscript/exclude-multiple.s
+++ b/lld/test/ELF/linkerscript/exclude-multiple.s
@@ -19,12 +19,12 @@
 # CHECK-NEXT:  06000000 00000000
 
 # RUN: echo "SECTIONS { .foo : { *(EXCLUDE_FILE (*file1.o) EXCLUDE_FILE (*file2.o) .foo.3) } }" > %t2.script
-# RUN: not ld.lld -script %t2.script %tfile1.o %tfile2.o %tfile3.o -o %t2.o 2>&1 | \
+# RUN: not ld.lld -script %t2.script %tfile1.o %tfile2.o %tfile3.o -o /dev/null 2>&1 | \
 # RUN:   FileCheck %s --check-prefix=ERR
 # ERR: section pattern is expected
 
 # RUN: echo "SECTIONS { .foo : { *(EXCLUDE_FILE (*file1.o)) } }" > %t3.script
-# RUN: not ld.lld -script %t3.script %tfile1.o %tfile2.o %tfile3.o -o %t2.o 2>&1 | \
+# RUN: not ld.lld -script %t3.script %tfile1.o %tfile2.o %tfile3.o -o /dev/null 2>&1 | \
 # RUN:   FileCheck %s --check-prefix=ERR
 
 .section .foo.1,"a"

diff  --git a/lld/test/ELF/linkerscript/expr-invalid-sec.test b/lld/test/ELF/linkerscript/expr-invalid-sec.test
index 946062a0c575..b55006d59e32 100644
--- a/lld/test/ELF/linkerscript/expr-invalid-sec.test
+++ b/lld/test/ELF/linkerscript/expr-invalid-sec.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
-# RUN: not ld.lld -o %t.so --script %s %t.o -shared 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null --script %s %t.o -shared 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}.test:8: at least one side of the expression must be absolute
 

diff  --git a/lld/test/ELF/linkerscript/group.s b/lld/test/ELF/linkerscript/group.s
index 53a1c89ebfe3..54adbdf8eefc 100644
--- a/lld/test/ELF/linkerscript/group.s
+++ b/lld/test/ELF/linkerscript/group.s
@@ -16,29 +16,29 @@
 # RUN: llvm-readobj %t2 > /dev/null
 
 # RUN: echo "GROUP(\"%t\" libxyz.a )" > %t.script
-# RUN: not ld.lld -o %t2 %t.script 2>/dev/null
+# RUN: not ld.lld -o /dev/null %t.script 2>/dev/null
 # RUN: ld.lld -o %t2 %t.script -L%t.dir
 # RUN: llvm-readobj %t2 > /dev/null
 
 # RUN: echo "GROUP(\"%t\" =libxyz.a )" > %t.script
-# RUN: not ld.lld -o %t2 %t.script  2>/dev/null
+# RUN: not ld.lld -o /dev/null %t.script  2>/dev/null
 # RUN: ld.lld -o %t2 %t.script --sysroot=%t.dir
 # RUN: llvm-readobj %t2 > /dev/null
 
 # RUN: echo "GROUP(\"%t\" -lxyz )" > %t.script
-# RUN: not ld.lld -o %t2 %t.script  2>/dev/null
+# RUN: not ld.lld -o /dev/null %t.script  2>/dev/null
 # RUN: ld.lld -o %t2 %t.script -L%t.dir
 # RUN: llvm-readobj %t2 > /dev/null
 
 # RUN: echo "GROUP(\"%t\" libxyz.a )" > %t.script
-# RUN: not ld.lld -o %t2 %t.script  2>/dev/null
+# RUN: not ld.lld -o /dev/null %t.script  2>/dev/null
 # RUN: ld.lld -o %t2 %t.script -L%t.dir
 # RUN: llvm-readobj %t2 > /dev/null
 
 # RUN: echo "GROUP(\"%t\" /libxyz.a )" > %t.script
 # RUN: echo "GROUP(\"%t\" /libxyz.a )" > %t.dir/xyz.script
-# RUN: not ld.lld -o %t2 %t.script 2>/dev/null
-# RUN: not ld.lld -o %t2 %t.script --sysroot=%t.dir  2>/dev/null
+# RUN: not ld.lld -o /dev/null %t.script 2>/dev/null
+# RUN: not ld.lld -o /dev/null %t.script --sysroot=%t.dir  2>/dev/null
 # RUN: ld.lld -o %t2 %t.dir/xyz.script --sysroot=%t.dir
 # RUN: llvm-readobj %t2 > /dev/null
 

diff  --git a/lld/test/ELF/linkerscript/huge-temporary-file.s b/lld/test/ELF/linkerscript/huge-temporary-file.s
index e30153c28857..1b4293bfd7db 100644
--- a/lld/test/ELF/linkerscript/huge-temporary-file.s
+++ b/lld/test/ELF/linkerscript/huge-temporary-file.s
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: echo "SECTIONS { .text 0x2000 : {. = 0x10 ; *(.text) } }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o %t1
+# RUN: not ld.lld %t --script %t.script -o /dev/null
 
 ## This inputs previously created a 4gb temporarily file under 32 bit
 ## configuration. Issue was fixed. There is no clean way to check that from here.

diff  --git a/lld/test/ELF/linkerscript/info-section-type.s b/lld/test/ELF/linkerscript/info-section-type.s
index c9f56b0def11..f65f3243b066 100644
--- a/lld/test/ELF/linkerscript/info-section-type.s
+++ b/lld/test/ELF/linkerscript/info-section-type.s
@@ -38,7 +38,7 @@
 # RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=NONALLOC
 
 # RUN: echo "SECTIONS { .bar 0x20000 (BAR) : { *(.foo) } };" > %t.script
-# RUN: not ld.lld -o %t --script %t.script %t.o 2>&1 |\
+# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 |\
 # RUN:   FileCheck %s --check-prefix=UNKNOWN
 # UNKNOWN: unknown section directive: BAR
 

diff  --git a/lld/test/ELF/linkerscript/insert-broken.test b/lld/test/ELF/linkerscript/insert-broken.test
index 9a295623a2ca..913866f8141f 100644
--- a/lld/test/ELF/linkerscript/insert-broken.test
+++ b/lld/test/ELF/linkerscript/insert-broken.test
@@ -2,5 +2,5 @@ SECTIONS {
   .foo : { *(.bar) }
 } INSERT .data;
 
-# RUN: not ld.lld -o %t1 --script %s 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null --script %s 2>&1 | FileCheck %s
 # CHECK: {{.*}}:3: expected AFTER/BEFORE, but got '.data'

diff  --git a/lld/test/ELF/linkerscript/insert-not-exist.test b/lld/test/ELF/linkerscript/insert-not-exist.test
index 84a2366c2d80..8bb8a7d0ce8d 100644
--- a/lld/test/ELF/linkerscript/insert-not-exist.test
+++ b/lld/test/ELF/linkerscript/insert-not-exist.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/insert-after.s -o %t.o
-# RUN: not ld.lld -T %s %t.o -o %t.out 2>&1 | FileCheck %s
+# RUN: not ld.lld -T %s %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: unable to insert .foo.data after .not_exist
 # CHECK: error: unable to insert .foo.text before .not_exist

diff  --git a/lld/test/ELF/linkerscript/linkerscript.s b/lld/test/ELF/linkerscript/linkerscript.s
index 41140abe8420..14d30bbc1edd 100644
--- a/lld/test/ELF/linkerscript/linkerscript.s
+++ b/lld/test/ELF/linkerscript/linkerscript.s
@@ -36,14 +36,14 @@
 # RUN: rm -rf %t.dir && mkdir -p %t.dir
 # RUN: echo "INCLUDE \"foo.script\"" > %t.script
 # RUN: echo "OUTPUT(\"%t.out\")" > %t.dir/foo.script
-# RUN: not ld.lld %t.script -o %t.out > %t.log 2>&1
+# RUN: not ld.lld %t.script -o /dev/null > %t.log 2>&1
 # RUN: FileCheck -check-prefix=INCLUDE_ERR %s < %t.log
 # INCLUDE_ERR: error: {{.+}}.script:1: cannot find linker script foo.script
 # INCLUDE_ERR-NEXT: INCLUDE "foo.script"
 # RUN: ld.lld -L %t.dir %t.script %t
 
 # RUN: echo "FOO(BAR)" > %t.script
-# RUN: not ld.lld -o %t.out %t.script > %t.log 2>&1
+# RUN: not ld.lld -o /dev/null %t.script > %t.log 2>&1
 # RUN: FileCheck -check-prefix=ERR1 %s < %t.log
 
 # ERR1: unknown directive: FOO

diff  --git a/lld/test/ELF/linkerscript/lma-overflow.test b/lld/test/ELF/linkerscript/lma-overflow.test
index e572c05af344..d9a74467d969 100644
--- a/lld/test/ELF/linkerscript/lma-overflow.test
+++ b/lld/test/ELF/linkerscript/lma-overflow.test
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 
 # RUN: echo '.section .foo,"a"; .quad 1' | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t.o
-# RUN: not ld.lld -o %t %t.o --script %s 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null %t.o --script %s 2>&1 | FileCheck %s
 # CHECK: error: section '.foo' will not fit in region 'flash': overflowed by 264 bytes
 
 MEMORY {

diff  --git a/lld/test/ELF/linkerscript/loadaddr.s b/lld/test/ELF/linkerscript/loadaddr.s
index 33c5f21b52ba..7f1434ea7137 100644
--- a/lld/test/ELF/linkerscript/loadaddr.s
+++ b/lld/test/ELF/linkerscript/loadaddr.s
@@ -16,7 +16,7 @@
 # RUN: ld.lld %t --script %t.script -o %t2
 # RUN: llvm-objdump -t %t2 | FileCheck %s
 # RUN: echo "SECTIONS { v = LOADADDR(.zzz); }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | FileCheck --check-prefix=ERROR %s
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR %s
 
 # CHECK:      0000000000002000         *ABS*     00000000 aaa_lma
 # CHECK-NEXT: 0000000000002008         *ABS*     00000000 bbb_lma

diff  --git a/lld/test/ELF/linkerscript/locationcountererr.test b/lld/test/ELF/linkerscript/locationcountererr.test
index 6a1b21319c5b..086bfeba1e3d 100644
--- a/lld/test/ELF/linkerscript/locationcountererr.test
+++ b/lld/test/ELF/linkerscript/locationcountererr.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t
-# RUN: not ld.lld %t --script %s -o %t1 2>&1 | FileCheck %s
+# RUN: not ld.lld %t --script %s -o /dev/null 2>&1 | FileCheck %s
 # CHECK: {{.*}}.test:8: unable to move location counter backward for: .text
 
 SECTIONS {

diff  --git a/lld/test/ELF/linkerscript/memory-data-commands.test b/lld/test/ELF/linkerscript/memory-data-commands.test
index 2762ec9e985f..0c2de0d21468 100644
--- a/lld/test/ELF/linkerscript/memory-data-commands.test
+++ b/lld/test/ELF/linkerscript/memory-data-commands.test
@@ -4,7 +4,7 @@
 # RUN: echo ".quad 1" >> %t.s
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o
 
-# RUN: not ld.lld -o %t %t.o --script %s 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null %t.o --script %s 2>&1 | FileCheck %s
 
 # Check we are able to catch 'ram' overflow caused by BYTE command.
 # CHECK: error: section '.foo' will not fit in region 'ram': overflowed by 1 bytes

diff  --git a/lld/test/ELF/linkerscript/memory-err.s b/lld/test/ELF/linkerscript/memory-err.s
index 19517687b78d..3c0f689fde8d 100644
--- a/lld/test/ELF/linkerscript/memory-err.s
+++ b/lld/test/ELF/linkerscript/memory-err.s
@@ -1,16 +1,16 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: echo "MEMORY { name : ORIGIN = DATA_SEGMENT_RELRO_END; }" > %t.script
-# RUN: not ld.lld -shared -o %t2 --script %t.script %t 2>&1 | FileCheck %s
+# RUN: not ld.lld -shared -o /dev/null --script %t.script %t 2>&1 | FileCheck %s
 # CHECK: error: {{.*}}.script:1: unable to calculate page size
 
 # RUN: echo "MEMORY { name : ORIGIN = CONSTANT(COMMONPAGESIZE); }" > %t.script
-# RUN: not ld.lld -shared -o %t2 --script %t.script %t 2>&1 |\
+# RUN: not ld.lld -shared -o /dev/null --script %t.script %t 2>&1 |\
 # RUN:   FileCheck %s --check-prefix=ERR2
 # ERR2: error: {{.*}}.script:1: unable to calculate page size
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: echo "MEMORY { name : ORIGIN = .; }" > %t.script
-# RUN: not ld.lld -shared -o %t2 --script %t.script %t 2>&1 |\
+# RUN: not ld.lld -shared -o /dev/null --script %t.script %t 2>&1 |\
 # RUN:   FileCheck %s --check-prefix=ERR3
 # ERR3: error: {{.*}}.script:1: unable to get location counter value

diff  --git a/lld/test/ELF/linkerscript/memory.s b/lld/test/ELF/linkerscript/memory.s
index 0c171425b20a..043483257cb3 100644
--- a/lld/test/ELF/linkerscript/memory.s
+++ b/lld/test/ELF/linkerscript/memory.s
@@ -49,21 +49,21 @@
 ## Check bad `ORIGIN`.
 
 # RUN: echo "MEMORY { ram (rwx) : XYZ = 0x8000 } }" > %t.script
-# RUN: not ld.lld -o %t2 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR1 %s
 # ERR1: {{.*}}.script:1: expected one of: ORIGIN, org, or o
 
 ## Check bad `LENGTH`.
 
 # RUN: echo "MEMORY { ram (rwx) : ORIGIN = 0x8000, XYZ = 256K } }" > %t.script
-# RUN: not ld.lld -o %t2 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR2 %s
 # ERR2: {{.*}}.script:1: expected one of: LENGTH, len, or l
 
 ## Check duplicate regions.
 
 # RUN: echo "MEMORY { ram (rwx) : o = 8, l = 256K ram (rx) : o = 0, l = 256K }" > %t.script
-# RUN: not ld.lld -o %t2 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR3 %s
 # ERR3: {{.*}}.script:1: region 'ram' already defined
 
@@ -74,14 +74,14 @@
 # RUN:   .text : { *(.text) } \
 # RUN:   .data : { *(.data) } > ram \
 # RUN: }" > %t.script
-# RUN: not ld.lld -o %t2 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR4 %s
 # ERR4: {{.*}}: no memory region specified for section '.text'
 
 ## Check undeclared region.
 
 # RUN: echo "SECTIONS { .text : { *(.text) } > ram }" > %t.script
-# RUN: not ld.lld -o %t2 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR5 %s
 # ERR5: {{.*}}: memory region 'ram' not declared
 
@@ -92,14 +92,14 @@
 # RUN:   .text : { *(.text) } > ram \
 # RUN:   .data : { *(.data) } > ram \
 # RUN: }" > %t.script
-# RUN: not ld.lld -o %t2 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR6 %s
 # ERR6: {{.*}}: section '.data' will not fit in region 'ram': overflowed by 2049 bytes
 
 ## Check invalid region attributes.
 
 # RUN: echo "MEMORY { ram (abc) : ORIGIN = 8000, LENGTH = 256K } }" > %t.script
-# RUN: not ld.lld -o %t2 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR7 %s
 # ERR7: {{.*}}.script:1: invalid memory region attribute
 

diff  --git a/lld/test/ELF/linkerscript/numbers.s b/lld/test/ELF/linkerscript/numbers.s
index ceb85fd68d59..43a676f9d466 100644
--- a/lld/test/ELF/linkerscript/numbers.s
+++ b/lld/test/ELF/linkerscript/numbers.s
@@ -39,17 +39,17 @@
 # ERR2: malformed number: 0x11k
 
 # RUN: echo "SECTIONS { . = 0x11m; }" > %t4.script
-# RUN: not ld.lld %t --script %t4.script -o %t5 2>&1 | \
+# RUN: not ld.lld %t --script %t4.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=ERR3 %s
 # ERR3: malformed number: 0x11m
 
 # RUN: echo "SECTIONS { . = 1zh; }" > %t5.script
-# RUN: not ld.lld %t --script %t5.script -o %t5 2>&1 | \
+# RUN: not ld.lld %t --script %t5.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=ERR4 %s
 # ERR4: malformed number: 1zh
 
 # RUN: echo "SECTIONS { . = 1zk; }" > %t6.script
-# RUN: not ld.lld %t --script %t6.script -o %t6 2>&1 | \
+# RUN: not ld.lld %t --script %t6.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=ERR5 %s
 # ERR5: malformed number: 1zk
 

diff  --git a/lld/test/ELF/linkerscript/operators.test b/lld/test/ELF/linkerscript/operators.test
index 2be24dfc2fe3..7a3c2565d5df 100644
--- a/lld/test/ELF/linkerscript/operators.test
+++ b/lld/test/ELF/linkerscript/operators.test
@@ -89,42 +89,42 @@ SECTIONS {
 
 ## Mailformed number error.
 # RUN: echo "SECTIONS { . = 0x12Q41; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=NUMERR %s
 # NUMERR: malformed number: 0x12Q41
 
 ## Missing closing bracket.
 # RUN: echo "SECTIONS { . = (1; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=BRACKETERR %s
 # BRACKETERR: ) expected, but got ;
 
 ## Missing opening bracket.
 # RUN: echo "SECTIONS { . = 1); }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=BRACKETERR2 %s
 # BRACKETERR2: ; expected, but got )
 
 ## Empty expression.
 # RUN: echo "SECTIONS { . = ; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=ERREXPR %s
 # ERREXPR: malformed number: ;
 
 ## Div by zero error.
 # RUN: echo "SECTIONS { . = 1 / 0; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=DIVZERO %s
 # DIVZERO: {{.*}}.script:1: division by zero
 
 ## Mod by zero error.
 # RUN: echo "SECTIONS { . = 1 % 0; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=MODZERO %s
 # MODZERO: {{.*}}.script:1: modulo by zero
 
 ## Broken ternary operator expression.
 # RUN: echo "SECTIONS { . = 1 ? 2; }" > %t.script
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:  FileCheck --check-prefix=TERNERR %s
 # TERNERR: : expected, but got ;

diff  --git a/lld/test/ELF/linkerscript/orphan-report.s b/lld/test/ELF/linkerscript/orphan-report.s
index 94e08100f994..071ddeb5359a 100644
--- a/lld/test/ELF/linkerscript/orphan-report.s
+++ b/lld/test/ELF/linkerscript/orphan-report.s
@@ -12,7 +12,7 @@
 # RUN:   %t.o 2>&1 -verbose  -error-limit=0 | FileCheck %s --check-prefix=DEFAULT
 
 ## Check --orphan-handling=error reports errors about orphans.
-# RUN: not ld.lld -shared --orphan-handling=error -o %t.out --script %t.script \
+# RUN: not ld.lld -shared --orphan-handling=error -o /dev/null --script %t.script \
 # RUN:   %t.o 2>&1 -verbose  -error-limit=0 | FileCheck %s --check-prefix=REPORT
 # REPORT:      {{.*}}.o:(.text) is being placed in '.text'
 # REPORT-NEXT: {{.*}}.o:(.text.2) is being placed in '.text'
@@ -44,7 +44,7 @@
 # RUN: ld.lld -shared --orphan-handling=warn -o %t.out --script %t.script \
 # RUN:   %t.o 2>&1 -verbose | FileCheck %s --check-prefix=REPORT
 
-# RUN: not ld.lld --orphan-handling=foo -o %t.out --script %t.script %t.o 2>&1 \
+# RUN: not ld.lld --orphan-handling=foo -o /dev/null --script %t.script %t.o 2>&1 \
 # RUN:   | FileCheck %s --check-prefix=UNKNOWN
 # UNKNOWN: unknown --orphan-handling mode: foo
 

diff  --git a/lld/test/ELF/linkerscript/overlapping-sections.s b/lld/test/ELF/linkerscript/overlapping-sections.s
index c13ce9259c41..8d886424c540 100644
--- a/lld/test/ELF/linkerscript/overlapping-sections.s
+++ b/lld/test/ELF/linkerscript/overlapping-sections.s
@@ -5,7 +5,7 @@
 # RUN:   .sec1 0x8000 : AT(0x8000) { sec1_start = .; *(.first_sec) sec1_end = .;} \
 # RUN:   .sec2 0x8800 : AT(0x8080) { sec2_start = .; *(.second_sec) sec2_end = .;} \
 # RUN: }" > %t-lma.script
-# RUN: not ld.lld -o %t.so --script %t-lma.script %t.o -shared 2>&1 | FileCheck %s -check-prefix LMA-OVERLAP-ERR
+# RUN: not ld.lld -o /dev/null --script %t-lma.script %t.o -shared 2>&1 | FileCheck %s -check-prefix LMA-OVERLAP-ERR
 # LMA-OVERLAP-ERR:      error: section .sec1 load address range overlaps with .sec2
 # LMA-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF]
 # LMA-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8080, 0x817F]
@@ -36,7 +36,7 @@
 # RUN:   .sec1 0x8000 : AT(0x8000) { sec1_start = .; *(.first_sec) sec1_end = .;} \
 # RUN:   .sec2 0x8020 : AT(0x8800) { sec2_start = .; *(.second_sec) sec2_end = .;} \
 # RUN: }" > %t-vaddr.script
-# RUN: not ld.lld -o %t.so --script %t-vaddr.script %t.o -shared 2>&1 | FileCheck %s -check-prefix VADDR-OVERLAP-ERR
+# RUN: not ld.lld -o /dev/null --script %t-vaddr.script %t.o -shared 2>&1 | FileCheck %s -check-prefix VADDR-OVERLAP-ERR
 # VADDR-OVERLAP-ERR:      error: section .sec1 virtual address range overlaps with .sec2
 # VADDR-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF]
 # VADDR-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8020, 0x811F]
@@ -63,7 +63,7 @@
 # RUN:   .sec2 0x8040 : { sec2_start = .; *(.second_sec) sec2_end = .;} \
 # RUN: }" > %t-both-overlap.script
 
-# RUN: not ld.lld -o %t.so --script %t-both-overlap.script %t.o -shared 2>&1 | FileCheck %s -check-prefix BOTH-OVERLAP-ERR
+# RUN: not ld.lld -o /dev/null --script %t-both-overlap.script %t.o -shared 2>&1 | FileCheck %s -check-prefix BOTH-OVERLAP-ERR
 
 # BOTH-OVERLAP-ERR:      error: section .sec1 file range overlaps with .sec2
 # BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x2000, 0x20FF]

diff  --git a/lld/test/ELF/linkerscript/overlay-reject.test b/lld/test/ELF/linkerscript/overlay-reject.test
index fcb82b6df4b5..fa8a2be37aed 100644
--- a/lld/test/ELF/linkerscript/overlay-reject.test
+++ b/lld/test/ELF/linkerscript/overlay-reject.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
-# RUN: not ld.lld %t.o --script %s -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o --script %s -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK:      {{.*}}.test:{{.*}}: { expected, but got 0x3000
 # CHECK-NEXT: >>>     .out.aaa 0x3000 : { *(.aaa) }

diff  --git a/lld/test/ELF/linkerscript/overlay-reject2.test b/lld/test/ELF/linkerscript/overlay-reject2.test
index 490533c5fa5e..be886d7c1dac 100644
--- a/lld/test/ELF/linkerscript/overlay-reject2.test
+++ b/lld/test/ELF/linkerscript/overlay-reject2.test
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
-# RUN: not ld.lld %t.o --script %s -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o --script %s -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK:      {{.*}}.test:{{.*}}: { expected, but got AX
 # CHECK-NEXT: >>>      .out.aaa { *(.aaa) } > AX AT>FLASH

diff  --git a/lld/test/ELF/linkerscript/page-size.s b/lld/test/ELF/linkerscript/page-size.s
index eaa0acb7a0ad..5b8055598490 100644
--- a/lld/test/ELF/linkerscript/page-size.s
+++ b/lld/test/ELF/linkerscript/page-size.s
@@ -50,11 +50,11 @@
 
 # CHECK-SCRIPT: 0000000000004000 *ABS* 00000000 symbol
 
-# RUN: not ld.lld -z max-page-size=0x1001 -o %t1 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -z max-page-size=0x1001 -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR1 %s
 # ERR1: max-page-size: value isn't a power of 2
 
-# RUN: not ld.lld -z max-page-size=-0x1000 -o %t1 --script %t.script %t 2>&1 \
+# RUN: not ld.lld -z max-page-size=-0x1000 -o /dev/null --script %t.script %t 2>&1 \
 # RUN:  | FileCheck -check-prefix=ERR2 %s
 # ERR2: invalid max-page-size: -0x1000
 

diff  --git a/lld/test/ELF/linkerscript/phdrs.s b/lld/test/ELF/linkerscript/phdrs.s
index c6882b68122a..8774bc04d497 100644
--- a/lld/test/ELF/linkerscript/phdrs.s
+++ b/lld/test/ELF/linkerscript/phdrs.s
@@ -45,7 +45,7 @@
 ## created and error is not reported.
 # RUN: echo "PHDRS { all PT_LOAD; } \
 # RUN:       SECTIONS { .baz : {*(.foo.*)} :bar }" > %t.script
-# RUN: not ld.lld -o %t1 --script %t.script %t 2>&1 | FileCheck --check-prefix=BADHDR %s
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 | FileCheck --check-prefix=BADHDR %s
 
 # CHECK:     ProgramHeaders [
 # CHECK-NEXT:  ProgramHeader {

diff  --git a/lld/test/ELF/linkerscript/region-alias.s b/lld/test/ELF/linkerscript/region-alias.s
index af4a0f377ddd..ec1582bd283c 100644
--- a/lld/test/ELF/linkerscript/region-alias.s
+++ b/lld/test/ELF/linkerscript/region-alias.s
@@ -28,20 +28,20 @@
 
 ## Redefinition of region.
 # RUN: echo "REGION_ALIAS (\"ROM\", ROM);" > %t.script.inc
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:   FileCheck %s --check-prefix=ERR1
 # ERR1: {{.*}}script.inc:1: redefinition of memory region 'ROM'
 
 ## Redefinition of alias.
 # RUN: echo "REGION_ALIAS (\"ALIAS_TEXT\", ROM);" > %t.script.inc
 # RUN: echo "REGION_ALIAS (\"ALIAS_TEXT\", ROM);" >> %t.script.inc
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:   FileCheck %s --check-prefix=ERR2
 # ERR2: {{.*}}script.inc:2: redefinition of memory region 'ALIAS_TEXT'
 
 ## Attemp to create an alias for undefined region.
 # RUN: echo "REGION_ALIAS (\"ALIAS_TEXT\", FOO);" > %t.script.inc
-# RUN: not ld.lld %t --script %t.script -o %t2 2>&1 | \
+# RUN: not ld.lld %t --script %t.script -o /dev/null 2>&1 | \
 # RUN:   FileCheck %s --check-prefix=ERR3
 # ERR3: {{.*}}script.inc:1: memory region 'FOO' is not defined
 

diff  --git a/lld/test/ELF/linkerscript/sections-padding.s b/lld/test/ELF/linkerscript/sections-padding.s
index ab5d122cf247..2e914626bb9f 100644
--- a/lld/test/ELF/linkerscript/sections-padding.s
+++ b/lld/test/ELF/linkerscript/sections-padding.s
@@ -32,7 +32,7 @@
 
 ## Invalid hex value:
 # RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =0x99XX }" > %t.script
-# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 \
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 \
 # RUN:   | FileCheck --check-prefix=ERR2 %s
 # ERR2: malformed number: 0x99XX
 
@@ -58,12 +58,12 @@
 
 ## Check we report an error if expression value is larger than 32-bits.
 # RUN: echo "SECTIONS { .mysec : { *(.mysec*) } =(0x11 << 32) }" > %t.script
-# RUN: not ld.lld -o %t.out --script %t.script %t 2>&1 | FileCheck --check-prefix=ERR3 %s
+# RUN: not ld.lld -o /dev/null --script %t.script %t 2>&1 | FileCheck --check-prefix=ERR3 %s
 # ERR3: filler expression result does not fit 32-bit: 0x1100000000
 
 ## Check we report an error if an expression use a symbol.
 # RUN: echo "SECTIONS { foo = 0x11; .mysec : { *(.mysec*) } = foo }" > %t.script
-# RUN: not ld.lld -o %t.out %t --script %t.script 2>&1 | FileCheck --check-prefix=ERR4 %s
+# RUN: not ld.lld -o /dev/null %t --script %t.script 2>&1 | FileCheck --check-prefix=ERR4 %s
 # ERR4: symbol not found: foo
 
 .section        .mysec.1,"a"

diff  --git a/lld/test/ELF/linkerscript/version-script.s b/lld/test/ELF/linkerscript/version-script.s
index 5584e8a2188e..52382eeb1245 100644
--- a/lld/test/ELF/linkerscript/version-script.s
+++ b/lld/test/ELF/linkerscript/version-script.s
@@ -31,7 +31,7 @@
 # CHECK-NEXT: ]
 
 # RUN: echo "bar = und; VERSION { V { global: foo; bar; local: *; }; }" > %t.script
-# RUN: not ld.lld -T %t.script -shared --no-undefined-version %t.o -o %t.so \
+# RUN: not ld.lld -T %t.script -shared --no-undefined-version %t.o -o /dev/null \
 # RUN:   2>&1 | FileCheck --check-prefix=ERR %s
 # ERR: symbol not found: und
 

diff  --git a/lld/test/ELF/local-undefined-symbol.s b/lld/test/ELF/local-undefined-symbol.s
index c2ab207359bf..e58a7bea6d63 100644
--- a/lld/test/ELF/local-undefined-symbol.s
+++ b/lld/test/ELF/local-undefined-symbol.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: undefined symbol: foo
 

diff  --git a/lld/test/ELF/lto/bitcode-nodatalayout.ll b/lld/test/ELF/lto/bitcode-nodatalayout.ll
index c99cbb8550f0..7ddc12226721 100644
--- a/lld/test/ELF/lto/bitcode-nodatalayout.ll
+++ b/lld/test/ELF/lto/bitcode-nodatalayout.ll
@@ -1,6 +1,6 @@
 ; REQUIRES: x86
 ; RUN: llvm-as %s -o %t.o
-; RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+; RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 ; CHECK: input module has no datalayout
 

diff  --git a/lld/test/ELF/lto/combined-lto-object-name.ll b/lld/test/ELF/lto/combined-lto-object-name.ll
index 6f2d30d5bd37..c3d5518858e4 100644
--- a/lld/test/ELF/lto/combined-lto-object-name.ll
+++ b/lld/test/ELF/lto/combined-lto-object-name.ll
@@ -1,6 +1,6 @@
 ; REQUIRES: x86
 ; RUN: llvm-as %s -o %t.o
-; RUN: not ld.lld %t.o -o %t2 2>&1 | FileCheck %s
+; RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 target triple = "x86_64-unknown-linux-gnu"
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

diff  --git a/lld/test/ELF/lto/duplicated.ll b/lld/test/ELF/lto/duplicated.ll
index f278c45272b1..10afb8e5a37e 100644
--- a/lld/test/ELF/lto/duplicated.ll
+++ b/lld/test/ELF/lto/duplicated.ll
@@ -1,6 +1,6 @@
 ; REQUIRES: x86
 ; RUN: llvm-as %s -o %t.o
-; RUN: not ld.lld %t.o %t.o -o %t.so -shared 2>&1 | FileCheck %s
+; RUN: not ld.lld %t.o %t.o -o /dev/null -shared 2>&1 | FileCheck %s
 
 ; CHECK:      duplicate symbol: f
 ; CHECK-NEXT: >>> defined in {{.*}}.o

diff  --git a/lld/test/ELF/lto/irmover-error.ll b/lld/test/ELF/lto/irmover-error.ll
index 6e1a61d541a4..2f06d27aba86 100644
--- a/lld/test/ELF/lto/irmover-error.ll
+++ b/lld/test/ELF/lto/irmover-error.ll
@@ -1,6 +1,6 @@
 ; RUN: llvm-as -o %t1.bc %s
 ; RUN: llvm-as -o %t2.bc %S/Inputs/irmover-error.ll
-; RUN: not ld.lld %t1.bc %t2.bc -o %t 2>&1 | FileCheck %s
+; RUN: not ld.lld %t1.bc %t2.bc -o /dev/null 2>&1 | FileCheck %s
 
 ; CHECK: linking module flags 'foo': IDs have conflicting values
 

diff  --git a/lld/test/ELF/lto/ltopasses-custom.ll b/lld/test/ELF/lto/ltopasses-custom.ll
index f0322f8e4175..71fa147bf48a 100644
--- a/lld/test/ELF/lto/ltopasses-custom.ll
+++ b/lld/test/ELF/lto/ltopasses-custom.ll
@@ -24,13 +24,13 @@ define void @barrier() {
 ; ATOMIC-NEXT: ret void
 
 ; Check that invalid passes are rejected gracefully.
-; RUN: not ld.lld -m elf_x86_64 %t.o -o %t2.so \
+; RUN: not ld.lld -m elf_x86_64 %t.o -o /dev/null \
 ; RUN:   --lto-newpm-passes=iamnotapass -shared 2>&1 | \
 ; RUN:   FileCheck %s --check-prefix=INVALID
 ; INVALID: unable to parse pass pipeline description 'iamnotapass': unknown pass name 'iamnotapass'
 
 ; Check that invalid AA pipelines are rejected gracefully.
-; RUN: not ld.lld -m elf_x86_64 %t.o -o %t2.so \
+; RUN: not ld.lld -m elf_x86_64 %t.o -o /dev/null \
 ; RUN:   --lto-newpm-passes=globaldce --lto-aa-pipeline=patatino \
 ; RUN:   -shared 2>&1 | \
 ; RUN:   FileCheck %s --check-prefix=INVALIDAA

diff  --git a/lld/test/ELF/lto/mix-platforms.ll b/lld/test/ELF/lto/mix-platforms.ll
index 4625f87b5e23..7b4ab521f006 100644
--- a/lld/test/ELF/lto/mix-platforms.ll
+++ b/lld/test/ELF/lto/mix-platforms.ll
@@ -2,7 +2,7 @@
 ; RUN: llvm-mc %p/Inputs/shared.s -o %t386.o -filetype=obj -triple=i386-pc-linux
 ; RUN: ld.lld %t386.o -o %ti386.so -shared
 ; RUN: llvm-as %s -o %tx64.o
-; RUN: not ld.lld %ti386.so %tx64.o -o %t 2>&1 | FileCheck %s
+; RUN: not ld.lld %ti386.so %tx64.o -o /dev/null 2>&1 | FileCheck %s
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"

diff  --git a/lld/test/ELF/lto/mix-platforms2.ll b/lld/test/ELF/lto/mix-platforms2.ll
index 7b5c95655bfa..feacd23387ba 100644
--- a/lld/test/ELF/lto/mix-platforms2.ll
+++ b/lld/test/ELF/lto/mix-platforms2.ll
@@ -1,7 +1,7 @@
 ; REQUIRES: x86
 ; RUN: llvm-as %s -o %tx64.o
 ; RUN: llvm-as %S/Inputs/i386-empty.ll -o %ti386.o
-; RUN: not ld.lld %ti386.o %tx64.o -o %t.out 2>&1 | FileCheck %s
+; RUN: not ld.lld %ti386.o %tx64.o -o /dev/null 2>&1 | FileCheck %s
 
 ; CHECK: {{.*}}x64.o is incompatible with {{.*}}i386.o
 

diff  --git a/lld/test/ELF/lto/opt-level.ll b/lld/test/ELF/lto/opt-level.ll
index 94c96c7d4234..6e0cc9ac98c5 100644
--- a/lld/test/ELF/lto/opt-level.ll
+++ b/lld/test/ELF/lto/opt-level.ll
@@ -12,19 +12,19 @@
 ; RUN: llvm-nm %t2 | FileCheck --check-prefix=CHECK-O2 %s
 
 ; Reject invalid optimization levels.
-; RUN: not ld.lld -o %t3 -e main --lto-O6 %t.o 2>&1 | \
+; RUN: not ld.lld -o /dev/null -e main --lto-O6 %t.o 2>&1 | \
 ; RUN:   FileCheck --check-prefix=INVALID1 %s
 ; INVALID1: invalid optimization level for LTO: 6
-; RUN: not ld.lld -o %t3 -e main --plugin-opt=O6 %t.o 2>&1 | \
+; RUN: not ld.lld -o /dev/null -e main --plugin-opt=O6 %t.o 2>&1 | \
 ; RUN:   FileCheck --check-prefix=INVALID1 %s
-; RUN: not ld.lld -o %t3 -e main --plugin-opt=Ofoo %t.o 2>&1 | \
+; RUN: not ld.lld -o /dev/null -e main --plugin-opt=Ofoo %t.o 2>&1 | \
 ; RUN:   FileCheck --check-prefix=INVALID2 %s
 ; INVALID2: --plugin-opt=Ofoo: number expected, but got 'foo'
 
-; RUN: not ld.lld -o %t3 -e main --lto-O-1 %t.o 2>&1 | \
+; RUN: not ld.lld -o /dev/null -e main --lto-O-1 %t.o 2>&1 | \
 ; RUN:   FileCheck --check-prefix=INVALIDNEGATIVE1 %s
 ; INVALIDNEGATIVE1: invalid optimization level for LTO: 4294967295
-; RUN: not ld.lld -o %t3 -e main --plugin-opt=O-1 %t.o 2>&1 | \
+; RUN: not ld.lld -o /dev/null -e main --plugin-opt=O-1 %t.o 2>&1 | \
 ; RUN:   FileCheck --check-prefix=INVALIDNEGATIVE2 %s
 ; INVALIDNEGATIVE2: invalid optimization level for LTO: 4294967295
 

diff  --git a/lld/test/ELF/lto/setting-dso-local.ll b/lld/test/ELF/lto/setting-dso-local.ll
index 542db409bb6b..c7e57177710f 100644
--- a/lld/test/ELF/lto/setting-dso-local.ll
+++ b/lld/test/ELF/lto/setting-dso-local.ll
@@ -1,6 +1,6 @@
 ; REQUIRES: x86
 ; RUN: llvm-as %s -o %t1.o
-; RUN: not ld.lld -o %t %t1.o 2>&1 | FileCheck %s
+; RUN: not ld.lld -o /dev/null %t1.o 2>&1 | FileCheck %s
 
 ; CHECK: undefined hidden symbol: foobar
 

diff  --git a/lld/test/ELF/lto/thinlto-cant-write-index.ll b/lld/test/ELF/lto/thinlto-cant-write-index.ll
index d071406e3367..45e35ffd5739 100644
--- a/lld/test/ELF/lto/thinlto-cant-write-index.ll
+++ b/lld/test/ELF/lto/thinlto-cant-write-index.ll
@@ -8,7 +8,7 @@
 ; RUN: rm -f %t2.o.thinlto.bc
 ; RUN: touch %t2.o.thinlto.bc
 ; RUN: chmod u-w %t2.o.thinlto.bc
-; RUN: not ld.lld --plugin-opt=thinlto-index-only -shared %t1.o %t2.o -o %t3 2>&1 | FileCheck %s
+; RUN: not ld.lld --plugin-opt=thinlto-index-only -shared %t1.o %t2.o -o /dev/null 2>&1 | FileCheck %s
 ; RUN: chmod u+w %t2.o.thinlto.bc
 ; CHECK: cannot open {{.*}}2.o.thinlto.bc: {{P|p}}ermission denied
 

diff  --git a/lld/test/ELF/lto/thinlto-emit-imports.ll b/lld/test/ELF/lto/thinlto-emit-imports.ll
index c2d047757001..3e6cfc318a34 100644
--- a/lld/test/ELF/lto/thinlto-emit-imports.ll
+++ b/lld/test/ELF/lto/thinlto-emit-imports.ll
@@ -31,7 +31,7 @@
 ; RUN: rm -f %t3.o.imports
 ; RUN: touch %t3.o.imports
 ; RUN: chmod 400 %t3.o.imports
-; RUN: not ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-emit-imports-files -shared %t1.o %t2.o %t3.o -o %t4 2>&1 | FileCheck %s --check-prefix=ERR
+; RUN: not ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-emit-imports-files -shared %t1.o %t2.o %t3.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR
 ; ERR: cannot open {{.*}}3.o.imports: {{P|p}}ermission denied
 
 ; Ensure lld doesn't generate import files when thinlto-index-only is not enabled

diff  --git a/lld/test/ELF/lto/thinlto-prefix-replace.ll b/lld/test/ELF/lto/thinlto-prefix-replace.ll
index 2aa8e105ad3b..3afbdb0f895b 100644
--- a/lld/test/ELF/lto/thinlto-prefix-replace.ll
+++ b/lld/test/ELF/lto/thinlto-prefix-replace.ll
@@ -16,7 +16,7 @@
 
 ; Ensure that lld generates error if prefix replace option does not have 'old;new' format
 ; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
-; RUN: not ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-prefix-replace=abc:def -shared %t/oldpath/thinlto_prefix_replace.o -o %t/thinlto_prefix_replace 2>&1 | FileCheck %s --check-prefix=ERR
+; RUN: not ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-prefix-replace=abc:def -shared %t/oldpath/thinlto_prefix_replace.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR
 ; ERR: --plugin-opt=thinlto-prefix-replace= expects 'old;new' format, but got abc:def
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

diff  --git a/lld/test/ELF/map-file.s b/lld/test/ELF/map-file.s
index 1071d85b6654..d44a88a78f2c 100644
--- a/lld/test/ELF/map-file.s
+++ b/lld/test/ELF/map-file.s
@@ -95,6 +95,6 @@ labs = 0x1AB5
 // CHECk-NEXT:      0                0       6d     1 .strtab
 // CHECk-NEXT:      0                0       6d     1         <internal>:(.strtab)
 
-// RUN: not ld.lld %t1.o %t2.o %t3.o %t4.a -o %t -Map=/ 2>&1 \
+// RUN: not ld.lld %t1.o %t2.o %t3.o %t4.a -o /dev/null -Map=/ 2>&1 \
 // RUN:  | FileCheck -check-prefix=FAIL %s
 // FAIL: cannot open map file /

diff  --git a/lld/test/ELF/mergeable-errors.s b/lld/test/ELF/mergeable-errors.s
index 578589837f07..d67cd91c97fb 100644
--- a/lld/test/ELF/mergeable-errors.s
+++ b/lld/test/ELF/mergeable-errors.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: not ld.lld %t.o -o %t1 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}.o:(.mergeable): string is not null terminated
 

diff  --git a/lld/test/ELF/mips-elf-flags-err.s b/lld/test/ELF/mips-elf-flags-err.s
index caa33ab28c7a..a2e746d38eca 100644
--- a/lld/test/ELF/mips-elf-flags-err.s
+++ b/lld/test/ELF/mips-elf-flags-err.s
@@ -14,7 +14,7 @@
 # RUN:         -mcpu=mips3 %S/Inputs/mips-dynamic.s -o %t1.o
 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
 # RUN:         -mcpu=mips32 -mattr=+fp64 %s -o %t2.o
-# RUN: not ld.lld %t1.o %t2.o -o %t.exe 2>&1 | FileCheck -check-prefix=R3R32 %s
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null 2>&1 | FileCheck -check-prefix=R3R32 %s
 
 # Check that lld does not allow to link incompatible ISAs.
 
@@ -22,7 +22,7 @@
 # RUN:         -mcpu=mips64r6 %S/Inputs/mips-dynamic.s -o %t1.o
 # RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
 # RUN:         -position-independent -mcpu=octeon %s -o %t2.o
-# RUN: not ld.lld %t1.o %t2.o -o %t.exe 2>&1 \
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null 2>&1 \
 # RUN:   | FileCheck -check-prefix=R6OCTEON %s
 
 # Check that lld take in account EF_MIPS_MACH_XXX ISA flags

diff  --git a/lld/test/ELF/mips-micro-bad-cross-calls.s b/lld/test/ELF/mips-micro-bad-cross-calls.s
index 63f7e407ed80..e3e485a07f51 100644
--- a/lld/test/ELF/mips-micro-bad-cross-calls.s
+++ b/lld/test/ELF/mips-micro-bad-cross-calls.s
@@ -4,7 +4,7 @@
 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
 # RUN:         %S/Inputs/mips-dynamic.s -o %t2.o
 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o
-# RUN: not ld.lld -o %t.exe %t1.o %t2.o 2>&1 | FileCheck %s
+# RUN: not ld.lld -o /dev/null %t1.o %t2.o 2>&1 | FileCheck %s
 
 # CHECK: (.text+0x0): unsupported jump/branch instruction between ISA modes referenced by R_MICROMIPS_PC10_S1 relocation
 

diff  --git a/lld/test/ELF/no-inhibit-exec.s b/lld/test/ELF/no-inhibit-exec.s
index aadfd157f50c..788a58f365a0 100644
--- a/lld/test/ELF/no-inhibit-exec.s
+++ b/lld/test/ELF/no-inhibit-exec.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: not ld.lld %t -o %t2
+# RUN: not ld.lld %t -o /dev/null
 # RUN: ld.lld %t --noinhibit-exec -o %t2
 # RUN: llvm-objdump -d %t2 | FileCheck %s
 # RUN: llvm-readobj -r %t2 | FileCheck %s --check-prefix=RELOC

diff  --git a/lld/test/ELF/ppc64-bsymbolic-toc-restore.s b/lld/test/ELF/ppc64-bsymbolic-toc-restore.s
index 6cea18472a50..45110cef8030 100644
--- a/lld/test/ELF/ppc64-bsymbolic-toc-restore.s
+++ b/lld/test/ELF/ppc64-bsymbolic-toc-restore.s
@@ -4,13 +4,13 @@
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-bsymbolic-local-def.s  -o %t2.o
 # RUN: ld.lld -Bsymbolic -shared %t1.o %t2.o -o %t
 # RUN: llvm-objdump -d -r %t | FileCheck %s
-# RUN: not ld.lld -shared %t1.o %t2.o -o %t 2>&1 | FileCheck --check-prefix=FAIL %s
+# RUN: not ld.lld -shared %t1.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=FAIL %s
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t1.o
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-bsymbolic-local-def.s  -o %t2.o
 # RUN: ld.lld -Bsymbolic -shared %t1.o %t2.o -o %t
 # RUN: llvm-objdump -d -r %t | FileCheck %s
-# RUN: not ld.lld -shared %t1.o %t2.o -o %t 2>&1 | FileCheck --check-prefix=FAIL %s
+# RUN: not ld.lld -shared %t1.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=FAIL %s
 
 # FAIL: call to def lacks nop, can't restore toc
 

diff  --git a/lld/test/ELF/ppc64-error-missaligned-dq.s b/lld/test/ELF/ppc64-error-missaligned-dq.s
index a7c43eb28330..4f1fa2954414 100644
--- a/lld/test/ELF/ppc64-error-missaligned-dq.s
+++ b/lld/test/ELF/ppc64-error-missaligned-dq.s
@@ -1,10 +1,10 @@
 # REQUIRES: ppc
 #
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
-# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
-# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: improper alignment for relocation R_PPC64_TOC16_LO_DS: 0x8009 is not aligned to 16 bytes
 

diff  --git a/lld/test/ELF/ppc64-error-missaligned-ds.s b/lld/test/ELF/ppc64-error-missaligned-ds.s
index 81b19781d7d6..4dc1bd9e513c 100644
--- a/lld/test/ELF/ppc64-error-missaligned-ds.s
+++ b/lld/test/ELF/ppc64-error-missaligned-ds.s
@@ -1,10 +1,10 @@
 # REQUIRES: ppc
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
-# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
-# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: improper alignment for relocation R_PPC64_TOC16_LO_DS: 0x8009 is not aligned to 4 bytes
 

diff  --git a/lld/test/ELF/ppc64-error-toc-restore.s b/lld/test/ELF/ppc64-error-toc-restore.s
index 9700322a5e6d..9e327a80429a 100644
--- a/lld/test/ELF/ppc64-error-toc-restore.s
+++ b/lld/test/ELF/ppc64-error-toc-restore.s
@@ -3,12 +3,12 @@
 // RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
 // RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
 // RUN: ld.lld -shared %t2.o -o %t2.so
-// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o %t2.so -o /dev/null 2>&1 | FileCheck %s
 
 // RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
 // RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
 // RUN: ld.lld -shared %t2.o -o %t2.so
-// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o %t2.so -o /dev/null 2>&1 | FileCheck %s
 
 # Calling external function bar needs a nop
 // CHECK: call to foo lacks nop, can't restore toc

diff  --git a/lld/test/ELF/ppc64-error-toc-tail-call.s b/lld/test/ELF/ppc64-error-toc-tail-call.s
index b303810b81d0..7f492a322f84 100644
--- a/lld/test/ELF/ppc64-error-toc-tail-call.s
+++ b/lld/test/ELF/ppc64-error-toc-tail-call.s
@@ -3,12 +3,12 @@
 // RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
 // RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
 // RUN: ld.lld -shared %t2.o -o %t2.so
-// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o %t2.so -o /dev/null 2>&1 | FileCheck %s
 
 // RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
 // RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
 // RUN: ld.lld -shared %t2.o -o %t2.so
-// RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
+// RUN: not ld.lld %t.o %t2.so -o /dev/null 2>&1 | FileCheck %s
 
 # A tail call to an external function without a nop should issue an error.
 // CHECK: call to foo lacks nop, can't restore toc

diff  --git a/lld/test/ELF/ppc64-split-stack-adjust-fail.s b/lld/test/ELF/ppc64-split-stack-adjust-fail.s
index 4ad1a9994d98..e69e62562a5e 100644
--- a/lld/test/ELF/ppc64-split-stack-adjust-fail.s
+++ b/lld/test/ELF/ppc64-split-stack-adjust-fail.s
@@ -3,12 +3,12 @@
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t1.o
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-no-split-stack.s -o %t2.o
 
-# RUN: not ld.lld --defsym __morestack=0x10010000 %t1.o %t2.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld --defsym __morestack=0x10010000 %t1.o %t2.o -o /dev/null 2>&1 | FileCheck %s
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t1.o
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-no-split-stack.s -o %t2.o
 
-# RUN: not ld.lld --defsym __morestack=0x10010000 %t1.o %t2.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld --defsym __morestack=0x10010000 %t1.o %t2.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: {{.*}}.o:(.text): wrong_regs (with -fsplit-stack) calls nss_callee (without -fsplit-stack), but couldn't adjust its prologue
 

diff  --git a/lld/test/ELF/ppc64-split-stack-adjust-overflow.s b/lld/test/ELF/ppc64-split-stack-adjust-overflow.s
index 874f45cd0e7d..b1a104474f10 100644
--- a/lld/test/ELF/ppc64-split-stack-adjust-overflow.s
+++ b/lld/test/ELF/ppc64-split-stack-adjust-overflow.s
@@ -3,9 +3,9 @@
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t1.o
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-no-split-stack.s -o %t2.o
 
-# RUN: not ld.lld %t1.o %t2.o -o %t --defsym __morestack=0x10010000 2>&1 | \
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null --defsym __morestack=0x10010000 2>&1 | \
 # RUN: FileCheck -check-prefix=OVERFLOW %s
-# RUN: not ld.lld %t1.o %t2.o -o %t --defsym __morestack=0x10010000 \
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null --defsym __morestack=0x10010000 \
 # RUN: -split-stack-adjust-size 4097 2>&1 | FileCheck -check-prefix=OVERFLOW %s
 # RUN: ld.lld %t1.o %t2.o -o %t --defsym __morestack=0x10010000 -split-stack-adjust-size 4096
 # RUN: llvm-objdump -d %t | FileCheck %s
@@ -13,9 +13,9 @@
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t1.o
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-no-split-stack.s -o %t2.o
 
-# RUN: not ld.lld %t1.o %t2.o -o %t --defsym __morestack=0x10010000 2>&1 | \
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null --defsym __morestack=0x10010000 2>&1 | \
 # RUN: FileCheck -check-prefix=OVERFLOW %s
-# RUN: not ld.lld %t1.o %t2.o -o %t --defsym __morestack=0x10010000 \
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null --defsym __morestack=0x10010000 \
 # RUN: -split-stack-adjust-size 4097 2>&1 | FileCheck -check-prefix=OVERFLOW %s
 # RUN: ld.lld %t1.o %t2.o -o %t --defsym __morestack=0x10010000 -split-stack-adjust-size 4096
 # RUN: llvm-objdump -d %t | FileCheck %s

diff  --git a/lld/test/ELF/ppc64-split-stack-adjust-size-success.s b/lld/test/ELF/ppc64-split-stack-adjust-size-success.s
index 913d2625e92a..ee8596884457 100644
--- a/lld/test/ELF/ppc64-split-stack-adjust-size-success.s
+++ b/lld/test/ELF/ppc64-split-stack-adjust-size-success.s
@@ -9,7 +9,7 @@
 # RUN: llvm-objdump -d %t | FileCheck %s -check-prefix=SMALL
 # RUN: ld.lld %t1.o %t2.o -o %t --defsym __morestack=0x10010000 -split-stack-adjust-size 0
 # RUN: llvm-objdump -d %t | FileCheck %s -check-prefix=ZERO
-# RUN: not ld.lld %t1.o %t2.o -o %t -split-stack-adjust-size -1 2>&1 | FileCheck %s -check-prefix=ERR
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null -split-stack-adjust-size -1 2>&1 | FileCheck %s -check-prefix=ERR
 # ERR: error: --split-stack-adjust-size: size must be >= 0
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t1.o

diff  --git a/lld/test/ELF/protected-data-access.s b/lld/test/ELF/protected-data-access.s
index 35fd1e2db87d..f9c6ed6f4882 100644
--- a/lld/test/ELF/protected-data-access.s
+++ b/lld/test/ELF/protected-data-access.s
@@ -6,7 +6,7 @@
 # RUN: ld.lld %t2.o -o %t2.so -shared
 # RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t.o
 
-# RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck --check-prefix=ERR %s
+# RUN: not ld.lld %t.o %t2.so -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
 # ERR: error: cannot preempt symbol: foo
 
 ## Allow that if --ignore-data-address-equality is specified.

diff  --git a/lld/test/ELF/push-state.s b/lld/test/ELF/push-state.s
index f8c09833c20f..6477d9d9150b 100644
--- a/lld/test/ELF/push-state.s
+++ b/lld/test/ELF/push-state.s
@@ -30,9 +30,9 @@
 // RUN: mkdir -p %t.dir
 // RUN: cp %t.so %t.dir/libfoo.so
 // RUN: ld.lld -o %t.exe -L%t.dir -push-state -static -pop-state  %t1.o -lfoo
-// RUN: not ld.lld -o %t.exe -L%t.dir -push-state -static %t1.o -lfoo
+// RUN: not ld.lld -o /dev/null -L%t.dir -push-state -static %t1.o -lfoo
 
-// RUN: not ld.lld -o %t.exe -pop-state %t.a %t1.o -M 2>&1 | FileCheck -check-prefix=ERR %s
+// RUN: not ld.lld -o /dev/null -pop-state %t.a %t1.o -M 2>&1 | FileCheck -check-prefix=ERR %s
 // ERR: error: unbalanced --push-state/--pop-state
 
 .globl _start

diff  --git a/lld/test/ELF/relocatable-common.s b/lld/test/ELF/relocatable-common.s
index a12ce87779cd..0c89cea9be40 100644
--- a/lld/test/ELF/relocatable-common.s
+++ b/lld/test/ELF/relocatable-common.s
@@ -33,7 +33,7 @@
 # DEFCOMM-NEXT:   Section: COMMON
 # DEFCOMM-NEXT: }
 
-# RUN: not ld.lld -shared --no-define-common %t1.o -o %t 2>&1 | FileCheck --check-prefix=ERROR %s
+# RUN: not ld.lld -shared --no-define-common %t1.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR %s
 # ERROR: error: -no-define-common not supported in non relocatable output
 
 .comm common,4,4

diff  --git a/lld/test/ELF/relro-non-contiguous-script-data.s b/lld/test/ELF/relro-non-contiguous-script-data.s
index c2332d14a982..fd485e89167f 100644
--- a/lld/test/ELF/relro-non-contiguous-script-data.s
+++ b/lld/test/ELF/relro-non-contiguous-script-data.s
@@ -6,14 +6,14 @@
 // RUN: .jcr : { *(.jcr) } \
 // RUN: } " > %t.script
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: not ld.lld --export-dynamic %t.o -o %t --script=%t.script 2>&1 | FileCheck %s
+// RUN: not ld.lld --export-dynamic %t.o -o /dev/null --script=%t.script 2>&1 | FileCheck %s
 
 // RUN: echo "SECTIONS { \
 // RUN: .dynamic : { *(.dynamic) } \
 // RUN: .non_ro : { BYTE(1); } \
 // RUN: .jcr : { *(.jcr) } \
 // RUN: } " > %t2.script
-// RUN: not ld.lld --export-dynamic %t.o -o %t --script=%t2.script 2>&1 | FileCheck %s
+// RUN: not ld.lld --export-dynamic %t.o -o /dev/null --script=%t2.script 2>&1 | FileCheck %s
 
 // CHECK: error: section: .jcr is not contiguous with other relro sections
 

diff  --git a/lld/test/ELF/riscv-branch.s b/lld/test/ELF/riscv-branch.s
index 8d78ab75ad7a..af6fd31d7726 100644
--- a/lld/test/ELF/riscv-branch.s
+++ b/lld/test/ELF/riscv-branch.s
@@ -17,13 +17,13 @@
 # LIMITS:      e3 0f 00 7e     beqz    zero, 4094
 # LIMITS-NEXT: 63 10 00 80     bnez    zero, -4096
 
-# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x1000 --defsym bar=_start+4-0x1002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
-# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x1000 --defsym bar=_start+4-0x1002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
+# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x1000 --defsym bar=_start+4-0x1002 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x1000 --defsym bar=_start+4-0x1002 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
 # ERROR-RANGE: relocation R_RISCV_BRANCH out of range: 2048 is not in [-2048, 2047]; references foo
 # ERROR-RANGE: relocation R_RISCV_BRANCH out of range: -2049 is not in [-2048, 2047]; references bar
 
-# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start-1 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
-# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start-1 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
+# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start-1 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start-1 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
 # ERROR-ALIGN: improper alignment for relocation R_RISCV_BRANCH: 0x1 is not aligned to 2 bytes
 
 .global _start

diff  --git a/lld/test/ELF/riscv-call.s b/lld/test/ELF/riscv-call.s
index 7a8cbf8348e4..ef7963ad8db5 100644
--- a/lld/test/ELF/riscv-call.s
+++ b/lld/test/ELF/riscv-call.s
@@ -22,7 +22,7 @@
 # LIMITS-NEXT: e7 80 00 80     jalr    -2048(ra)
 
 # RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o %t
-# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o %t 2>&1 | \
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+8-0x80000801 -o /dev/null 2>&1 | \
 # RUN:   FileCheck --check-prefix=ERROR %s
 # ERROR: relocation R_RISCV_CALL out of range: 524288 is not in [-524288, 524287]; references foo
 # ERROR: relocation R_RISCV_CALL out of range: -524289 is not in [-524288, 524287]; references bar

diff  --git a/lld/test/ELF/riscv-hi20-lo12.s b/lld/test/ELF/riscv-hi20-lo12.s
index 3ef78a0aa616..1c57f31b58a4 100644
--- a/lld/test/ELF/riscv-hi20-lo12.s
+++ b/lld/test/ELF/riscv-hi20-lo12.s
@@ -25,7 +25,7 @@
 # LIMITS-NEXT: 93 85 05 80     addi    a1, a1, -2048
 # LIMITS-NEXT: 23 a0 b5 80     sw      a1, -2048(a1)
 
-# RUN: not ld.lld %t.rv64.o --defsym foo=0x7ffff800 --defsym bar=0xffffffff7ffff7ff -o %t 2>&1 | FileCheck --check-prefix ERROR %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=0x7ffff800 --defsym bar=0xffffffff7ffff7ff -o /dev/null 2>&1 | FileCheck --check-prefix ERROR %s
 # ERROR: relocation R_RISCV_HI20 out of range: 524288 is not in [-524288, 524287]; references foo
 # ERROR: relocation R_RISCV_HI20 out of range: -524289 is not in [-524288, 524287]; references bar
 

diff  --git a/lld/test/ELF/riscv-jal.s b/lld/test/ELF/riscv-jal.s
index b31a0eb960ac..63c716bbf3fe 100644
--- a/lld/test/ELF/riscv-jal.s
+++ b/lld/test/ELF/riscv-jal.s
@@ -17,13 +17,13 @@
 # LIMITS:      6f f0 ff 7f j   1048574
 # LIMITS-NEXT: ef 00 00 80 jal -1048576
 
-# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x100000 --defsym bar=_start+4-0x100002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
-# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x100000 --defsym bar=_start+4-0x100002 -o %t 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
+# RUN: not ld.lld %t.rv32.o --defsym foo=_start+0x100000 --defsym bar=_start+4-0x100002 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x100000 --defsym bar=_start+4-0x100002 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-RANGE %s
 # ERROR-RANGE: relocation R_RISCV_JAL out of range: 524288 is not in [-524288, 524287]; references foo
 # ERROR-RANGE: relocation R_RISCV_JAL out of range: -524289 is not in [-524288, 524287]; references bar
 
-# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start+4+3 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
-# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start+4+3 -o %t 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
+# RUN: not ld.lld %t.rv32.o --defsym foo=_start+1 --defsym bar=_start+4+3 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+1 --defsym bar=_start+4+3 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR-ALIGN %s
 # ERROR-ALIGN: improper alignment for relocation R_RISCV_JAL: 0x1 is not aligned to 2 bytes
 # ERROR-ALIGN: improper alignment for relocation R_RISCV_JAL: 0x3 is not aligned to 2 bytes
 

diff  --git a/lld/test/ELF/riscv-pcrel-hilo.s b/lld/test/ELF/riscv-pcrel-hilo.s
index 9172853d193d..a991d80ef103 100644
--- a/lld/test/ELF/riscv-pcrel-hilo.s
+++ b/lld/test/ELF/riscv-pcrel-hilo.s
@@ -30,7 +30,7 @@
 # LIMITS-NEXT: sw      zero, -2048(a0)
 
 # RUN: ld.lld %t.rv32.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+12-0x80000801 -o %t
-# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+12-0x80000801 -o %t 2>&1 | FileCheck --check-prefix=ERROR %s
+# RUN: not ld.lld %t.rv64.o --defsym foo=_start+0x7ffff800 --defsym bar=_start+12-0x80000801 -o /dev/null 2>&1 | FileCheck --check-prefix=ERROR %s
 # ERROR: relocation R_RISCV_PCREL_HI20 out of range: 524288 is not in [-524288, 524287]; references foo
 # ERROR: relocation R_RISCV_PCREL_HI20 out of range: -524289 is not in [-524288, 524287]; references bar
 

diff  --git a/lld/test/ELF/riscv-reloc-64-pic.s b/lld/test/ELF/riscv-reloc-64-pic.s
index b704f19e61d3..224aea93b800 100644
--- a/lld/test/ELF/riscv-reloc-64-pic.s
+++ b/lld/test/ELF/riscv-reloc-64-pic.s
@@ -1,6 +1,6 @@
 # REQUIRES: riscv
 # RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o
-# RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
+# RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: relocation R_RISCV_32 cannot be used against symbol a
 

diff  --git a/lld/test/ELF/sectionstart.s b/lld/test/ELF/sectionstart.s
index f404a92f6f1a..340794628ace 100644
--- a/lld/test/ELF/sectionstart.s
+++ b/lld/test/ELF/sectionstart.s
@@ -37,15 +37,15 @@
 # RUN:    | FileCheck -check-prefix=ERR2 %s
 # ERR2: invalid argument: --section-start .text=1Q0000
 
-# RUN: not ld.lld %t.o -Ttext=1w0000 -o %t6 2>&1 \
+# RUN: not ld.lld %t.o -Ttext=1w0000 -o /dev/null 2>&1 \
 # RUN:    | FileCheck -check-prefix=ERR3 %s
 # ERR3: invalid argument: -Ttext=1w0000
 
-# RUN: not ld.lld %t.o -Tbss=1w0000 -o %t6 2>&1 \
+# RUN: not ld.lld %t.o -Tbss=1w0000 -o /dev/null 2>&1 \
 # RUN:    | FileCheck -check-prefix=ERR4 %s
 # ERR4: invalid argument: -Tbss=1w0000
 
-# RUN: not ld.lld %t.o -Tdata=1w0000 -o %t6 2>&1 \
+# RUN: not ld.lld %t.o -Tdata=1w0000 -o /dev/null 2>&1 \
 # RUN:    | FileCheck -check-prefix=ERR5 %s
 # ERR5: invalid argument: -Tdata=1w0000
 

diff  --git a/lld/test/ELF/symbol-ordering-file-cgprofile-conflicts.s b/lld/test/ELF/symbol-ordering-file-cgprofile-conflicts.s
index 593f3c99891b..3e1c652443ac 100644
--- a/lld/test/ELF/symbol-ordering-file-cgprofile-conflicts.s
+++ b/lld/test/ELF/symbol-ordering-file-cgprofile-conflicts.s
@@ -34,8 +34,8 @@
 // RUN: echo "C D 40" >> %t.call_graph
 // RUN: echo "D B 10" >> %t.call_graph
 
-// RUN: not ld.lld -e A %t.o --symbol-ordering-file %t.symbol_order --call-graph-ordering-file %t.call_graph -o %t 2>&1 | FileCheck %s
-// RUN: not ld.lld -e A %t.o --call-graph-ordering-file %t.call_graph --symbol-ordering-file %t.symbol_order -o %t 2>&1 | FileCheck %s
+// RUN: not ld.lld -e A %t.o --symbol-ordering-file %t.symbol_order --call-graph-ordering-file %t.call_graph -o /dev/null 2>&1 | FileCheck %s
+// RUN: not ld.lld -e A %t.o --call-graph-ordering-file %t.call_graph --symbol-ordering-file %t.symbol_order -o /dev/null 2>&1 | FileCheck %s
 // CHECK: error: --symbol-ordering-file and --call-graph-order-file may not be used together
 
     .section    .text.D,"ax", at progbits

diff  --git a/lld/test/ELF/sysroot.s b/lld/test/ELF/sysroot.s
index e9d6862b7a32..360944039345 100644
--- a/lld/test/ELF/sysroot.s
+++ b/lld/test/ELF/sysroot.s
@@ -7,13 +7,13 @@
 // RUN: llvm-ar rcs %t/lib/libls.a %t/st.o
 
 // Should not link because of undefined symbol _bar
-// RUN: not ld.lld -o %t/r %t/m.o 2>&1 \
+// RUN: not ld.lld -o /dev/null %t/m.o 2>&1 \
 // RUN:     | FileCheck --check-prefix=UNDEFINED %s
 // UNDEFINED: error: undefined symbol: _bar
 // UNDEFINED: >>> referenced by {{.*}}:(.text+0x1)
 
 // We need to be sure that there is no suitable library in the /lib directory
-// RUN: not ld.lld -o %t/r %t/m.o -L/lib -l:libls.a 2>&1 \
+// RUN: not ld.lld -o /dev/null %t/m.o -L/lib -l:libls.a 2>&1 \
 // RUN:     | FileCheck --check-prefix=NOLIB %s
 // NOLIB: unable to find library -l:libls.a
 
@@ -32,8 +32,8 @@
 // RUN: ld.lld -o %t/r %t/m.o --sysroot %t -L=lib -l:libls.a
 
 // Should not substitute SysRoot if the directory name does not start with '='
-// RUN: not ld.lld -o %t/r %r/m.o --sysroot=%t -Llib -l:libls.a
-// RUN: not ld.lld -o %t/r %r/m.o --sysroot=%t -L/lib -l:libls.a
+// RUN: not ld.lld -o /dev/null %r/m.o --sysroot=%t -Llib -l:libls.a
+// RUN: not ld.lld -o /dev/null %r/m.o --sysroot=%t -L/lib -l:libls.a
 
 .globl _start,_bar
 _start:

diff  --git a/lld/test/ELF/undef-shared2.s b/lld/test/ELF/undef-shared2.s
index 9508f9db4a7a..bdaeb4faddd2 100644
--- a/lld/test/ELF/undef-shared2.s
+++ b/lld/test/ELF/undef-shared2.s
@@ -1,8 +1,8 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-shared2.s -o %t2.o
-# RUN: not ld.lld %t.o %t2.o -o %t.so -shared 2>&1 | FileCheck %s
-# RUN: not ld.lld %t2.o %t.o -o %t.so -shared 2>&1 | FileCheck %s
+# RUN: not ld.lld %t.o %t2.o -o /dev/null -shared 2>&1 | FileCheck %s
+# RUN: not ld.lld %t2.o %t.o -o /dev/null -shared 2>&1 | FileCheck %s
 
 # CHECK: error: undefined protected symbol: foo
 

diff  --git a/lld/test/ELF/undef.s b/lld/test/ELF/undef.s
index f2053433658d..f78854ad1d94 100644
--- a/lld/test/ELF/undef.s
+++ b/lld/test/ELF/undef.s
@@ -5,9 +5,9 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-bad-debug.s -o %t4.o
 # RUN: rm -f %t2.a
 # RUN: llvm-ar rc %t2.a %t2.o
-# RUN: not ld.lld %t.o %t2.a %t3.o %t4.o -o %t.exe 2>&1 \
+# RUN: not ld.lld %t.o %t2.a %t3.o %t4.o -o /dev/null 2>&1 \
 # RUN:   | FileCheck %s --implicit-check-not="error:" --implicit-check-not="warning:"
-# RUN: not ld.lld -pie %t.o %t2.a %t3.o %t4.o -o %t.exe 2>&1 \
+# RUN: not ld.lld -pie %t.o %t2.a %t3.o %t4.o -o /dev/null 2>&1 \
 # RUN:   | FileCheck %s --implicit-check-not="error:" --implicit-check-not="warning:"
 
 # CHECK:      error: undefined symbol: foo
@@ -72,7 +72,7 @@
 # CHECK-NEXT: >>> referenced by undef-bad-debug2.s:11 (dir2{{/|\\}}undef-bad-debug2.s:11)
 # CHECK-NEXT: >>>               {{.*}}tmp4.o:(.text+0x18)
 
-# RUN: not ld.lld %t.o %t2.a -o %t.exe -no-demangle 2>&1 | \
+# RUN: not ld.lld %t.o %t2.a -o /dev/null -no-demangle 2>&1 | \
 # RUN:   FileCheck -check-prefix=NO-DEMANGLE %s
 # NO-DEMANGLE: error: undefined symbol: _Z3fooi
 

diff  --git a/lld/test/ELF/undefined-glob.s b/lld/test/ELF/undefined-glob.s
index 0f423b5fa651..30d7adeefc90 100644
--- a/lld/test/ELF/undefined-glob.s
+++ b/lld/test/ELF/undefined-glob.s
@@ -49,7 +49,7 @@
 # FOO13: foo32
 # FOO13-NOT: bar
 
-# RUN: not ld.lld -o %t.exe %t.o %t.a --undefined-glob '[' 2>&1 | \
+# RUN: not ld.lld -o /dev/null %t.o %t.a --undefined-glob '[' 2>&1 | \
 # RUN:   FileCheck -check-prefix=BAD-PATTERN %s
 
 # BAD-PATTERN: --undefined-glob: invalid glob pattern: [

diff  --git a/lld/test/ELF/unresolved-symbols.s b/lld/test/ELF/unresolved-symbols.s
index 04159729a85d..90581e5be4e4 100644
--- a/lld/test/ELF/unresolved-symbols.s
+++ b/lld/test/ELF/unresolved-symbols.s
@@ -4,17 +4,17 @@
 # RUN: ld.lld -shared %t2.o -o %t.so
 
 ## Check that %t2.o contains undefined symbol undef.
-# RUN: not ld.lld %t1.o %t2.o -o %t 2>&1 | \
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null 2>&1 | \
 # RUN:   FileCheck -check-prefix=UNDCHECK %s
 # UNDCHECK: error: undefined symbol: undef
 # UNDCHECK: >>> referenced by {{.*}}2.o:(.text+0x1)
 
 ## Error out if unknown option value was set.
-# RUN: not ld.lld %t1.o %t2.o -o %t --unresolved-symbols=xxx 2>&1 | \
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null --unresolved-symbols=xxx 2>&1 | \
 # RUN:   FileCheck -check-prefix=ERR1 %s
 # ERR1: unknown --unresolved-symbols value: xxx
 ## Check alias.
-# RUN: not ld.lld %t1.o %t2.o -o %t --unresolved-symbols xxx 2>&1 | \
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null --unresolved-symbols xxx 2>&1 | \
 # RUN:   FileCheck -check-prefix=ERR1 %s
 
 ## Ignore all should not produce error for symbols from object except

diff  --git a/lld/test/ELF/version-exclude-libs.s b/lld/test/ELF/version-exclude-libs.s
index 652dd50ec9ab..0282e5d4eff0 100644
--- a/lld/test/ELF/version-exclude-libs.s
+++ b/lld/test/ELF/version-exclude-libs.s
@@ -6,7 +6,7 @@
 // RUN: ld.lld %t2.o %t.a --shared --exclude-libs ALL -o %t.so
 // RUN: llvm-readobj --symbols %t.so | FileCheck %s
 // RUN: llvm-readobj --dyn-syms %t.so | FileCheck -check-prefix CHECK-DYN %s
-// RUN: not ld.lld %t2.o %t.a --shared -o %t.so 2>&1 | FileCheck -check-prefix=CHECK-ERR %s
+// RUN: not ld.lld %t2.o %t.a --shared -o /dev/null 2>&1 | FileCheck -check-prefix=CHECK-ERR %s
 
 // Test that we do not give an error message for undefined versions when the
 // symbol is not exported to the dynamic symbol table.

diff  --git a/lld/test/ELF/version-script-err.s b/lld/test/ELF/version-script-err.s
index bd786d913369..6e541899930b 100644
--- a/lld/test/ELF/version-script-err.s
+++ b/lld/test/ELF/version-script-err.s
@@ -1,10 +1,10 @@
 // REQUIRES: x86
 
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: not ld.lld -shared %t.o -o %t.so --version-script %p/Inputs/version-script-err.script 2>&1 | FileCheck %s
+// RUN: not ld.lld -shared %t.o -o /dev/null --version-script %p/Inputs/version-script-err.script 2>&1 | FileCheck %s
 // CHECK: ; expected, but got }
 
 // RUN: echo    "\"" > %terr1.script
-// RUN: not ld.lld --version-script %terr1.script -shared %t.o -o %t.so 2>&1 | \
+// RUN: not ld.lld --version-script %terr1.script -shared %t.o -o /dev/null 2>&1 | \
 // RUN:   FileCheck -check-prefix=ERR1 %s
 // ERR1: {{.*}}:1: unclosed quote

diff  --git a/lld/test/ELF/version-script.s b/lld/test/ELF/version-script.s
index 874766ea1d8f..a812900184c0 100644
--- a/lld/test/ELF/version-script.s
+++ b/lld/test/ELF/version-script.s
@@ -22,13 +22,13 @@
 
 # RUN: echo "VERSION_1.0 { global: foo1; local: *; };" > %t5.script
 # RUN: echo "{ global: foo3; local: *; };" >> %t5.script
-# RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o %t5.so 2>&1 | \
+# RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o /dev/null 2>&1 | \
 # RUN:   FileCheck -check-prefix=ERR1 %s
 # ERR1: anonymous version definition is used in combination with other version definitions
 
 # RUN: echo "{ global: foo1; local: *; };" > %t5.script
 # RUN: echo "VERSION_2.0 { global: foo3; local: *; };" >> %t5.script
-# RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o %t5.so 2>&1 | \
+# RUN: not ld.lld --version-script %t5.script -shared %t.o %t2.so -o /dev/null 2>&1 | \
 # RUN:   FileCheck -check-prefix=ERR2 %s
 # ERR2: EOF expected, but got VERSION_2.0
 

diff  --git a/lld/test/ELF/vs-diagnostics-duplicate.s b/lld/test/ELF/vs-diagnostics-duplicate.s
index 11425df9db02..740c0778cf9c 100644
--- a/lld/test/ELF/vs-diagnostics-duplicate.s
+++ b/lld/test/ELF/vs-diagnostics-duplicate.s
@@ -2,7 +2,7 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/vs-diagnostics-duplicate2.s -o %t2.o
 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/vs-diagnostics-duplicate3.s -o %t3.o
-// RUN: not ld.lld --vs-diagnostics %t1.o %t2.o %t3.o -o %tout 2>&1 | FileCheck %s
+// RUN: not ld.lld --vs-diagnostics %t1.o %t2.o %t3.o -o /dev/null 2>&1 | FileCheck %s
 
 // Case 1. Both symbols have full source location.
 // CHECK:      duplicate.s(15): error: duplicate symbol: bar

diff  --git a/lld/test/ELF/vs-diagnostics-undefined-symbol-1.s b/lld/test/ELF/vs-diagnostics-undefined-symbol-1.s
index 908549327ecf..97925b1dec5e 100644
--- a/lld/test/ELF/vs-diagnostics-undefined-symbol-1.s
+++ b/lld/test/ELF/vs-diagnostics-undefined-symbol-1.s
@@ -1,6 +1,6 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
-// RUN: not ld.lld --vs-diagnostics %t1.o -o %tout 2>&1 \
+// RUN: not ld.lld --vs-diagnostics %t1.o -o /dev/null 2>&1 \
 // RUN:   | FileCheck -check-prefix=ERR -check-prefix=CHECK -DFILE=%t1.o %s
 // RUN: ld.lld --vs-diagnostics --warn-unresolved-symbols %t1.o -o %tout 2>&1 \
 // RUN:   | FileCheck -check-prefix=WARN -check-prefix=CHECK -DFILE=%t1.o %s

diff  --git a/lld/test/ELF/vs-diagnostics-undefined-symbol-2.s b/lld/test/ELF/vs-diagnostics-undefined-symbol-2.s
index 3c8c80ef6a25..ea1aa3546c23 100644
--- a/lld/test/ELF/vs-diagnostics-undefined-symbol-2.s
+++ b/lld/test/ELF/vs-diagnostics-undefined-symbol-2.s
@@ -1,6 +1,6 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
-// RUN: not ld.lld --vs-diagnostics %t1.o -o %tout 2>&1 \
+// RUN: not ld.lld --vs-diagnostics %t1.o -o /dev/null 2>&1 \
 // RUN:   | FileCheck -check-prefix=ERR -check-prefix=CHECK %s
 // RUN: ld.lld --vs-diagnostics --warn-unresolved-symbols %t1.o -o %tout 2>&1 \
 // RUN:   | FileCheck -check-prefix=WARN -check-prefix=CHECK %s

diff  --git a/lld/test/ELF/vs-diagnostics-undefined-symbol-3.s b/lld/test/ELF/vs-diagnostics-undefined-symbol-3.s
index f2295b7c3323..f9fe13d1af89 100644
--- a/lld/test/ELF/vs-diagnostics-undefined-symbol-3.s
+++ b/lld/test/ELF/vs-diagnostics-undefined-symbol-3.s
@@ -1,6 +1,6 @@
 // REQUIRES: x86
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
-// RUN: not ld.lld --vs-diagnostics %t1.o -o %tout 2>&1 \
+// RUN: not ld.lld --vs-diagnostics %t1.o -o /dev/null 2>&1 \
 // RUN:   | FileCheck -check-prefix=ERR -check-prefix=CHECK %s
 // RUN: ld.lld --vs-diagnostics --warn-unresolved-symbols %t1.o -o %tout 2>&1 \
 // RUN:   | FileCheck -check-prefix=WARN -check-prefix=CHECK %s

diff  --git a/lld/test/ELF/warn-backrefs.s b/lld/test/ELF/warn-backrefs.s
index 28937e199cae..629bd3be2fd9 100644
--- a/lld/test/ELF/warn-backrefs.s
+++ b/lld/test/ELF/warn-backrefs.s
@@ -19,12 +19,12 @@
 # RUN: echo "GROUP(\"%t2.a\" \"%t1.o\")" > %t2.script
 # RUN: ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t2.script
 
-# RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t2.a %t1.o 2>&1 | FileCheck %s
-# RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t2.a "-(" %t1.o "-)" 2>&1 | FileCheck %s
-# RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe --start-group %t2.a --end-group %t1.o 2>&1 | FileCheck %s
+# RUN: not ld.lld --fatal-warnings --warn-backrefs -o /dev/null %t2.a %t1.o 2>&1 | FileCheck %s
+# RUN: not ld.lld --fatal-warnings --warn-backrefs -o /dev/null %t2.a "-(" %t1.o "-)" 2>&1 | FileCheck %s
+# RUN: not ld.lld --fatal-warnings --warn-backrefs -o /dev/null --start-group %t2.a --end-group %t1.o 2>&1 | FileCheck %s
 
 # RUN: echo "GROUP(\"%t2.a\")" > %t3.script
-# RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t3.script %t1.o 2>&1 | FileCheck %s
+# RUN: not ld.lld --fatal-warnings --warn-backrefs -o /dev/null %t3.script %t1.o 2>&1 | FileCheck %s
 # RUN: ld.lld --fatal-warnings --warn-backrefs -o %t.exe "-(" %t3.script %t1.o "-)"
 
 # CHECK: backward reference detected: foo in {{.*}}1.o refers to {{.*}}2.a

diff  --git a/lld/test/ELF/weak-and-strong-undef.s b/lld/test/ELF/weak-and-strong-undef.s
index 32ce649bb147..ee4e17ff3813 100644
--- a/lld/test/ELF/weak-and-strong-undef.s
+++ b/lld/test/ELF/weak-and-strong-undef.s
@@ -1,8 +1,8 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
 # RUN: echo ".weak foo" | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t2.o
-# RUN: not ld.lld %t1.o %t2.o -o %t 2>&1 | FileCheck %s
-# RUN: not ld.lld %t2.o %t1.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld %t1.o %t2.o -o /dev/null 2>&1 | FileCheck %s
+# RUN: not ld.lld %t2.o %t1.o -o /dev/null 2>&1 | FileCheck %s
 
 # CHECK: error: undefined symbol: foo
 

diff  --git a/lld/test/ELF/x86-64-dyn-rel-error.s b/lld/test/ELF/x86-64-dyn-rel-error.s
index 1c715dbfba06..0b28db6d0b78 100644
--- a/lld/test/ELF/x86-64-dyn-rel-error.s
+++ b/lld/test/ELF/x86-64-dyn-rel-error.s
@@ -2,7 +2,7 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t2.o
 // RUN: ld.lld %t2.o -shared -o %t2.so
-// RUN: not ld.lld -shared %t.o %t2.so -o %t 2>&1 | FileCheck %s
+// RUN: not ld.lld -shared %t.o %t2.so -o /dev/null 2>&1 | FileCheck %s
 
         .global _start
 _start:

diff  --git a/lld/test/ELF/x86-64-split-stack-prologue-adjust-fail.s b/lld/test/ELF/x86-64-split-stack-prologue-adjust-fail.s
index b2d21e1595a3..324c95aff2c1 100644
--- a/lld/test/ELF/x86-64-split-stack-prologue-adjust-fail.s
+++ b/lld/test/ELF/x86-64-split-stack-prologue-adjust-fail.s
@@ -3,15 +3,15 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/x86-64-split-stack-extra.s -o %t2.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/x86-64-split-stack-main.s -o %t3.o
 
-# RUN: not ld.lld --defsym __morestack=0x100 --defsym __more_stack_nonsplit=0x200 %t1.o %t2.o %t3.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld --defsym __morestack=0x100 --defsym __more_stack_nonsplit=0x200 %t1.o %t2.o %t3.o -o /dev/null 2>&1 | FileCheck %s
 
 # An unknown prologue gives a match failure
 # CHECK: error: {{.*}}.o:(.text): unknown_prologue (with -fsplit-stack) calls non_split (without -fsplit-stack), but couldn't adjust its prologue
 
-# RUN: not ld.lld -r --defsym __morestack=0x100 %t1.o %t2.o -o %t 2>&1 | FileCheck %s -check-prefix=RELOCATABLE
+# RUN: not ld.lld -r --defsym __morestack=0x100 %t1.o %t2.o -o /dev/null 2>&1 | FileCheck %s -check-prefix=RELOCATABLE
 # RELOCATABLE: cannot mix split-stack and non-split-stack in a relocatable link
 
-# RUN: not ld.lld --defsym __morestack=0x100 --defsym _start=0x300 %t1.o %t2.o %t3.o -o %t 2>&1 | FileCheck %s -check-prefix=ERROR
+# RUN: not ld.lld --defsym __morestack=0x100 --defsym _start=0x300 %t1.o %t2.o %t3.o -o /dev/null 2>&1 | FileCheck %s -check-prefix=ERROR
 # ERROR: Mixing split-stack objects requires a definition of __morestack_non_split
 
 	.text

diff  --git a/lld/test/ELF/zdefs.s b/lld/test/ELF/zdefs.s
index def217f6c0e1..fbcdba580e7d 100644
--- a/lld/test/ELF/zdefs.s
+++ b/lld/test/ELF/zdefs.s
@@ -5,7 +5,7 @@
 # RUN: ld.lld -shared %t.o -o %t1.so
 
 ## -z defs disallows unresolved references.
-# RUN: not ld.lld -z defs -shared %t.o -o %t1.so 2>&1 | FileCheck -check-prefix=ERR %s
+# RUN: not ld.lld -z defs -shared %t.o -o /dev/null 2>&1 | FileCheck -check-prefix=ERR %s
 # ERR: error: undefined symbol: foo
 # ERR: >>> referenced by {{.*}}:(.text+0x1)
 

diff  --git a/lld/test/ELF/znotext-weak-undef.s b/lld/test/ELF/znotext-weak-undef.s
index 72bb6e2d5e18..d1e1e209ef0e 100644
--- a/lld/test/ELF/znotext-weak-undef.s
+++ b/lld/test/ELF/znotext-weak-undef.s
@@ -1,6 +1,6 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-# RUN: not ld.lld -z notext -shared %t.o -o %t 2>&1 | FileCheck %s
+# RUN: not ld.lld -z notext -shared %t.o -o /dev/null 2>&1 | FileCheck %s
 # CHECK: relocation R_X86_64_32 cannot be used against symbol foo; recompile with -fPIC
 
 # RUN: ld.lld -z notext %t.o -o %t

diff  --git a/lld/test/ELF/ztext.s b/lld/test/ELF/ztext.s
index 43fab2f67e7f..8744f76de0ea 100644
--- a/lld/test/ELF/ztext.s
+++ b/lld/test/ELF/ztext.s
@@ -10,8 +10,8 @@
 # RUN: ld.lld -z notext %t.o %t2.so -o %t3
 # RUN: llvm-readobj  --dynamic-table -r %t3 | FileCheck --check-prefix=STATIC %s
 
-# RUN: not ld.lld %t.o %t2.so -o %t -shared 2>&1 | FileCheck --check-prefix=ERR %s
-# RUN: not ld.lld -z text %t.o %t2.so -o %t -shared 2>&1 | FileCheck --check-prefix=ERR %s
+# RUN: not ld.lld %t.o %t2.so -o /dev/null -shared 2>&1 | FileCheck --check-prefix=ERR %s
+# RUN: not ld.lld -z text %t.o %t2.so -o /dev/null -shared 2>&1 | FileCheck --check-prefix=ERR %s
 # ERR: error: can't create dynamic relocation
 
 # If the preference is to have text relocations, don't create plt of copy relocations.


        


More information about the llvm-commits mailing list