From: Evan Cheng Date: Fri, 8 Apr 2011 18:47:41 +0000 (+0000) Subject: Add -mtrap_function=<> option. rdar://9257465 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b20e442b31287b7e926a118dec36bddc34dbe730;p=clang Add -mtrap_function=<> option. rdar://9257465 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129145 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index e4f88bc619..9eac83536b 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -542,6 +542,8 @@ def mssse3 : Flag<"-mssse3">, Group; def maes : Flag<"-maes">, Group; def mavx : Flag<"-mavx">, Group; def mthumb : Flag<"-mthumb">, Group; +def mtrap_function_EQ : Joined<"-mtrap-function=">, Group, + HelpText<"Issue call to specified function rather than a trap instruction">; def mtune_EQ : Joined<"-mtune=">, Group; def multi__module : Flag<"-multi_module">; def multiply__defined__unused : Separate<"-multiply_defined_unused">; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 9e0eab35f7..29f8f8356b 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -605,6 +605,17 @@ void Clang::AddARMTargetArgs(const ArgList &Args, CmdArgs.push_back("-neon"); } + // Forward -mtrap_function= options to the backend. + for (arg_iterator it = Args.filtered_begin(options::OPT_mtrap_function_EQ), + ie = Args.filtered_end(); it != ie; ++it) { + const Arg *A = *it; + A->claim(); + assert(A->getNumValues() == 1 && "-mtrap_function= expects one argument."); + llvm::StringRef FuncName = A->getValue(Args, 0); + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back(Args.MakeArgString("-arm-trap-func=" + FuncName)); + } + // Kernel code has more strict alignment requirements. if (KernelOrKext) { CmdArgs.push_back("-backend-option");