aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/netbsd.h
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2011-06-09 12:30:46 +0000
committerRainer Orth <ro@gcc.gnu.org>2011-06-09 12:30:46 +0000
commit10e48e3927a74bf7b2ec7a1b68fb840f4b1be588 (patch)
treed044985af6a76f58c9fe909ce81f475be183312a /gcc/config/netbsd.h
parent9ef0b98eb62b22e291e4cca4537d64ea2b795c14 (diff)
downloadgcc-10e48e3927a74bf7b2ec7a1b68fb840f4b1be588.zip
gcc-10e48e3927a74bf7b2ec7a1b68fb840f4b1be588.tar.gz
gcc-10e48e3927a74bf7b2ec7a1b68fb840f4b1be588.tar.bz2
netbsd.h (ENABLE_EXECUTE_STACK): Remove.
2011-05-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> Joseph Myers <joseph@codesourcery.com> gcc: * config/alpha/netbsd.h (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. * config/alpha/osf5.h (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. * config/darwin.h (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. * config/i386/mingw32.h (MINGW_ENABLE_EXECUTE_STACK): Remove. (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. [IN_LIBGCC2]: Don't include <windows.h>. * config/i386/netbsd-elf.h (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. * config/i386/netbsd64.h (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. * config/netbsd.h (NETBSD_ENABLE_EXECUTE_STACK): Remove. * config/openbsd.h (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. * config/sol2.h (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. * config/sparc/freebsd.h (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. * config/sparc/netbsd-elf.h (ENABLE_EXECUTE_STACK): Remove. (HAVE_ENABLE_EXECUTE_STACK): Define. * config/alpha/alpha.c (alpha_trampoline_init): Test HAVE_ENABLE_EXECUTE_STACK. * config/i386/i386.c (ix86_trampoline_init): Likewise. * config/sparc/sparc.c (sparc32_initialize_trampoline): Likewise. (sparc64_initialize_trampoline): Likewise. * libgcc2.c [L_enable_execute_stack]: Remove. * system.h (ENABLE_EXECUTE_STACK): Poison. * doc/tm.texi.in (Trampolines, ENABLE_EXECUTE_STACK): Remove. * doc/tm.texi: Regenerate. * Makefile.in (LIBGCC2_CFLAGS): Add -fbuilding-libgcc. gcc/c-family: * c.opt (fbuilding-libgcc): New option. * c-cppbuiltin.c (c_cpp_builtins): Define __LIBGCC_TRAMPOLINE_SIZE__ if flag_building_libgcc. libgcc: * enable-execute-stack-empty.c: New file. * enable-execute-stack-mprotect.c: New file. * config/i386/enable-execute-stack-mingw32.c: New file. * config.host (enable_execute_stack): New variable. Select appropriate variants. * configure.ac: Link enable-execute-stack.c to $enable_execute_stack. * configure: Regenerate. * Makefile.in (LIB2ADD): Add enable-execute-stack.c. (lib2funcs): Remove _enable_execute_stack. Co-Authored-By: Joseph Myers <joseph@codesourcery.com> From-SVN: r174843
Diffstat (limited to 'gcc/config/netbsd.h')
-rw-r--r--gcc/config/netbsd.h49
1 files changed, 1 insertions, 48 deletions
diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h
index ddf6567..e9290c2 100644
--- a/gcc/config/netbsd.h
+++ b/gcc/config/netbsd.h
@@ -1,6 +1,6 @@
/* Base configuration file for all NetBSD targets.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2007, 2009, 2010 Free Software Foundation, Inc.
+ 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -173,50 +173,3 @@ along with GCC; see the file COPYING3. If not see
#undef WINT_TYPE
#define WINT_TYPE "int"
-
-
-/* Attempt to turn on execute permission for the stack. This may be
- used by TARGET_TRAMPOLINE_INIT if the target needs it (that is,
- if the target machine can change execute permissions on a page).
-
- There is no way to query the execute permission of the stack, so
- we always issue the mprotect() call.
-
- Note that we go out of our way to use namespace-non-invasive calls
- here. Unfortunately, there is no libc-internal name for mprotect().
-
- 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) \
-{ \
- extern int mprotect (void *, size_t, int); \
- extern int __sysctl (int *, unsigned int, void *, size_t *, \
- void *, size_t); \
- \
- static int size; \
- static long mask; \
- \
- char *page, *end; \
- \
- if (size == 0) \
- { \
- int mib[2]; \
- size_t len; \
- \
- mib[0] = 6; /* CTL_HW */ \
- mib[1] = 7; /* HW_PAGESIZE */ \
- len = sizeof (size); \
- (void) __sysctl (mib, 2, &size, &len, NULL, 0); \
- mask = ~((long) size - 1); \
- } \
- \
- page = (char *) (((long) addr) & mask); \
- end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
- \
- /* 7 == PROT_READ | PROT_WRITE | PROT_EXEC */ \
- (void) mprotect (page, end - page, 7); \
-}