]> granicus.if.org Git - clang/commitdiff
Add support for the --noexecstack option. Fixes PR8762.
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 23 Jan 2011 17:58:26 +0000 (17:58 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 23 Jan 2011 17:58:26 +0000 (17:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124078 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/CC1AsOptions.td
tools/driver/cc1as_main.cpp

index 821d56e2fbea84f092bd1238fb58476548e081d6..50472ffdf9cddc9e02a44be0bc0ddba36e3880fe 100644 (file)
@@ -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
index 2eb9ff96f1d2fb684cca2cb77ce2353bbf5851c8..1d544f3d3c9dd0cc9f109899498c16f62c5b9acb 100644 (file)
@@ -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<TargetLoweringObjectFile&>(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();
   }