I've checked in the backports for PR target/49461 and PR boehm-gc/52179 into the 4.6.x release branch. Thanks Jack.
Index: boehm-gc/configure.ac =================================================================== --- boehm-gc/configure.ac (revision 184807) +++ boehm-gc/configure.ac (working copy) @@ -392,6 +392,7 @@ esac oldLIBS="$LIBS" LIBS="$LIBS $THREADLIBS" AC_CHECK_FUNCS([pthread_getattr_np]) +AC_CHECK_FUNCS([pthread_get_stackaddr_np]) LIBS="$oldLIBS" # Configuration of machine-dependent code Index: boehm-gc/include/gc_config.h.in =================================================================== --- boehm-gc/include/gc_config.h.in (revision 184807) +++ boehm-gc/include/gc_config.h.in (working copy) @@ -87,6 +87,9 @@ /* Define to 1 if you have the `pthread_getattr_np' function. */ #undef HAVE_PTHREAD_GETATTR_NP +/* Define to 1 if you have the `pthread_get_stackaddr_np_np' function. */ +#undef HAVE_PTHREAD_GET_STACKADDR_NP + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H Index: boehm-gc/include/private/gcconfig.h =================================================================== --- boehm-gc/include/private/gcconfig.h (revision 184807) +++ boehm-gc/include/private/gcconfig.h (working copy) @@ -1331,7 +1331,11 @@ These aren't used when dyld support is enabled (it is by default) */ # define DATASTART ((ptr_t) get_etext()) # define DATAEND ((ptr_t) get_end()) -# define STACKBOTTOM ((ptr_t) 0xc0000000) +# ifdef HAVE_PTHREAD_GET_STACKADDR_NP +# define STACKBOTTOM (ptr_t)pthread_get_stackaddr_np(pthread_self()) +# else +# define STACKBOTTOM ((ptr_t) 0xc0000000) +# endif # define USE_MMAP # define USE_MMAP_ANON # define USE_ASM_PUSH_REGS @@ -2011,7 +2015,11 @@ These aren't used when dyld support is enabled (it is by default) */ # define DATASTART ((ptr_t) get_etext()) # define DATAEND ((ptr_t) get_end()) -# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000) +# ifdef HAVE_PTHREAD_GET_STACKADDR_NP +# define STACKBOTTOM (ptr_t)pthread_get_stackaddr_np(pthread_self()) +# else +# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000) +# endif # define USE_MMAP # define USE_MMAP_ANON # ifdef GC_DARWIN_THREADS Index: boehm-gc/ChangeLog =================================================================== --- boehm-gc/ChangeLog (revision 184807) +++ boehm-gc/ChangeLog (working copy) @@ -1,3 +1,17 @@ +2012-03-02 Jack Howarth <howa...@bromo.med.uc.edu> + + Backport from mainline + 2012-02-23 Patrick Marlier <patrick.marl...@gmail.com> + Jack Howarth <howa...@bromo.med.uc.edu> + + PR boehm-gc/52179 + * include/gc_config.h.in: Undefine HAVE_PTHREAD_GET_STACKADDR_NP. + * include/private/gcconfig.h (DARWIN): Define STACKBOTTOM with + pthread_get_stackaddr_np when available. + * configure.ac (THREADS): Check availability of + pthread_get_stackaddr_np. + * configure: Regenerate. + 2012-03-01 Release Manager * GCC 4.6.3 released. Index: boehm-gc/configure =================================================================== --- boehm-gc/configure (revision 184807) +++ boehm-gc/configure (working copy) @@ -15246,6 +15246,17 @@ _ACEOF fi done +for ac_func in pthread_get_stackaddr_np +do : + ac_fn_c_check_func "$LINENO" "pthread_get_stackaddr_np" "ac_cv_func_pthread_get_stackaddr_np" +if test "x$ac_cv_func_pthread_get_stackaddr_np" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_GET_STACKADDR_NP 1 +_ACEOF + +fi +done + LIBS="$oldLIBS" # Configuration of machine-dependent code Index: libjava/configure.ac =================================================================== --- libjava/configure.ac (revision 184807) +++ libjava/configure.ac (working copy) @@ -886,14 +886,9 @@ case "${host}" in SYSTEMSPEC="-lunicows $SYSTEMSPEC" fi ;; - *-*-darwin9*) + *-*-darwin[[912]]*) SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" ;; - *-*-darwin[[12]]*) - # Something is incompatible with pie, would be nice to fix it and - # remove -no_pie. PR49461 - SYSTEMSPEC="-no_pie %{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" - ;; *) SYSTEMSPEC= ;; Index: libjava/ChangeLog =================================================================== --- libjava/ChangeLog (revision 184807) +++ libjava/ChangeLog (working copy) @@ -1,3 +1,13 @@ +2012-03-02 Jack Howarth <howa...@bromo.med.uc.edu> + + Backport from mainline + 2012-02-23 Patrick Marlier <patrick.marl...@gmail.com> + Jack Howarth <howa...@bromo.med.uc.edu> + + PR target/49461 + * configure.ac (SYSTEMSPEC): No longer pass -no_pie for darwin11. + * configure: Regenerate. + 2012-03-01 Release Manager * GCC 4.6.3 released. Index: libjava/configure =================================================================== --- libjava/configure (revision 184807) +++ libjava/configure (working copy) @@ -19775,14 +19775,9 @@ case "${host}" in SYSTEMSPEC="-lunicows $SYSTEMSPEC" fi ;; - *-*-darwin9*) + *-*-darwin[912]*) SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" ;; - *-*-darwin[12]*) - # Something is incompatible with pie, would be nice to fix it and - # remove -no_pie. PR49461 - SYSTEMSPEC="-no_pie %{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" - ;; *) SYSTEMSPEC= ;;