aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Driver/Tools.cpp7
-rw-r--r--test/Driver/mips-features.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 11429131d7..ccfa69a739 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -941,6 +941,13 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args,
AddTargetFeature(Args, CmdArgs,
options::OPT_mdspr2, options::OPT_mno_dspr2,
"dspr2");
+
+ if (Arg *A = Args.getLastArg(options::OPT_G)) {
+ StringRef v = A->getValue(Args);
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back(Args.MakeArgString("-mips-ssection-threshold=" + v));
+ A->claim();
+ }
}
/// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting.
diff --git a/test/Driver/mips-features.c b/test/Driver/mips-features.c
index 5be2683188..28048e7740 100644
--- a/test/Driver/mips-features.c
+++ b/test/Driver/mips-features.c
@@ -37,3 +37,9 @@
// RUN: -mdspr2 -mno-dspr2 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NOMDSPR2 %s
// CHECK-NOMDSPR2: "-target-feature" "-dspr2"
+//
+// -G
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN: -G 16 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-MIPS-G %s
+// CHECK-MIPS-G: "-mllvm" "-mips-ssection-threshold=16"