This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Re: Solaris2.7 failing all nested function tests
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: [PATCH] Re: Solaris2.7 failing all nested function tests
- From: Alexandre Oliva <oliva at lsd dot ic dot unicamp dot br>
- Date: 14 Jan 2000 17:30:48 -0200
- Cc: jakub at redhat dot com, davem at redhat dot com, gcc-patches at gcc dot gnu dot org
- References: <200001141830.NAA02117@caip.rutgers.edu> <ork8lctrxi.fsf@garnize.lsd.ic.unicamp.br>
On Jan 14, 2000, Alexandre Oliva <oliva@lsd.ic.unicamp.br> wrote:
> Why not? I don't think the stack-protection code affects only 64 bit
> mode. It's more likely that the code was put in sol2-sld-64.h because
> this feature was only introduced in Solaris7. I'll try to figure out
> whether libgcc would still build on Solaris 2.5 if the definition of
> TRANSFER_FROM_TRAMPOLINE were provided in sol2.h. In this case, I
> think that would be the best choice.
Indeed, it worked on Solaris 2.5, and on Solaris7 32/64. Tested with
gcc.c-torture/execute/nestfunc-1.c. Ok to install?
Index: gcc/ChangeLog
from Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* config/sparc/sol2-sld-64.h (TRANSFER_FROM_TRAMPOLINE): Moved...
* config/sparc/sol2.h: ... here.
Index: gcc/config/sparc/sol2-sld-64.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sparc/sol2-sld-64.h,v
retrieving revision 1.9
diff -u -r1.9 sol2-sld-64.h
--- gcc/config/sparc/sol2-sld-64.h 1999/12/08 10:27:54 1.9
+++ gcc/config/sparc/sol2-sld-64.h 2000/01/14 19:10:00
@@ -305,49 +305,6 @@
#endif /* ! SPARC_BI_ARCH */
-/*
- * 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.
- *
- */
-
-#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; \
-} \
- \
-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"); \
- } \
-}
-
/* A C statement (sans semicolon) to output an element in the table of
global constructors. */
#undef ASM_OUTPUT_CONSTRUCTOR
Index: gcc/config/sparc/sol2.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sparc/sol2.h,v
retrieving revision 1.16
diff -u -r1.16 sol2.h
--- gcc/config/sparc/sol2.h 1999/12/14 12:47:01 1.16
+++ gcc/config/sparc/sol2.h 2000/01/14 19:10:01
@@ -235,3 +235,46 @@
: /* no outputs */ \
: "r" (ms_flags), "r" (ms_saveret));
#endif /* sparc32 */
+
+/*
+ * 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.
+ *
+ */
+
+#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; \
+} \
+ \
+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"); \
+ } \
+}
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them