]> granicus.if.org Git - clang/commitdiff
Driver: only set -mlinker-version based on host if it's valid
authorTim Northover <tnorthover@apple.com>
Fri, 12 Jun 2015 19:21:35 +0000 (19:21 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 12 Jun 2015 19:21:35 +0000 (19:21 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239633 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp

index 5b34f9842dcd3ee22ffc77791f46bd2392e81c56..a8d084f1a6bbca493e80e57ab7ff4fa943ddb926 100644 (file)
@@ -277,7 +277,8 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
   // 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),
                       HOST_LINK_VERSION);
     DAL->getLastArg(options::OPT_mlinker_version_EQ)->claim();