[mips] Add -mabicalls/-mno-abicalls to the driver

Based on a patch by Matheus Almeida. I've added testcases and fixed a bug where
the options weren't passed on to GAS.

llvm-svn: 215204
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 86a05cd..303d115 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1040,6 +1040,13 @@
   Features.push_back("-n64");
   Features.push_back(Args.MakeArgString(ABIFeature));
 
+  // Preserve the current default.
+  // FIXME: This ought to depend on Triple.getOS()
+  Features.push_back(Args.MakeArgString("+abicalls"));
+
+  AddTargetFeature(Args, Features, options::OPT_mabicalls,
+                   options::OPT_mno_abicalls, "abicalls");
+
   StringRef FloatABI = getMipsFloatABI(D, Args);
   if (FloatABI == "soft") {
     // FIXME: Note, this is a hack. We need to pass the selected float
@@ -7098,6 +7105,11 @@
     CmdArgs.push_back("-mabi");
     CmdArgs.push_back(ABIName.data());
 
+    // Preserve the current default
+    // FIXME: This ought to depend on Triple.getOS().
+    CmdArgs.push_back("-mabicalls");
+    Args.AddLastArg(CmdArgs, options::OPT_mabicalls, options::OPT_mno_abicalls);
+
     // -mno-shared should be emitted unless -fpic, -fpie, -fPIC, -fPIE,
     // or -mshared (not implemented) is in effect.
     bool IsPicOrPie = false;