Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -173,7 +173,7 @@ auto MBOrErr = MemoryBuffer::getFile(Path); if (auto EC = MBOrErr.getError()) { - error(EC, "cannot open " + Path); + error(EC, Path + ": cannot open"); return None; } std::unique_ptr &MB = *MBOrErr; Index: ELF/LTO.cpp =================================================================== --- ELF/LTO.cpp +++ ELF/LTO.cpp @@ -46,7 +46,7 @@ std::error_code EC; raw_fd_ostream OS(Path.str(), EC, sys::fs::OpenFlags::F_None); if (EC) - error(EC, "cannot create " + Path); + error(EC, Path + ": cannot create"); OS << Buffer; } Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -216,7 +216,7 @@ return; if (auto EC = Buffer->commit()) - error(EC, "failed to write to the output file"); + error(EC, Config->OutputFile + ": failed to write"); // Flush the output streams and exit immediately. A full shutdown // is a good test that we are keeping track of all allocated memory, @@ -1501,7 +1501,7 @@ FileOutputBuffer::create(Config->OutputFile, FileSize, FileOutputBuffer::F_executable); if (auto EC = BufferOrErr.getError()) - error(EC, "failed to open " + Config->OutputFile); + error(EC, Config->OutputFile + ": failed to open"); else Buffer = std::move(*BufferOrErr); } Index: test/ELF/basic.s =================================================================== --- test/ELF/basic.s +++ test/ELF/basic.s @@ -210,7 +210,7 @@ # RUN: echo " c:\blah\foo" > %t.responsefile # RUN: not ld.lld --rsp-quoting=windows %t @%t.responsefile 2>&1 | FileCheck \ # RUN: %s --check-prefix=WINRSP -# WINRSP: cannot open c:\blah\foo +# WINRSP: c:\blah\foo: cannot open # Test for the response file (invalid quoting style) # RUN: not ld.lld --rsp-quoting=patatino %t 2>&1 | FileCheck %s \ @@ -219,7 +219,7 @@ # RUN: not ld.lld %t.foo -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=MISSING %s -# MISSING: cannot open {{.*}}.foo: {{[Nn]}}o such file or directory +# MISSING: {{.*}}.foo: cannot open: {{[Nn]}}o such file or directory # RUN: not ld.lld -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=NO_INPUT %s @@ -227,7 +227,7 @@ # RUN: not ld.lld %t.no.such.file -o %t2 2>&1 | \ # RUN: FileCheck --check-prefix=CANNOT_OPEN %s -# CANNOT_OPEN: cannot open {{.*}}.no.such.file: {{[Nn]}}o such file or directory +# CANNOT_OPEN: {{.*}}.no.such.file: cannot open: {{[Nn]}}o such file or directory # RUN: not ld.lld %t -o 2>&1 | FileCheck --check-prefix=NO_O_VAL %s # NO_O_VAL: -o: missing argument Index: test/ELF/driver.test =================================================================== --- test/ELF/driver.test +++ test/ELF/driver.test @@ -6,12 +6,12 @@ # UNKNOWN: unknown argument: --unknown1 # UNKNOWN: unknown argument: --unknown2 # UNKNOWN: unknown emulation: foo -# UNKNOWN: cannot open /no/such/file +# UNKNOWN: /no/such/file: cannot open # UNKNOWN: unable to find library -lnosuchlib # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t # RUN: not ld.lld %t -o /no/such/file 2>&1 | FileCheck -check-prefix=MISSING %s -# MISSING: failed to open /no/such/file +# MISSING: /no/such/file: failed to open # RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s # HELP: USAGE: @@ -48,11 +48,11 @@ ## "--output=foo" is equivalent to "-o foo". # RUN: not ld.lld %t --output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR7 %s -# ERR7: failed to open /no/such/file +# ERR7: /no/such/file: failed to open ## "-output=foo" is equivalent to "-o utput=foo". # RUN: not ld.lld %t -output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR8 %s -# ERR8: failed to open utput=/no/such/file +# ERR8: utput=/no/such/file: failed to open .globl _start _start: Index: test/ELF/error-limit.test =================================================================== --- test/ELF/error-limit.test +++ test/ELF/error-limit.test @@ -1,26 +1,26 @@ RUN: not ld.lld 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 \ RUN: 21 22 2>&1 | FileCheck -check-prefix=DEFAULT %s -DEFAULT: cannot open 01 -DEFAULT: cannot open 20 +DEFAULT: 01: cannot open +DEFAULT: 20: cannot open DEFAULT-NEXT: too many errors emitted, stopping now (use -error-limit=0 to see all errors) -DEFAULT-NOT: cannot open 21 +DEFAULT-NOT: 21: cannot open RUN: not ld.lld -error-limit=5 01 02 03 04 05 06 07 08 09 10 2>&1 \ RUN: | FileCheck -check-prefix=LIMIT5 %s RUN: not ld.lld -error-limit 5 01 02 03 04 05 06 07 08 09 10 2>&1 \ RUN: | FileCheck -check-prefix=LIMIT5 %s -LIMIT5: cannot open 01 -LIMIT5: cannot open 05 +LIMIT5: 01: cannot open +LIMIT5: 05: cannot open LIMIT5-NEXT: too many errors emitted, stopping now (use -error-limit=0 to see all errors) -LIMIT5-NOT: cannot open 06 +LIMIT5-NOT: 06: cannot open RUN: not ld.lld -error-limit=0 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 \ RUN: 16 17 18 19 20 21 22 2>&1 | FileCheck -check-prefix=UNLIMITED %s -UNLIMITED: cannot open 01 -UNLIMITED: cannot open 20 -UNLIMITED: cannot open 21 -UNLIMITED: cannot open 22 +UNLIMITED: 01: cannot open +UNLIMITED: 20: cannot open +UNLIMITED: 21: cannot open +UNLIMITED: 22: cannot open UNLIMITED-NOT: too many errors emitted, stopping now (use -error-limit=0 to see all errors) Index: test/ELF/invalid-linkerscript.test =================================================================== --- test/ELF/invalid-linkerscript.test +++ test/ELF/invalid-linkerscript.test @@ -9,46 +9,46 @@ # RUN: mkdir -p %t.dir -## Note that we are using "cannot open no-such-file: " as a marker that the +## Note that we are using "no-such-file: cannot open " as a marker that the ## linker keep going when it found an error. That specific error message is not ## related to the linker script tests. # RUN: echo foobar > %t1 # RUN: not ld.lld %t1 no-such-file 2>&1 | FileCheck -check-prefix=ERR1 %s # ERR1: unexpected EOF -# ERR1: cannot open no-such-file: +# ERR1: no-such-file: cannot open # RUN: echo "foo \"bar" > %t2 # RUN: not ld.lld %t2 no-such-file 2>&1 | FileCheck -check-prefix=ERR2 %s # ERR2: unclosed quote -# ERR2: cannot open no-such-file: +# ERR2: no-such-file: cannot open # RUN: echo "/*" > %t3 # RUN: not ld.lld %t3 no-such-file 2>&1 | FileCheck -check-prefix=ERR3 %s # ERR3: unclosed comment -# ERR3: cannot open no-such-file: +# ERR3: no-such-file: cannot open # RUN: echo "EXTERN (" > %t4 # RUN: not ld.lld %t4 no-such-file 2>&1 | FileCheck -check-prefix=ERR4 %s # ERR4: unexpected EOF -# ERR4: cannot open no-such-file: +# ERR4: no-such-file: cannot open # RUN: echo "EXTERN (" > %t5 # RUN: not ld.lld %t5 no-such-file 2>&1 | FileCheck -check-prefix=ERR5 %s # ERR5: unexpected EOF -# ERR5: cannot open no-such-file: +# ERR5: no-such-file: cannot open # RUN: echo "EXTERN xyz" > %t6 # RUN: not ld.lld %t6 no-such-file 2>&1 | FileCheck -check-prefix=ERR6 %s # ERR6: ( expected, but got xyz -# ERR6: cannot open no-such-file: +# ERR6: no-such-file: cannot open # RUN: echo "INCLUDE /no/such/file" > %t7 # RUN: not ld.lld %t7 no-such-file 2>&1 | FileCheck -check-prefix=ERR7 %s # ERR7: cannot open /no/such/file -# ERR7: cannot open no-such-file: +# ERR7: no-such-file: cannot open # RUN: echo "OUTPUT_FORMAT(x y z)" > %t8 # RUN: not ld.lld %t8 no-such-file 2>&1 | FileCheck -check-prefix=ERR8 %s # ERR8: unexpected token: y -# ERR8: cannot open no-such-file: +# ERR8: no-such-file: cannot open Index: test/ELF/reproduce-error.s =================================================================== --- test/ELF/reproduce-error.s +++ test/ELF/reproduce-error.s @@ -6,7 +6,7 @@ # RUN: cd %t.dir # RUN: not ld.lld --reproduce repro abc -o t 2>&1 | FileCheck %s -# CHECK: cannot open abc: {{N|n}}o such file or directory +# CHECK: abc: cannot open: {{N|n}}o such file or directory # RUN: grep TRAILER repro.cpio # RUN: cpio -id < repro.cpio