Author: kib
Date: Fri Jan 14 11:31:22 2011
New Revision: 217396
URL: http://svn.freebsd.org/changeset/base/217396

Log:
  Configure gcc to emit .note.GNU-stack for both 32 and 64 bits PowerPC.
  Mark gcc-provided asm files as not requiring executable stack.
  
  It seems that non-FreeBSD ABIs for powerpc64 claim stack non-executable.
  Due to this, rs6000_elf_end_indicate_exec_stack() only emit the note for
  32 bit target. I decided not to change FreeBSD ABI and patch
  emit the notes for both variants.
  
  Reviewed and tested by:       nwhitehorn

Modified:
  head/contrib/gcc/config/rs6000/crtsavres.asm
  head/contrib/gcc/config/rs6000/freebsd.h
  head/contrib/gcc/config/rs6000/rs6000.c
  head/contrib/gcc/config/rs6000/tramp.asm

Modified: head/contrib/gcc/config/rs6000/crtsavres.asm
==============================================================================
--- head/contrib/gcc/config/rs6000/crtsavres.asm        Fri Jan 14 11:28:34 
2011        (r217395)
+++ head/contrib/gcc/config/rs6000/crtsavres.asm        Fri Jan 14 11:31:22 
2011        (r217396)
@@ -305,3 +305,5 @@ FUNC_END(_restgpr_15_x)
 FUNC_END(_restgpr_14_x)
 
 #endif
+
+       .section .note.GNU-stack,"",%progbits

Modified: head/contrib/gcc/config/rs6000/freebsd.h
==============================================================================
--- head/contrib/gcc/config/rs6000/freebsd.h    Fri Jan 14 11:28:34 2011        
(r217395)
+++ head/contrib/gcc/config/rs6000/freebsd.h    Fri Jan 14 11:31:22 2011        
(r217396)
@@ -230,6 +230,8 @@
       }
 #endif
 
+#define TARGET_ASM_FILE_END rs6000_elf_end_indicate_exec_stack
+
 /* FreeBSD doesn't support saving and restoring 64-bit regs with a 32-bit
    kernel. This is supported when running on a 64-bit kernel with
    COMPAT_FREEBSD32, but tell GCC it isn't so that our 32-bit binaries
@@ -242,3 +244,5 @@
 #define PROFILE_HOOK(LABEL) \
   do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
 
+#undef NEED_INDICATE_EXEC_STACK
+#define NEED_INDICATE_EXEC_STACK 1

Modified: head/contrib/gcc/config/rs6000/rs6000.c
==============================================================================
--- head/contrib/gcc/config/rs6000/rs6000.c     Fri Jan 14 11:28:34 2011        
(r217395)
+++ head/contrib/gcc/config/rs6000/rs6000.c     Fri Jan 14 11:31:22 2011        
(r217396)
@@ -18426,7 +18426,7 @@ rs6000_elf_declare_function_name (FILE *
 static void
 rs6000_elf_end_indicate_exec_stack (void)
 {
-  if (TARGET_32BIT)
+  if (NEED_INDICATE_EXEC_STACK)
     file_end_indicate_exec_stack ();
 }
 #endif

Modified: head/contrib/gcc/config/rs6000/tramp.asm
==============================================================================
--- head/contrib/gcc/config/rs6000/tramp.asm    Fri Jan 14 11:28:34 2011        
(r217395)
+++ head/contrib/gcc/config/rs6000/tramp.asm    Fri Jan 14 11:31:22 2011        
(r217396)
@@ -115,3 +115,5 @@ FUNC_START(__trampoline_setup)
 FUNC_END(__trampoline_setup)
 
 #endif
+
+       .section .note.GNU-stack,"",%progbits
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to