r239633 - Driver: only set -mlinker-version based on host if it's valid

Tim Northover tnorthover at apple.com
Fri Jun 12 12:21:35 PDT 2015

Author: tnorthover
Date: Fri Jun 12 14:21:35 2015
New Revision: 239633

URL: http://llvm.org/viewvc/llvm-project?rev=239633&view=rev
Driver: only set -mlinker-version based on host if it's valid

We were adding an extra "-mlinker-version" argument to the invocation
based on a value inferred from "ld -v". This is set by the build
systems to either a sane value or an empty string (e.g. for custom
built ld), which we don't want to pass on.

No test really possible because the value depends on both host system
and how CMake was invoked.


Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=239633&r1=239632&r2=239633&view=diff
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Jun 12 14:21:35 2015
@@ -277,7 +277,8 @@ DerivedArgList *Driver::TranslateInputAr
   // Add a default value of -mlinker-version=, if one was given and the user
   // didn't specify one.
 #if defined(HOST_LINK_VERSION)
-  if (!Args.hasArg(options::OPT_mlinker_version_EQ)) {
+  if (!Args.hasArg(options::OPT_mlinker_version_EQ) &&
+      strlen(HOST_LINK_VERSION) > 0) {
     DAL->AddJoinedArg(0, Opts->getOption(options::OPT_mlinker_version_EQ),

More information about the cfe-commits mailing list