On 05/30/2011 05:59 PM, Rainer Orth wrote:
This is my hopefully last patch for toplevel libgcc moves: it moves
ENABLE_EXECUTE_STACK to $target-lib.h headers in libgcc/config.  Since
gcc/config/sol2.h is only used on Solaris targets anymore and Solaris 8
is the minimal supported version, I've removed both a Solaris 2.6
workaround and include<sys/mman.h>  directly.  Same thing in osf5-lib.h.

Since the existance of the macro is used in alpha/alpha.c, i386/i386.c,
and sparc/sparc.c to enable calls to __enable_execute_stack, I had to
define HAVE_ENABLE_EXECUTE_STACK in the gcc/config headers to convey the
necessary information.

The new libgcc/config/$target-lib.h headers are added to libgcc_tm_file
in gcc/config.gcc.  I'd rather add them to libgcc/config.host instead so
the information is kept local to libgcc.

Did you have any problems doing so?

Long term, it would be even better to do something like this in libgcc/config.host:

enable_execute_stack=enable-execute-stack-empty.c
case $host in
  ...) enable_execute_stack=config/enable-execute-stack-mprotect.c ;;
  ...
esac

in libgcc/configure.ac:

AC_CONFIG_LINKS(enable-execute-stack.c:$enable_execute_stack)

in libgcc/Makefile.in:

LIB2ADD += enable-execute-stack.c

and drop this hunk altogether from gcc/libgcc2.c:

#ifdef L_enable_execute_stack
/* Attempt to turn on execute permission for the stack.  */

#ifdef ENABLE_EXECUTE_STACK
  ENABLE_EXECUTE_STACK
#else
void
__enable_execute_stack (void *addr __attribute__((__unused__)))
{}
#endif /* ENABLE_EXECUTE_STACK */

#endif /* L_enable_execute_stack */


Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11.

I've Cc'ed the OS port maintainers of the other affected targets and
would appreciate testing/review.  An OpenBSD maintainer isn't listed,
unfortunately.  Also included are the CPU port maintainers for the
modified backends.

Ok for mainline after a week if no problems occur in testing on the
other targets?

It's a good start, but at least you need changes to the documentation; if you can make the above work, that would be great as an example of how to move stuff to the libgcc toplevel directory.

Paolo

Reply via email to