Skip to content

Commit 0ffe270

Browse files
committed
[ELF,test] Remove unneeded -o /dev/null
When the script has executed `cd %t`, it is fine to to use the output file `a.out`. (We don't want to rely on lit's default PWD to support lit compatible runners. Therefore -o /dev/null is used when PWD has not been changed to a %t derived path.)
1 parent 8fc03e4 commit 0ffe270

21 files changed

+95
-97
lines changed

lld/test/ELF/aarch64-feature-gcs.s

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636

3737
## gcs-report should report any input files that don't have the gcs property.
3838

39-
# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -o /dev/null -z gcs-report=warning 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
40-
# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -o /dev/null -z gcs-report=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
41-
# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -o /dev/null -z gcs-report=warning -z gcs=never 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
42-
# RUN: not ld.lld func2-gcs.o func3.o --shared -o /dev/null -z gcs-report=error 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
43-
# RUN: not ld.lld func2-gcs.o func3.o --shared -o /dev/null -z gcs-report=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
44-
# RUN: not ld.lld func2-gcs.o func3.o --shared -o /dev/null -z gcs-report=error -z gcs=never 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
45-
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -o /dev/null -z gcs-report=warning 2>&1 | count 0
46-
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -o /dev/null -z gcs-report=warning -z gcs=always 2>&1 | count 0
47-
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -o /dev/null -z gcs-report=warning -z gcs=never 2>&1 | count 0
39+
# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -z gcs-report=warning 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
40+
# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -z gcs-report=warning -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
41+
# RUN: ld.lld func1-gcs.o func2.o func3-gcs.o -z gcs-report=warning -z gcs=never 2>&1 | FileCheck --check-prefix=REPORT-WARN %s
42+
# RUN: not ld.lld func2-gcs.o func3.o --shared -z gcs-report=error 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
43+
# RUN: not ld.lld func2-gcs.o func3.o --shared -z gcs-report=error -z gcs=always 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
44+
# RUN: not ld.lld func2-gcs.o func3.o --shared -z gcs-report=error -z gcs=never 2>&1 | FileCheck --check-prefix=REPORT-ERROR %s
45+
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs-report=warning 2>&1 | count 0
46+
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs-report=warning -z gcs=always 2>&1 | count 0
47+
# RUN: ld.lld func1-gcs.o func2-gcs.o func3-gcs.o -z gcs-report=warning -z gcs=never 2>&1 | count 0
4848

4949
# REPORT-WARN: warning: func2.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property
5050
# REPORT-ERROR: error: func3.o: -z gcs-report: file does not have GNU_PROPERTY_AARCH64_FEATURE_1_GCS property

lld/test/ELF/allow-shlib-undefined-weak.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# RUN: ld.lld -shared wrap.o def.so -o wrap.so
2222

2323
# RUN: llvm-mc -filetype=obj -triple=x86_64 start.s -o start.o
24-
# RUN: ld.lld --no-allow-shlib-undefined start.o wrap.so ref.so -o /dev/null 2>&1 | count 0
24+
# RUN: ld.lld --no-allow-shlib-undefined start.o wrap.so ref.so 2>&1 | count 0
2525

2626
#--- start.s
2727
.globl _start

lld/test/ELF/allow-shlib-undefined.s

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,40 @@
99
# RUN: cp a.so b.so
1010
# RUN: llvm-mc -filetype=obj -triple=x86_64 empty.s -o empty.o && ld.lld -shared empty.o -o empty.so
1111

12-
# RUN: ld.lld --allow-shlib-undefined main.o a.so -o /dev/null
13-
# RUN: not ld.lld --no-allow-shlib-undefined main.o a.so -o /dev/null 2>&1 | FileCheck %s
12+
# RUN: ld.lld --allow-shlib-undefined main.o a.so
13+
# RUN: not ld.lld --no-allow-shlib-undefined main.o a.so 2>&1 | FileCheck %s
1414
## Executable linking defaults to --no-allow-shlib-undefined.
15-
# RUN: not ld.lld main.o a.so -o /dev/null 2>&1 | FileCheck %s
16-
# RUN: ld.lld main.o a.so --noinhibit-exec -o /dev/null 2>&1 | FileCheck %s --check-prefix=WARN
17-
# RUN: ld.lld main.o a.so --warn-unresolved-symbols -o /dev/null 2>&1 | FileCheck %s --check-prefix=WARN
15+
# RUN: not ld.lld main.o a.so 2>&1 | FileCheck %s
16+
# RUN: ld.lld main.o a.so --noinhibit-exec 2>&1 | FileCheck %s --check-prefix=WARN
17+
# RUN: ld.lld main.o a.so --warn-unresolved-symbols 2>&1 | FileCheck %s --check-prefix=WARN
1818
## -shared linking defaults to --allow-shlib-undefined.
19-
# RUN: ld.lld -shared main.o a.so -o /dev/null
19+
# RUN: ld.lld -shared main.o a.so
2020

