diff options
author | obrien <obrien@FreeBSD.org> | 2002-11-05 03:35:56 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-11-05 03:35:56 +0000 |
commit | 522f637a4640589e048e799c026e35055acb0f8f (patch) | |
tree | 0946bb1d3b9db72055bf4aefa009bf5f1a2159da /contrib | |
parent | 0c6061a847ff2b59f49da70141593de25dc9906a (diff) | |
download | FreeBSD-src-522f637a4640589e048e799c026e35055acb0f8f.zip FreeBSD-src-522f637a4640589e048e799c026e35055acb0f8f.tar.gz |
Sync with the stock FSF 3.2 file. This adds TRANSFER_FROM_TRAMPOLINE,
which is needed in order for nexted C functions to work.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/gcc/config/sparc/freebsd.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/gcc/config/sparc/freebsd.h b/contrib/gcc/config/sparc/freebsd.h index b6971f5..6ee5f52 100644 --- a/contrib/gcc/config/sparc/freebsd.h +++ b/contrib/gcc/config/sparc/freebsd.h @@ -26,6 +26,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #undef CPP_CPU64_DEFAULT_SPEC #define CPP_CPU64_DEFAULT_SPEC "-D__sparc64__ -D__sparc_v9__ -D__arch64__" +/* Because we include sparc/sysv4.h. */ #undef CPP_PREDEFINES #define CPP_PREDEFINES FBSD_CPP_PREDEFINES @@ -102,6 +103,31 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #undef SPARC_DEFAULT_CMODEL #define SPARC_DEFAULT_CMODEL CM_MEDLOW +#define TRANSFER_FROM_TRAMPOLINE \ + static int need_enable_exec_stack; \ + static void check_enabling(void) __attribute__ ((constructor)); \ + static void check_enabling(void) \ + { \ + extern int sysctlbyname(const char *, void *, size_t *, void *, size_t);\ + int prot = 0; \ + size_t len = sizeof(prot); \ + \ + sysctlbyname ("kern.stackprot", &prot, &len, NULL, 0); \ + if (prot != 7) \ + need_enable_exec_stack = 1; \ + } \ + extern void __enable_execute_stack (void *); \ + void __enable_execute_stack (void *addr) \ + { \ + if (!need_enable_exec_stack) \ + return; \ + else { \ + /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ + if (mprotect (addr, TRAMPOLINE_SIZE, 7) < 0) \ + perror ("mprotect of trampoline code"); \ + } \ + } + /************************[ Assembler stuff ]********************************/ |