diff options
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config.gcc | 12 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/i386/openbsd.h | 16 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/i386/openbsd64.h | 4 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/openbsd.h | 4 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h | 53 |
5 files changed, 16 insertions, 73 deletions
diff --git a/gnu/usr.bin/gcc/gcc/config.gcc b/gnu/usr.bin/gcc/gcc/config.gcc index 84946c8c590..d53f1ea2ab3 100644 --- a/gnu/usr.bin/gcc/gcc/config.gcc +++ b/gnu/usr.bin/gcc/gcc/config.gcc @@ -589,6 +589,7 @@ alpha*-*-netbsd*) alpha*-*-openbsd*) tm_file="alpha/alpha.h alpha/elf.h alpha/openbsd1.h openbsd.h ${tm_file}" + tm_file="${tm_file} exec-stack.h" # default x-alpha is only appropriate for dec-osf. target_cpu_default="MASK_GAS" tmake_file="alpha/t-alpha alpha/t-ieee" @@ -704,6 +705,7 @@ arm*-*-netbsdelf*) ;; arm*-*-openbsd*) tm_file="dbxelf.h elfos.h arm/openbsd1.h arm/elf.h arm/aout.h arm/arm.h openbsd.h ${tm_file}" + tm_file="${tm_file} exec-stack.h" tmake_file="${tmake_file} arm/t-openbsd" ;; arm*-*-netbsd*) @@ -839,6 +841,7 @@ hppa*-*-openbsd*) hppa1.1-*-pro*) target_cpu_default="(MASK_JUMP_IN_DELAY | MASK_PORTABLE_RUNTIME | MASK_GAS | MASK_NO_SPACE_REGS | MASK_SOFT_FLOAT)" tm_file="${tm_file} pa/pa32-regs.h dbxelf.h elfos.h pa/elf.h pa/pa-pro-end.h libgloss.h" + tm_file="${tm_file} exec-stack.h" tmake_file="pa/t-bsd pa/t-pro" xmake_file="pa/x-ada" ;; @@ -1176,6 +1179,7 @@ i[34567]86-*-openbsd*) ;; x86_64-*-openbsd*) tm_file="i386/biarch64.h i386/i386.h i386/unix.h i386/att.h dbxelf.h elfos.h openbsd.h openbsd-libpthread.h i386/x86-64.h i386/openbsd64.h" + tm_file="${tm_file} exec-stack.h" tmake_file="t-libc-ok t-openbsd i386/t-openbsd" ;; i[34567]86-*-coff*) @@ -1740,6 +1744,7 @@ m68k*-*-openbsd*) tmake_file="t-libc-ok t-openbsd m68k/t-openbsd" # we need collect2 until our bug is fixed... use_collect2=yes + tm_file="${tm_file} exec-stack.h" ;; m68k-*-sysv4*) # Motorola m68k's running system V.4 tm_file=m68k/m68kv4.h @@ -1791,6 +1796,7 @@ m88k-*-aout*) m88k-*-openbsd*) tmake_file="${tmake_file} m88k/t-luna-gas" tm_file="m88k/aout-dbx.h aoutos.h m88k/m88k.h openbsd.h ${tm_file}" + tm_file="${tm_file} exec-stack.h" ;; m88k-*-sysv4*) xm_defines=POSIX @@ -1924,10 +1930,12 @@ mips*-*-linux*) # Linux MIPS, either endian. ;; mips*el-*-openbsd*) # mips little endian target_cpu_default="MASK_GAS|MASK_ABICALLS" + tm_file="${tm_file} exec-stack.h" ;; mips*-*-openbsd*) # mips big endian target_cpu_default="MASK_GAS|MASK_ABICALLS" tm_file="mips/openbsd-be.h ${tm_file}" + tm_file="${tm_file} exec-stack.h" ;; mips-*-ecoff* | mipsel-*-ecoff*) if test x$stabs = xyes; then @@ -2047,6 +2055,7 @@ romp-*-openbsd*) powerpc-*-openbsd*) tm_file="rs6000/rs6000.h rs6000/openbsd1.h dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h openbsd.h ${tm_file}" tmake_file="${tmake_file} rs6000/t-ppcos rs6000/t-openbsd" + tm_file="${tm_file} exec-stack.h" ;; powerpc64-*-linux*) tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux64.h" @@ -2427,6 +2436,7 @@ sparc-*-netbsd*) ;; sparc-*-openbsd*) tm_file="sparc/sparc.h elfos.h svr4.h sparc/sysv4.h ${tm_file}" + tm_file="${tm_file} exec-stack.h" # needed to unconfuse gdb tmake_file="t-libc-ok t-openbsd sparc/t-openbsd" # we need collect2 until our bug is fixed... @@ -2435,6 +2445,7 @@ sparc-*-openbsd*) ;; sparc64-*-openbsd*) tm_file="sparc/openbsd1-64.h sparc/sparc.h elfos.h svr4.h sparc/sysv4.h sparc/sp64-elf.h openbsd.h ${openbsd_libspec} sparc/openbsd64.h" + tm_file="${tm_file} exec-stack.h" xm_file=sparc/xm-sp64.h gas=yes gnu_ld=yes with_cpu=ultrasparc @@ -2748,6 +2759,7 @@ vax-*-netbsd*) ;; vax-*-openbsd*) tm_file="vax/vax.h vax/openbsd1.h openbsd.h ${tm_file}" + tm_file="${tm_file} exec-stack.h" use_collect2=yes ;; vax-*-ultrix*) # VAXen running ultrix diff --git a/gnu/usr.bin/gcc/gcc/config/i386/openbsd.h b/gnu/usr.bin/gcc/gcc/config/i386/openbsd.h index fb04c4e6d6c..f2f0f424f95 100644 --- a/gnu/usr.bin/gcc/gcc/config/i386/openbsd.h +++ b/gnu/usr.bin/gcc/gcc/config/i386/openbsd.h @@ -97,19 +97,3 @@ Boston, MA 02111-1307, USA. */ /* OpenBSD gas currently does not support quad, so do not use it. */ #undef ASM_QUAD - -#define TRANSFER_FROM_TRAMPOLINE \ -extern void __enable_execute_stack (void *); \ -void \ -__enable_execute_stack (addr) \ - void *addr; \ -{ \ - long size = getpagesize (); \ - long mask = ~(size-1); \ - char *page = (char *) (((long) addr) & mask); \ - char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ - \ - /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ - if (mprotect (page, end - page, 7) < 0) \ - perror ("mprotect of trampoline code"); \ -} diff --git a/gnu/usr.bin/gcc/gcc/config/i386/openbsd64.h b/gnu/usr.bin/gcc/gcc/config/i386/openbsd64.h index 14819f58f0d..97214c3c399 100644 --- a/gnu/usr.bin/gcc/gcc/config/i386/openbsd64.h +++ b/gnu/usr.bin/gcc/gcc/config/i386/openbsd64.h @@ -119,7 +119,3 @@ Boston, MA 02111-1307, USA. */ #undef JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) - -/* pick up defines for mprotect (used in TRANSFER_FROM_TRANPOLINE) */ -#include <sys/types.h> -#include <sys/mman.h> diff --git a/gnu/usr.bin/gcc/gcc/config/openbsd.h b/gnu/usr.bin/gcc/gcc/config/openbsd.h index b6daf8521f0..8ccc385000d 100644 --- a/gnu/usr.bin/gcc/gcc/config/openbsd.h +++ b/gnu/usr.bin/gcc/gcc/config/openbsd.h @@ -319,3 +319,7 @@ do { \ * them easier to spot in the object files. */ #define NO_UNSAFE_BUILTINS + +/* pick up defines for mprotect (used in TRANSFER_FROM_TRAMPOLINE) */ +#include <sys/types.h> +#include <sys/mman.h> diff --git a/gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h b/gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h index af70b6cefc3..b5b3b92feac 100644 --- a/gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h +++ b/gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h @@ -176,56 +176,3 @@ Boston, MA 02111-1307, USA. */ = init_one_libfunc (TARGET_ARCH64 ? "__dtol" : "__dtoll"); \ fixunsdfdi_libfunc \ = init_one_libfunc (TARGET_ARCH64 ? "__dtoul" : "__dtoull") - - -/* - * Attempt to turn on access permissions for the stack. - * - * This code must be defined when compiling gcc but not when compiling - * libgcc2.a, unless we're generating code for 64 bits SPARC - * - * _SC_STACK_PROT is only defined for post 2.6, but we want this code - * to run always. 2.6 can change the stack protection but has no way to - * query it. - * - */ - -/* This declares mprotect (used in TRANSFER_FROM_TRAMPOLINE) for - libgcc2.c. */ -/* We don't want to include this because sys/mman.h is not present on - some non-Solaris configurations that use sol2.h. */ -#if 0 /* def L_trampoline */ -#include <sys/mman.h> -#endif - -#define TRANSFER_FROM_TRAMPOLINE \ -static int need_enable_exec_stack; \ - \ -static void check_enabling(void) __attribute__ ((constructor)); \ -static void check_enabling(void) \ -{ \ - extern long sysconf(int); \ - \ - int prot = (int) sysconf(515 /*_SC_STACK_PROT */); \ - if (prot != 7) \ - need_enable_exec_stack = 1; \ -} \ - \ -extern void __enable_execute_stack (void *); \ -void \ -__enable_execute_stack (addr) \ - void *addr; \ -{ \ - if (!need_enable_exec_stack) \ - return; \ - else { \ - long size = getpagesize (); \ - long mask = ~(size-1); \ - char *page = (char *) (((long) addr) & mask); \ - char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ - \ - /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ - if (mprotect (page, end - page, 7) < 0) \ - perror ("mprotect of trampoline code"); \ - } \ -} |