2121
## DSO with undefines should link with or without any of these options.
22-
# RUN: ld.lld -shared --allow-shlib-undefined a.o -o /dev/null
23-
# RUN: ld.lld -shared --no-allow-shlib-undefined a.o -o /dev/null
22+
# RUN: ld.lld -shared --allow-shlib-undefined a.o
23+
# RUN: ld.lld -shared --no-allow-shlib-undefined a.o
2424

2525
## Perform checking even if an unresolved symbol is first seen in a regular object file.
26-
# RUN: not ld.lld --gc-sections main.o ref.o a.so -o /dev/null 2>&1 | FileCheck %s
26+
# RUN: not ld.lld --gc-sections main.o ref.o a.so 2>&1 | FileCheck %s
2727

2828
## Check that the error is reported for each shared library where the symbol
2929
## is referenced.
30-
# RUN: not ld.lld main.o a.so empty.so b.so -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK2
30+
# RUN: not ld.lld main.o a.so empty.so b.so 2>&1 | FileCheck %s --check-prefix=CHECK2
3131

3232
## Test some cases when a relocatable object file provides a non-exported definition.
33-
# RUN: not ld.lld main.o a.so def-hidden.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
34-
# RUN: not ld.lld main.o def-hidden.o a.so -o /dev/null 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
35-
# RUN: not ld.lld main.o a.so def-hidden.o -shared --no-allow-shlib-undefined -o /dev/null 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
36-
# RUN: ld.lld main.o a.so def-hidden.o --allow-shlib-undefined --fatal-warnings -o /dev/null
33+
# RUN: not ld.lld main.o a.so def-hidden.o 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
34+
# RUN: not ld.lld main.o def-hidden.o a.so 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
35+
# RUN: not ld.lld main.o a.so def-hidden.o -shared --no-allow-shlib-undefined 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
36+
# RUN: ld.lld main.o a.so def-hidden.o --allow-shlib-undefined --fatal-warnings
3737
## Test a relocatable object file definition that is converted to STB_LOCAL.
38-
# RUN: not ld.lld main.o a.so def-hidden.o --version-script=local.ver -o /dev/null 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
39-
# RUN: not ld.lld main.o def-hidden.o a.so --version-script=local.ver -o /dev/null 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
38+
# RUN: not ld.lld main.o a.so def-hidden.o --version-script=local.ver 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
39+
# RUN: not ld.lld main.o def-hidden.o a.so --version-script=local.ver 2>&1 | FileCheck %s --check-prefix=NONEXPORTED
4040

4141
## The section containing the definition is discarded, and we report an error.
42-
# RUN: not ld.lld --gc-sections main.o a.so def-hidden.o -o /dev/null 2>&1 | FileCheck %s
42+
# RUN: not ld.lld --gc-sections main.o a.so def-hidden.o 2>&1 | FileCheck %s
4343
## The definition def.so is ignored.
4444
# RUN: ld.lld -shared def.o -o def.so
45-
# RUN: ld.lld --gc-sections main.o a.so def.so def-hidden.o --fatal-warnings -o /dev/null
45+
# RUN: ld.lld --gc-sections main.o a.so def.so def-hidden.o --fatal-warnings
4646

4747
# CHECK-NOT: error:
4848
# CHECK: error: undefined reference: x1{{$}}

lld/test/ELF/arm-cmse-diagnostics.s

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.base lib -o lib.o
88
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.base app -I %S/Inputs -o app.o
99
// RUN: llvm-objcopy --redefine-sym=entry7_duplicate=entry6_duplicate lib.o
10-
// RUN: not ld.lld --cmse-implib --in-implib=lib.o app.o -o /dev/null 2>&1 | FileCheck %s --check-prefixes=ERR_IMPLIB
11-
// RUN: not ld.lld --cmse-implib --in-implib=lib.o --in-implib=lib.o app.o -o /dev/null 2>&1 | FileCheck %s --check-prefixes=ERR_MULT_INIMPLIB
12-
// RUN: not ld.lld --in-implib=lib.o app.o -o /dev/null 2>&1 | FileCheck %s --check-prefixes=ERR_IN_IMPLIB
13-
// RUN: not ld.lld --out-implib=out.lib app.o -o /dev/null 2>&1 | FileCheck %s --check-prefixes=ERR_OUT_IMPLIB
14-
// RUN: not ld.lld --out-implib=out.lib --in-implib=lib.o app.o -o /dev/null 2>&1 | FileCheck %s --check-prefixes=ERR_IN_IMPLIB,ERR_OUT_IMPLIB
10+
// RUN: not ld.lld --cmse-implib --in-implib=lib.o app.o 2>&1 | FileCheck %s --check-prefixes=ERR_IMPLIB
11+
// RUN: not ld.lld --cmse-implib --in-implib=lib.o --in-implib=lib.o app.o 2>&1 | FileCheck %s --check-prefixes=ERR_MULT_INIMPLIB
12+
// RUN: not ld.lld --in-implib=lib.o app.o 2>&1 | FileCheck %s --check-prefixes=ERR_IN_IMPLIB
13+
// RUN: not ld.lld --out-implib=out.lib app.o 2>&1 | FileCheck %s --check-prefixes=ERR_OUT_IMPLIB
14+
// RUN: not ld.lld --out-implib=out.lib --in-implib=lib.o app.o 2>&1 | FileCheck %s --check-prefixes=ERR_IN_IMPLIB,ERR_OUT_IMPLIB
1515

