+2012-07-22  Hans-Peter Nilsson  <hp@axis.com>
+
+       Emit executable-stack note correctly for CRIS targets.
+       * config/cris/cris.c (cris_file_end): New function.
+       (TARGET_ASM_FILE_END): Define.
+
 2012-07-22  Chung-Lin Tang  <cltang@codesourcery.com>
            Maxim Kuvyrkov  <maxim@codesourcery.com>
            NetLogic Microsystems Inc.
 
 static rtx cris_function_value(const_tree, const_tree, bool);
 static rtx cris_libcall_value (enum machine_mode, const_rtx);
 static bool cris_function_value_regno_p (const unsigned int);
+static void cris_file_end (void);
 
 /* This is the parsed result of the "-max-stack-stackframe=" option.  If
    it (still) is zero, then there was no such option given.  */
 
 #undef TARGET_ASM_FILE_START
 #define TARGET_ASM_FILE_START cris_file_start
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END cris_file_end
 
 #undef TARGET_INIT_LIBFUNCS
 #define TARGET_INIT_LIBFUNCS cris_init_libfuncs
   default_file_start ();
 }
 
+/* Output that goes at the end of the file, similarly.  */
+
+static void
+cris_file_end (void)
+{
+  /* For CRIS, the default is to assume *no* executable stack, so output
+     an executable-stack-note only when needed.  */
+  if (TARGET_LINUX && trampolines_created)
+    file_end_indicate_exec_stack ();
+}
+
 /* Rename the function calls for integer multiply and divide.  */
 static void
 cris_init_libfuncs (void)