freebsd.h (TRANSFER_FROM_TRAMPOLINE): Define __enable_execute_stack function.

2002-10-31  David O'Brien  <obrien@FreeBSD.org>
	* config/sparc/freebsd.h (TRANSFER_FROM_TRAMPOLINE): Define
	__enable_execute_stack function.

Approved by:  David S. Miller <davem@redhat.com>
              Message-Id: <20021031.005015.22856738.davem@redhat.com>

From-SVN: r58674
This commit is contained in:
David O'Brien 2002-10-31 09:08:11 +00:00 committed by David O'Brien
parent 0d55d45aa5
commit e8e4c876bc
2 changed files with 36 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2002-10-31 David O'Brien <obrien@FreeBSD.org>
* config/sparc/freebsd.h (TRANSFER_FROM_TRAMPOLINE): Define
__enable_execute_stack function.
2002-10-30 Aldy Hernandez <aldyh@redhat.com>
* c-common.c: Add GTY to vector_type_node_list.

View File

@ -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 ]********************************/