This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: trampolines vs nonexecutable stack



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]