This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: trampolines vs nonexecutable stack
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Dale Johannesen <dalej at apple dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 28 Jun 2005 13:11:52 -0400
- Subject: Re: trampolines vs nonexecutable stack
- References: <9d9f804a34deed365a2eaf3f62a76dfc@apple.com>
On Jun 28, 2005, at 1:00 PM, Dale Johannesen wrote:
Our OS people would like the stack to become nonexecutable. This
will break
the current implementation of trampolines. Other targets with this
restriction seem
to handle it by generating an OS call to make the stack executable
temporarily,
but they'd like to avoid doing even that. Is there prior art for
getting trampolines
to work under this restriction, malloc'd storage or something? Thanks.
Why do they want that, malloc means that you have to deallocate it
which will
not happen unless you have GC.
Anyways for GNU targets we output a special section:
/* This is a generic routine suitable for use as TARGET_ASM_FILE_END
which emits a special section directive used to indicate whether or
not this object file needs an executable stack. This is primarily
a GNU extension to ELF but could be used on other targets. */
int trampolines_created;
void
file_end_indicate_exec_stack (void)
{
unsigned int flags = SECTION_DEBUG;
if (trampolines_created)
flags |= SECTION_CODE;
named_section_flags (".note.GNU-stack", flags);
}
-- Pinski