This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Cleanup ENABLE_EXECUET_STACK for NetBSD
- From: Matt Thomas <matt at 3am-software dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 11 Apr 2005 21:16:29 -0700
- Subject: [PATCH] Cleanup ENABLE_EXECUET_STACK for NetBSD
I've tested this on x86_64, alpha, i386, sparc, and powerpc under 4.0
and 4.1 (20050407).
2005-04-11 Matt Thomas <matt@3am-software.com>
* config/netbsd.h (NETBSD_ENABLE_EXECUTE_STACK): Rename to
ENABLE_EXECUTE_STACK.
* config/alpha/netbsd.h (ENABLE_EXECUTE_STACK): Remove.
* config/i386/netbsd-elf.h (ENABLE_EXECUTE_STACK): Remove.
* config/i386/netbsd.h (ENABLE_EXECUTE_STACK): Remove.
* config/i386/netbsd64.h (ENABLE_EXECUTE_STACK): Remove.
* config/rs6000/netbsd.h (TRAMPOLINE_SIZE): Redefine if
L_enable_execute_stack is defined.
* config/rs6000/rs6000.c (rs6000_initialize_trampoline): Emit
library call if ENABLE_EXECUTE_STACK is defined.
* config/sparc/netbsd64.h (ENABLE_EXECUTE_STACK): Remove.
Index: gcc/config/netbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/netbsd.h,v
retrieving revision 1.31
diff -c -3 -p -r1.31 netbsd.h
*** gcc/config/netbsd.h 7 Dec 2004 22:47:41 -0000 1.31
--- gcc/config/netbsd.h 12 Apr 2005 03:54:48 -0000
*************** Boston, MA 02111-1307, USA. */
*** 193,199 ****
Also note that no errors should be emitted by this code; it is considered
dangerous for library calls to send messages to stdout/stderr. */
! #define NETBSD_ENABLE_EXECUTE_STACK \
extern void __enable_execute_stack (void *); \
void \
__enable_execute_stack (void *addr) \
--- 193,199 ----
Also note that no errors should be emitted by this code; it is considered
dangerous for library calls to send messages to stdout/stderr. */
! #define ENABLE_EXECUTE_STACK \
extern void __enable_execute_stack (void *); \
void \
__enable_execute_stack (void *addr) \
Index: gcc/config/alpha/netbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/netbsd.h,v
retrieving revision 1.22
diff -c -3 -p -r1.22 netbsd.h
*** gcc/config/alpha/netbsd.h 17 Oct 2004 18:09:36 -0000 1.22
--- gcc/config/alpha/netbsd.h 12 Apr 2005 03:54:48 -0000
*************** Boston, MA 02111-1307, USA. */
*** 74,83 ****
%(netbsd_endfile_spec)"
- /* Attempt to enable execute permissions on the stack. */
-
- #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
-
-
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (NetBSD/alpha ELF)");
--- 74,78 ----
Index: gcc/config/i386/netbsd-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/netbsd-elf.h,v
retrieving revision 1.20
diff -c -3 -p -r1.20 netbsd-elf.h
*** gcc/config/i386/netbsd-elf.h 17 Oct 2004 18:09:39 -0000 1.20
--- gcc/config/i386/netbsd-elf.h 12 Apr 2005 03:54:48 -0000
*************** Boston, MA 02111-1307, USA. */
*** 119,125 ****
we don't care about compatibility with older gcc versions. */
#define DEFAULT_PCC_STRUCT_RETURN 1
- /* Attempt to enable execute permissions on the stack. */
- #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
-
#define TARGET_VERSION fprintf (stderr, " (NetBSD/i386 ELF)");
--- 119,122 ----
Index: gcc/config/i386/netbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/netbsd.h,v
retrieving revision 1.27
diff -c -3 -p -r1.27 netbsd.h
*** gcc/config/i386/netbsd.h 17 Jul 2004 21:09:12 -0000 1.27
--- gcc/config/i386/netbsd.h 12 Apr 2005 03:54:48 -0000
***************
*** 67,72 ****
prefix is added. */
#undef GOT_SYMBOL_NAME
#define GOT_SYMBOL_NAME "GLOBAL_OFFSET_TABLE_"
-
- /* Attempt to enable execute permissions on the stack. */
- #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
--- 67,69 ----
Index: gcc/config/i386/netbsd64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/netbsd64.h,v
retrieving revision 1.11
diff -c -3 -p -r1.11 netbsd64.h
*** gcc/config/i386/netbsd64.h 17 Oct 2004 18:09:39 -0000 1.11
--- gcc/config/i386/netbsd64.h 12 Apr 2005 03:54:48 -0000
*************** Boston, MA 02111-1307, USA. */
*** 67,73 ****
fprintf (FILE, "\tcall __mcount\n"); \
}
- /* Attempt to enable execute permissions on the stack. */
- #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
-
#define TARGET_VERSION fprintf (stderr, " (NetBSD/x86_64 ELF)");
--- 67,70 ----
Index: gcc/config/rs6000/netbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/netbsd.h,v
retrieving revision 1.8
diff -c -3 -p -r1.8 netbsd.h
*** gcc/config/rs6000/netbsd.h 13 Apr 2003 17:51:07 -0000 1.8
--- gcc/config/rs6000/netbsd.h 12 Apr 2005 03:54:48 -0000
***************
*** 89,93 ****
--- 89,99 ----
{ "netbsd_endfile_spec", NETBSD_ENDFILE_SPEC },
+ /* Override TRAMPOLINE_SIZE with the maximum size trampoline in libgcc. */
+ #ifdef L_enable_execute_stack
+ #undef TRAMPOLINE_SIZE
+ #define TRAMPOLINE_SIZE 48
+ #endif
+
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (NetBSD/powerpc ELF)");
Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.788.2.4
diff -c -3 -p -r1.788.2.4 rs6000.c
*** gcc/config/rs6000/rs6000.c 31 Mar 2005 11:39:21 -0000 1.788.2.4
--- gcc/config/rs6000/rs6000.c 12 Apr 2005 03:54:51 -0000
*************** rs6000_initialize_trampoline (rtx addr,
*** 17216,17221 ****
--- 17216,17225 ----
GEN_INT (rs6000_trampoline_size ()), SImode,
fnaddr, pmode,
ctx_reg, pmode);
+ #ifdef ENABLE_EXECUTE_STACK
+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"),
+ LCT_NORMAL, VOIDmode, 1, addr, Pmode);
+ #endif
break;
}
Index: gcc/config/sparc/netbsd-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/netbsd-elf.h,v
retrieving revision 1.27
diff -c -3 -p -r1.27 netbsd-elf.h
*** gcc/config/sparc/netbsd-elf.h 22 Jan 2005 12:53:25 -0000 1.27
--- gcc/config/sparc/netbsd-elf.h 12 Apr 2005 03:54:51 -0000
*************** Boston, MA 02111-1307, USA. */
*** 78,86 ****
#undef STDC_0_IN_SYSTEM_HEADERS
- /* Attempt to enable execute permissions on the stack. */
- #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
-
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
--- 78,83 ----
--
Matt Thomas email: matt@3am-software.com
3am Software Foundry www: http://3am-software.com/bio/matt/
Cupertino, CA disclaimer: I avow all knowledge of this message.