Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Dec 2017 01:19:18 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r326787 - stable/11/contrib/llvm/tools/lld/ELF
Message-ID:  <201712120119.vBC1JIsp056327@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Tue Dec 12 01:19:18 2017
New Revision: 326787
URL: https://svnweb.freebsd.org/changeset/base/326787

Log:
  MFC r326547: 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

Modified:
  stable/11/contrib/llvm/tools/lld/ELF/Driver.cpp
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/llvm/tools/lld/ELF/Driver.cpp
==============================================================================
--- stable/11/contrib/llvm/tools/lld/ELF/Driver.cpp	Tue Dec 12 01:19:08 2017	(r326786)
+++ stable/11/contrib/llvm/tools/lld/ELF/Driver.cpp	Tue Dec 12 01:19:18 2017	(r326787)
@@ -345,9 +345,10 @@ void LinkerDriver::main(ArrayRef<const char *> 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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712120119.vBC1JIsp056327>