public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fix nested procedures for FreeBSD/sparc64
@ 2002-10-31  0:57 David O'Brien
  2002-10-31  0:59 ` David S. Miller
  2002-10-31  9:57 ` Mark Mitchell
  0 siblings, 2 replies; 3+ messages in thread
From: David O'Brien @ 2002-10-31  0:57 UTC (permalink / raw)
  To: gcc-patches

I'd like to commit this to both mainline and the 3.2 branch:

This simply copies the TRANSFER_FROM_TRAMPOLINE bits from sparc/sol2.h as
FreeBSD needs the same treatment.


2002-10-31  David O'Brien  <obrien@FreeBSD.org>

	* config/sparc/freebsd.h (TRANSFER_FROM_TRAMPOLINE): Define
	__enable_execute_stack function.

Index: config/sparc/freebsd.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sparc/freebsd.h,v
retrieving revision 1.12
diff -u -r1.12 freebsd.h
--- config/sparc/freebsd.h	15 Sep 2002 12:03:42 -0000	1.12
+++ config/sparc/freebsd.h	31 Oct 2002 08:54:25 -0000
@@ -154,3 +154,34 @@
 /* We use GNU ld so undefine this so that attribute((init_priority)) works.  */
 #undef CTORS_SECTION_ASM_OP
 #undef DTORS_SECTION_ASM_OP
+
+#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");				\
+  }									\
+}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix nested procedures for FreeBSD/sparc64
  2002-10-31  0:57 [PATCH] fix nested procedures for FreeBSD/sparc64 David O'Brien
@ 2002-10-31  0:59 ` David S. Miller
  2002-10-31  9:57 ` Mark Mitchell
  1 sibling, 0 replies; 3+ messages in thread
From: David S. Miller @ 2002-10-31  0:59 UTC (permalink / raw)
  To: obrien; +Cc: gcc-patches

   From: "David O'Brien" <obrien@FreeBSD.org>
   Date: Thu, 31 Oct 2002 00:56:17 -0800

   I'd like to commit this to both mainline and the 3.2 branch:
   
   This simply copies the TRANSFER_FROM_TRAMPOLINE bits from sparc/sol2.h as
   FreeBSD needs the same treatment.
   
Ok for mainline, Mark needs to approve for the branch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix nested procedures for FreeBSD/sparc64
  2002-10-31  0:57 [PATCH] fix nested procedures for FreeBSD/sparc64 David O'Brien
  2002-10-31  0:59 ` David S. Miller
@ 2002-10-31  9:57 ` Mark Mitchell
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Mitchell @ 2002-10-31  9:57 UTC (permalink / raw)
  To: obrien, gcc-patches



--On Thursday, October 31, 2002 12:56:17 AM -0800 David O'Brien 
<obrien@FreeBSD.org> wrote:

> I'd like to commit this to both mainline and the 3.2 branch:

I'll allow this on the branch, since it's FreeBSD only.

But, I plan to close the branch very soon; as Joe has pointed out,
we have made a lot of progress, and it's probably time to do some
triage and move on.  I'll have more to say about that later today.

Thanks,

-- 
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-31 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-31  0:57 [PATCH] fix nested procedures for FreeBSD/sparc64 David O'Brien
2002-10-31  0:59 ` David S. Miller
2002-10-31  9:57 ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).