From: Simon Atanasyan Date: Sat, 1 Dec 2012 18:27:21 +0000 (+0000) Subject: [MIPS] Add -mxgot/-mno-xgot command line options X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bda07ace55e40bd1a620051156fa9b13ad3936aa;p=clang [MIPS] Add -mxgot/-mno-xgot command line options to enable/disable support of GOT larger than 64k. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169098 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 932e78943d..8e31cab356 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -875,6 +875,8 @@ def mf16c : Flag<["-"], "mf16c">, Group; def mrtm : Flag<["-"], "mrtm">, Group; def mips16 : Flag<["-"], "mips16">, Group; def mno_mips16 : Flag<["-"], "mno-mips16">, Group; +def mxgot : Flag<["-"], "mxgot">, Group; +def mno_xgot : Flag<["-"], "mno-xgot">, Group; def mdsp : Flag<["-"], "mdsp">, Group; def mno_dsp : Flag<["-"], "mno-dsp">, Group; def mdspr2 : Flag<["-"], "mdspr2">, Group; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 89e7d8f16c..16218e1fc5 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -990,6 +990,13 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args, options::OPT_mdspr2, options::OPT_mno_dspr2, "dspr2"); + if (Arg *A = Args.getLastArg(options::OPT_mxgot, options::OPT_mno_xgot)) { + if (A->getOption().matches(options::OPT_mxgot)) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-mxgot"); + } + } + if (Arg *A = Args.getLastArg(options::OPT_G)) { StringRef v = A->getValue(); CmdArgs.push_back("-mllvm"); diff --git a/test/Driver/mips-features.c b/test/Driver/mips-features.c index 28048e7740..3bebffc11b 100644 --- a/test/Driver/mips-features.c +++ b/test/Driver/mips-features.c @@ -38,6 +38,18 @@ // RUN: | FileCheck --check-prefix=CHECK-NOMDSPR2 %s // CHECK-NOMDSPR2: "-target-feature" "-dspr2" // +// -mxgot +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mno-xgot -mxgot 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-XGOT %s +// CHECK-XGOT: "-mllvm" "-mxgot" +// +// -mno-xgot +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mxgot -mno-xgot 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NOXGOT %s +// CHECK-NOXGOT-NOT: "-mllvm" "-mxgot" +// // -G // RUN: %clang -target mips-linux-gnu -### -c %s \ // RUN: -G 16 2>&1 \