Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -290,8 +290,10 @@ printHelp(ArgsArr[0]); return; } - if (Args.hasArg(OPT_version)) + if (Args.hasArg(OPT_version)) { outs() << getLLDVersion() << "\n"; + exitLld(0); + } Config->ExitEarly = CanExitEarly && !Args.hasArg(OPT_full_shutdown); if (const char *Path = getReproduceOption(Args)) { Index: test/ELF/driver.test =================================================================== --- test/ELF/driver.test +++ test/ELF/driver.test @@ -16,7 +16,7 @@ # RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s # HELP: USAGE: -# RUN: not ld.lld --version 2>&1 | FileCheck -check-prefix=VERSION %s +# RUN: ld.lld --version 2>&1 | FileCheck -check-prefix=VERSION %s # VERSION: LLD ## Attempt to link DSO with -r