Nested functions

Meissner, Michael michael.meissner@amd.com
Mon Jan 2 17:13:00 GMT 2006


Many years ago (in the early 90's given I was OSF at the time), I was
working on a MIPS based machine that there were no user callable
instructions to flush the cache (these instructions were added in
MIPS-IV, but weren't available at the time), and at least one of the
OS's had no system call to make the stack executable (DEC's Ultrix).  I
attempted to fix all of the places where there were hidden assumptions
about the trampolines being on the stack, and after a month or so of
frustration, finally gave up and just made it a restriction for that
particular port.  Since then, I've done two other ports where
trampolines were not possible (one where the code and data were in
completely different address spaces, and it was only by use that the
hardware would go to the I or D space, and another machine with cache
problems).

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of John Yates
Sent: Thursday, December 29, 2005 10:33 AM
To: gcc-help@gnu.org
Cc: Marco Gerards
Subject: RE: Nested functions

Wednesday, December 28, 2005 7:51 AM mgerards@xs4all.nl wrote:

> The second problem is caused because some OS'es have no executable 
> stack.  Redhat even removes the nested functions from our code so it 
> builds for them.  But of course it would be better for all of our 
> users if it just works.

Is it not the case that building the trampoline on the stack is simply
an efficiency issue, akin to alloca versus malloc?  Surely, at least in
C++ with support for calling destructors, trampolines could be build on
the heap.

/john





More information about the Gcc-help mailing list