From: Rafael Espindola Date: Sun, 23 Jan 2011 17:58:26 +0000 (+0000) Subject: Add support for the --noexecstack option. Fixes PR8762. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3176cca2fe2bb9ab061e8e5fc05b4d59403fcf19;p=clang Add support for the --noexecstack option. Fixes PR8762. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124078 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/CC1AsOptions.td b/include/clang/Driver/CC1AsOptions.td index 821d56e2fb..50472ffdf9 100644 --- a/include/clang/Driver/CC1AsOptions.td +++ b/include/clang/Driver/CC1AsOptions.td @@ -70,3 +70,6 @@ def show_inst : Flag<"-show-inst">, def relax_all : Flag<"-relax-all">, HelpText<"Relax all fixups (for performance testing)">; + +def no_exec_stack : Flag<"--noexecstack">, + HelpText<"Mark the file as not needing an executable stack">; \ No newline at end of file diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index 2eb9ff96f1..1d544f3d3c 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -101,6 +101,7 @@ struct AssemblerInvocation { /// @{ unsigned RelaxAll : 1; + unsigned NoExecStack : 1; /// @} @@ -115,6 +116,7 @@ public: ShowInst = 0; ShowEncoding = 0; RelaxAll = 0; + NoExecStack = 0; } static void CreateFromArgs(AssemblerInvocation &Res, const char **ArgBegin, @@ -193,6 +195,7 @@ void AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, // Assemble Options Opts.RelaxAll = Args->hasArg(OPT_relax_all); + Opts.NoExecStack = Args->hasArg(OPT_no_exec_stack); } static formatted_raw_ostream *GetOutputStream(AssemblerInvocation &Opts, @@ -269,7 +272,7 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) { TM->getTargetLowering()->getObjFileLowering(); const_cast(TLOF).Initialize(Ctx, *TM); - + // FIXME: There is a bit of code duplication with addPassesToEmitFile. if (Opts.OutputType == AssemblerInvocation::FT_Asm) { MCInstPrinter *IP = TheTarget->createMCInstPrinter(Opts.OutputAsmVariant, *MAI); @@ -290,7 +293,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) { MCCodeEmitter *CE = TheTarget->createCodeEmitter(*TM, Ctx); TargetAsmBackend *TAB = TheTarget->createAsmBackend(Opts.Triple); Str.reset(TheTarget->createObjectStreamer(Opts.Triple, Ctx, *TAB, *Out, - CE, Opts.RelaxAll)); + CE, Opts.RelaxAll, + Opts.NoExecStack)); Str.get()->InitSections(); }