[cfe-commits] r133489 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Frontend/CodeGenOptions.h lib/CodeGen/BackendUtil.cpp lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/Driver/noexecstack.c
Chandler Carruth
chandlerc at google.com
Mon Jun 20 18:09:48 PDT 2011
On Mon, Jun 20, 2011 at 5:14 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
> Author: nicholas
> Date: Mon Jun 20 19:14:18 2011
> New Revision: 133489
>
> URL: http://llvm.org/viewvc/llvm-project?rev=133489&view=rev
> Log:
> Add support for -Wa,--noexecstack when building from a non-assembly file.
> For
> an assembly file it worked correctly, while for a .c file it would given an
> error about how --noexecstack is not a supported argument to -Wa.
>
> Added:
> cfe/trunk/test/Driver/noexecstack.c
> Modified:
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Frontend/CodeGenOptions.h
> cfe/trunk/lib/CodeGen/BackendUtil.cpp
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>
> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=133489&r1=133488&r2=133489&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
> +++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Jun 20 19:14:18 2011
> @@ -157,6 +157,8 @@
> HelpText<"The float ABI to use">;
> def mlimit_float_precision : Separate<"-mlimit-float-precision">,
> HelpText<"Limit float precision to the given value">;
> +def mno_exec_stack : Flag<"-mnoexecstack">,
>
-mno-exec-stack or -mno-execstack would be more consistent with the rest of
these flags... If 'noexecstack' is important to have as a single word, then
the def should be 'mnoexecstack' to match.
> + HelpText<"Mark the file as not needing an executable stack">;
>
Does this mark it as not needing an executable stack, or require it to have
a non-executable stack? That is, does this flag trump?
> def mno_zero_initialized_in_bss : Flag<"-mno-zero-initialized-in-bss">,
> HelpText<"Do not put zero initialized data in the BSS">;
> def momit_leaf_frame_pointer : Flag<"-momit-leaf-frame-pointer">,
>
> Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.h?rev=133489&r1=133488&r2=133489&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Frontend/CodeGenOptions.h (original)
> +++ cfe/trunk/include/clang/Frontend/CodeGenOptions.h Mon Jun 20 19:14:18
> 2011
> @@ -70,6 +70,7 @@
> unsigned MergeAllConstants : 1; /// Merge identical constants.
> unsigned NoCommon : 1; /// Set when -fno-common or C++ is
> enabled.
> unsigned NoDwarf2CFIAsm : 1; /// Set when -fno-dwarf2-cfi-asm is
> enabled.
> + unsigned NoExecStack : 1; /// Set when -Wa,--noexecstack is
> enabled.
> unsigned NoImplicitFloat : 1; /// Set when -mno-implicit-float is
> enabled.
> unsigned NoInfsFPMath : 1; /// Assume FP arguments, results not
> +-Inf.
> unsigned NoNaNsFPMath : 1; /// Assume FP arguments, results not NaN.
>
> Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=133489&r1=133488&r2=133489&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
> +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Mon Jun 20 19:14:18 2011
> @@ -275,6 +275,8 @@
> TM->setMCSaveTempLabels(true);
> if (CodeGenOpts.NoDwarf2CFIAsm)
> TM->setMCUseCFI(false);
> + if (CodeGenOpts.NoExecStack)
> + TM->setMCNoExecStack(true);
>
> // Create the code generator passes.
> PassManager *PM = getCodeGenPasses();
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=133489&r1=133488&r2=133489&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Mon Jun 20 19:14:18 2011
> @@ -1051,6 +1051,8 @@
> } else if (Value == "--fatal-warnings") {
> CmdArgs.push_back("-mllvm");
> CmdArgs.push_back("-fatal-assembler-warnings");
> + } else if (Value == "--noexecstack") {
> + CmdArgs.push_back("-mnoexecstack");
> } else {
> D.Diag(clang::diag::err_drv_unsupported_option_argument)
> << A->getOption().getName() << Value;
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=133489&r1=133488&r2=133489&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Jun 20 19:14:18 2011
> @@ -201,6 +201,8 @@
> Res.push_back("-mregparm");
> Res.push_back(llvm::utostr(Opts.NumRegisterParameters));
> }
> + if (Opts.NoExecStack)
> + Res.push_back("-mnoexecstack");
> if (Opts.RelaxAll)
> Res.push_back("-mrelax-all");
> if (Opts.SaveTempLabels)
> @@ -982,6 +984,7 @@
> Opts.NoZeroInitializedInBSS =
> Args.hasArg(OPT_mno_zero_initialized_in_bss);
> Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);
> Opts.NumRegisterParameters = Args.getLastArgIntValue(OPT_mregparm, 0,
> Diags);
> + Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);
> Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
> Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
> Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
>
> Added: cfe/trunk/test/Driver/noexecstack.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/noexecstack.c?rev=133489&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/Driver/noexecstack.c (added)
> +++ cfe/trunk/test/Driver/noexecstack.c Mon Jun 20 19:14:18 2011
> @@ -0,0 +1 @@
> +// RUN: clang -### %s -c -o tmp.o -Wa,--noexecstack | grep "-mnoexecstack"
>
Are there no other exec stack tests that can be combined here? Essentially
wondering if we can use '-x ...' instead of autodetection and a bunch of
separate test cases.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110620/143005d3/attachment.html>
More information about the cfe-commits
mailing list