1616
// ERR_IMPLIB: error: CMSE symbol 'entry_not_external' in import library '{{.*}}' is not global
1717
// ERR_IMPLIB: error: CMSE symbol 'entry_not_absolute' in import library '{{.*}}' is not absolute
@@ -91,7 +91,7 @@
9191
/// Test diagnostics emitted during symbol attribute checks.
9292

9393
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -I %S/Inputs --triple=thumbv8m.base symattr -o symattr.o
94-
// RUN: not ld.lld --cmse-implib symattr.o -o /dev/null 2>&1 | FileCheck %s --check-prefixes=ERR_SYMATTR
94+
// RUN: not ld.lld --cmse-implib symattr.o 2>&1 | FileCheck %s --check-prefixes=ERR_SYMATTR
9595

9696
// ERR_SYMATTR-NOT: __acle_se_valid_{{.*}}
9797
// ERR_SYMATTR: error: {{.*}}: cmse special symbol '__acle_se_invalid_1' is not a Thumb function definition
@@ -110,9 +110,9 @@
110110
/// Test diagnostics emitted when a symbol is removed from a later version of the import library.
111111
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -I %S/Inputs --triple=thumbv8m.base libv1 -o libv1.o
112112
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -I %S/Inputs --triple=thumbv8m.base libv2 -o libv2.o
113-
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv1.o --out-implib=libv1.lib -o /dev/null
114-
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv2.o --in-implib=libv1.lib --out-implib=libv2.lib -o /dev/null 2>&1 | FileCheck %s --check-prefixes=WARN_MISSING
115-
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv1.o --in-implib=libv2.lib -o /dev/null 2>&1 | FileCheck %s --check-prefixes=WARN_NEWENTRY
113+
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv1.o --out-implib=libv1.lib
114+
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv2.o --in-implib=libv1.lib --out-implib=libv2.lib 2>&1 | FileCheck %s --check-prefixes=WARN_MISSING
115+
// RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --cmse-implib libv1.o --in-implib=libv2.lib 2>&1 | FileCheck %s --check-prefixes=WARN_NEWENTRY
116116

117117
// WARN_MISSING: warning: entry function 'bar' from CMSE import library is not present in secure application
118118
// WARN_NEWENTRY: warning: new entry function 'bar' introduced but no output import library specified

lld/test/ELF/avr-reloc-error.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
# RUN: rm -rf %t && split-file %s %t && cd %t
44

55
# RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega328 avr-pcrel-7.s -o avr-pcrel-7.o
6-
# RUN: not ld.lld avr-pcrel-7.o -o /dev/null -Ttext=0x1000 --defsym=callee0=0x1040 --defsym=callee1=0x1084 --defsym=callee2=0x100f 2>&1 | \
6+
# RUN: not ld.lld avr-pcrel-7.o -Ttext=0x1000 --defsym=callee0=0x1040 --defsym=callee1=0x1084 --defsym=callee2=0x100f 2>&1 | \
77
# RUN: FileCheck %s --check-prefix=PCREL7
88
# RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega328 avr-pcrel-13.s -o avr-pcrel-13.o
9-
# RUN: not ld.lld avr-pcrel-13.o -o /dev/null -Ttext=0x1000 --defsym=callee0=0x2000 --defsym=callee1=0x2004 --defsym=callee2=0x100f 2>&1 | \
9+
# RUN: not ld.lld avr-pcrel-13.o -Ttext=0x1000 --defsym=callee0=0x2000 --defsym=callee1=0x2004 --defsym=callee2=0x100f 2>&1 | \
1010
# RUN: FileCheck %s --check-prefix=PCREL13
1111
# RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega328 avr-abs.s -o avr-abs.o
12-
# RUN: not ld.lld avr-abs.o -o /dev/null -Ttext=0x1000 --defsym=callee0=0x1009 --defsym=callee1=0x1010 2>&1 | \
12+
# RUN: not ld.lld avr-abs.o -Ttext=0x1000 --defsym=callee0=0x1009 --defsym=callee1=0x1010 2>&1 | \
1313
# RUN: FileCheck %s --check-prefix=ABS
1414

