From: obrien Date: Thu, 31 Oct 2002 09:08:11 +0000 (+0000) Subject: 2002-10-31 David O'Brien X-Git-Tag: upstream/4.9.2~83638 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a827a991fe1cb3a7f74cf8506f59e65fb43683db;p=platform%2Fupstream%2Flinaro-gcc.git 2002-10-31 David O'Brien * config/sparc/freebsd.h (TRANSFER_FROM_TRAMPOLINE): Define __enable_execute_stack function. Approved by: David S. Miller Message-Id: <20021031.005015.22856738.davem@redhat.com> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58674 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 69c735e..15eaa39 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-10-31 David O'Brien + + * config/sparc/freebsd.h (TRANSFER_FROM_TRAMPOLINE): Define + __enable_execute_stack function. + 2002-10-30 Aldy Hernandez * c-common.c: Add GTY to vector_type_node_list. diff --git a/gcc/config/sparc/freebsd.h b/gcc/config/sparc/freebsd.h index 8149923..73155ae 100644 --- a/gcc/config/sparc/freebsd.h +++ b/gcc/config/sparc/freebsd.h @@ -96,6 +96,37 @@ 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);\ + size_t len; \ + int prot; \ + \ + prot = 0; \ + 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 (addr) \ + 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 ]********************************/