From owner-svn-src-all@freebsd.org Tue Dec 5 01:47:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0697FE73745; Tue, 5 Dec 2017 01:47:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C781C3B6D; Tue, 5 Dec 2017 01:47:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB51lfTX018705; Tue, 5 Dec 2017 01:47:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB51lf7Y018704; Tue, 5 Dec 2017 01:47:41 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201712050147.vB51lf7Y018704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 5 Dec 2017 01:47:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326547 - head/contrib/llvm/tools/lld/ELF X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 326547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2017 01:47:43 -0000 Author: emaste Date: Tue Dec 5 01:47:41 2017 New Revision: 326547 URL: https://svnweb.freebsd.org/changeset/base/326547 Log: lld: make -v behave similarly to GNU ld.bfd Previously, lld exited with an error status if the only option given to the command was -v. GNU linkers gracefully exit in that case. This patch makes lld behave like GNU. Note that even with this patch, lld's -v and --version options behave slightly differently than GNU linkers' counterparts. For example, if you run ld.bfd -v -v, the version string is printed out twice. But that is an edge case that I don't think we need to take care of. Fixes https://bugs.llvm.org/show_bug.cgi?id=31582 Obtained from: LLVM r319717 MFC after: 1 week Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Driver.cpp Tue Dec 5 01:35:04 2017 (r326546) +++ head/contrib/llvm/tools/lld/ELF/Driver.cpp Tue Dec 5 01:47:41 2017 (r326547) @@ -345,9 +345,10 @@ void LinkerDriver::main(ArrayRef ArgsArr if (Args.hasArg(OPT_v) || Args.hasArg(OPT_version)) message(getLLDVersion() + " (compatible with GNU linkers)"); - // ld.bfd always exits after printing out the version string. - // ld.gold proceeds if a given option is -v. Because gold's behavior - // is more permissive than ld.bfd, we chose what gold does here. + // The behavior of -v or --version is a bit strange, but this is + // needed for compatibility with GNU linkers. + if (Args.hasArg(OPT_v) && !Args.hasArg(OPT_INPUT)) + return; if (Args.hasArg(OPT_version)) return;