Patchwork Committed: executable-stack note for CRIS

login
register
mail settings
Submitter Hans-Peter Nilsson
Date July 22, 2012, 3:04 p.m.
Message ID <201207221504.q6MF42L9025950@ignucius.se.axis.com>
Download mbox | patch
Permalink /patch/172518/
State New
Headers show

Comments

Hans-Peter Nilsson - July 22, 2012, 3:04 p.m.
Tested crisv32-linux (much as you can do without actually
installing a new /lib/ld.so.1 with the changed defaults).
Yep, this is actually a change of the default in glibc (port to
be submitted), but changing it this way is safe: with old
libraries lacking a note, they default to not having an
executable stack, as should be.  You pragmatically only need an
executable stack for the gcc test-suite, AFAIK. :)  Committed.
Tested cris-elf and crisv32-elf too with some other patches FWIW.

	Emit executable-stack note correctly for CRIS targets.
	* config/cris/cris.c (cris_file_end): New function.
	(TARGET_ASM_FILE_END): Define.


brgds, H-P

Patch

Index: config/cris/cris.c
===================================================================
--- config/cris/cris.c	(revision 189754)
+++ config/cris/cris.c	(revision 189755)
@@ -153,6 +153,7 @@  static void cris_trampoline_init (rtx, t
 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.  */
@@ -199,6 +200,8 @@  int cris_cpu_version = CRIS_DEFAULT_CPU_
 
 #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
@@ -2747,6 +2750,17 @@  cris_file_start (void)
   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)