1515
#--- avr-pcrel-7.s

lld/test/ELF/common-archive-lookup.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
# RUN: FileCheck --check-prefix=ASM %s < out.lto.s
7070

7171
## COMMON overrides weak. Don't extract 3.bc which provides a weak definition.
72-
# RUN: ld.lld -o /dev/null main.o --start-lib 1.bc 3.bc --end-lib -y block | FileCheck --check-prefix=LTO_WEAK %s
72+
# RUN: ld.lld main.o --start-lib 1.bc 3.bc --end-lib -y block | FileCheck --check-prefix=LTO_WEAK %s
7373

7474
## Old FORTRAN that mixes use of COMMON blocks and BLOCK DATA requires that we
7575
## search through archives for non-tentative definitions (from the BLOCK DATA)

lld/test/ELF/duplicated-synthetic-sym.s

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
// REQUIRES: x86
2-
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3-
// RUN: rm -rf %t.dir
4-
// RUN: mkdir %t.dir
5-
// RUN: cd %t.dir
2+
// RUN: rm -rf %t && mkdir %t && cd %t
3+
// RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o a.o
64
// RUN: echo > file.bin
75

8-
// RUN: not ld.lld %t.o --format=binary file.bin -o /dev/null 2>&1 | FileCheck %s
9-
// RUN: not ld.lld %t.o --format binary file.bin -o /dev/null 2>&1 | FileCheck %s
6+
// RUN: not ld.lld a.o --format=binary file.bin 2>&1 | FileCheck %s
7+
// RUN: not ld.lld a.o --format binary file.bin 2>&1 | FileCheck %s
108

11-
// CHECK: duplicate symbol: _binary_file_bin_start
9+
// CHECK: error: duplicate symbol: _binary_file_bin_start
1210
// CHECK-NEXT: defined in {{.*}}.o
1311
// CHECK-NEXT: defined in file.bin
1412

lld/test/ELF/linkerscript/discard-section.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# RUN: rm -rf %t && split-file %s %t && cd %t
55
# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
66
# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o
7-
# RUN: not ld.lld --threads=1 -T a.lds a.o b.o -z undefs -o /dev/null 2>&1 | FileCheck %s --check-prefix=LOCAL --implicit-check-not=error:
8-
# RUN: not ld.lld --threads=1 -T a.lds a.o b.o -o /dev/null 2>&1 | FileCheck %s --check-prefixes=LOCAL,NONLOCAL --implicit-check-not=error:
7+
# RUN: not ld.lld --threads=1 -T a.lds a.o b.o -z undefs 2>&1 | FileCheck %s --check-prefix=LOCAL --implicit-check-not=error:
8+
# RUN: not ld.lld --threads=1 -T a.lds a.o b.o 2>&1 | FileCheck %s --check-prefixes=LOCAL,NONLOCAL --implicit-check-not=error:
99
# RUN: ld.lld -r -T a.lds a.o b.o -o a.ro 2>&1 | FileCheck %s --check-prefix=WARNING --implicit-check-not=warning:
1010
# RUN: llvm-readelf -r -s a.ro | FileCheck %s --check-prefix=RELOC
1111

lld/test/ELF/linkerscript/input-relative.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131

3232
## The rules does not apply to an absolute path.
3333
# RUN: echo 'INPUT(/libb.a)' > dir/absolute.lds
34-
# RUN: not ld.lld a.o dir/absolute.lds -o /dev/null
34+
# RUN: not ld.lld a.o dir/absolute.lds
3535

3636
## If the parent directory of the current linker script does not contain the file,
3737
## fall back to the current working directory.
3838
# RUN: cp libb.a libc.a
3939
# RUN: echo 'INPUT(libc.a)' > dir/fallback.lds
40-
# RUN: ld.lld a.o dir/fallback.lds -o /dev/null
40+
# RUN: ld.lld a.o dir/fallback.lds
4141

4242
.globl _start
4343
_start:

lld/test/ELF/linkerscript/locationcountererr-arm-exidx.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## If we don't merge adjacent duplicate entries, __code_size will be negative and
66
## . += __code_size will trigger a "move location counter backward" error.
77
## LLD may report more errors further down, but there is only one "move location counter backward" error.
8-
# RUN: not ld.lld -z norelro -z max-page-size=4096 -T a.t a.o -o /dev/null --no-merge-exidx-entries 2>&1 | \
8+
# RUN: not ld.lld -z norelro -z max-page-size=4096 -T a.t a.o --no-merge-exidx-entries 2>&1 | \
99
# RUN: FileCheck %s --check-prefix=ERR --implicit-check-not=error:
1010

1111
# ERR: error: a.t:9: unable to move location counter (0x1000) backward to 0xf6c for section 'dummy1'

0 commit comments

Comments
 (0)