summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Driver/Tools.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 112c61fcbc..7a07b13072 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -25,6 +25,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Config/config.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
@@ -497,10 +498,18 @@ static std::string getARMTargetCPU(const ArgList &Args,
return MCPU;
}
+#ifdef DEFAULT_TARGET_MCPU
+ bool useDefaultCPU = true;
+#else
+ bool useDefaultCPU = false;
+#endif
+
StringRef MArch;
if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
// Otherwise, if we have -march= choose the base CPU for that arch.
MArch = A->getValue();
+ } else if (useDefaultCPU) {
+ return DEFAULT_TARGET_MCPU;
} else {
// Otherwise, use the Arch from the triple.
MArch = Triple.getArchName();