On Fri, Nov 18, 2011 at 01:44:40PM +0000, Iain Sandoe wrote:
> Hi,
>
> one of the three remaining libitm issues for Darwin is to supply the  
> dummy funcs fro the weakrefs (as Rainer has done for Tru64) for the  
> versions of Darwin that need them.
>
> Since we now have the situation where there are several targets which  
> might need dummy functions for the weak declarations, it seemed worth  
> trying to auto-foo this.
>
> .. the attached works for me on Darwin9 (weakref doesn't work like  
> elf***) and Darwin10+XCode3.2.5 (weakref works like elf)
>
> I hope it also works for Rainer .... and that I've got the right  
> designator for the Tru64 cross-case.

Iain,
    What steps are you taking to regenerate configure inside of libitm?
I am trying...

automake-1.11
autoconf -I. -I./config

but this fails with...

configure.ac:166: error: possibly undefined macro: GCC_AC_FUNC_MMAP_BLACKLIST
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

when using automake 1.11.1 and autoconf 2.64. Are you able to manually
regenerate configure or are you depending on --enable-maintainer-mode?
               Jack
>
> comments/OK for trunk?
> Iain
>
> *** FWIW, weakref actually work (at runtime) for earlier Darwin
> - it's just that refs either need to be satisfied by dummies at link  
> time -
> - or the library namespace has to be flattened (which is generally  
> undesirable).
>
> -----
>
> libitm:
>
>       * acinclude.m4 (LIBITM_CHECK_WORKING_WEAKREF): New.
>       * configure.ac: Use LIBITM_CHECK_WORKING_WEAKREF.
>       * alloc_cpp.cc: Generate dummy functions if we don't
>       HAVE_WORKING_WEAKREF.
>       * eh_cpp.cc: Likewise.
>       * configure: Regenerate.
>       * aclocal.m4:  Likewise.
>       * config.h.in: Likewise.
>

> Index: libitm/acinclude.m4
> ===================================================================
> --- libitm/acinclude.m4       (revision 181470)
> +++ libitm/acinclude.m4       (working copy)
> @@ -109,6 +109,29 @@ i[[34567]]86 | x86_64)
>    ;;
>  esac])
>  
> +dnl Check whether weak refs actually work.
> +AC_DEFUN([LIBITM_CHECK_WORKING_WEAKREF], [
> +  AC_CACHE_CHECK([whether weak refs actually work],
> +                  libitm_cv_have_working_weakref, [
> +  AC_RUN_IFELSE([AC_LANG_SOURCE([[
> +extern void fNotToBeFoundInAnyStandardLib(void) __attribute__((weak));
> +int main () 
> +{
> +  if (fNotToBeFoundInAnyStandardLib)
> +    return 0;
> +  else
> +    return 1;
> +}
> +}]])], libitm_cv_have_working_weakref=yes, 
> libitm_cv_have_working_weakref=no, [
> +case "${host}" in
> +  alpha*-dec-osf*) libitm_cv_have_working_weakref=no ;;
> +  *-apple-darwin[[89]]*) libitm_cv_have_working_weakref=no ;;
> +  *) libitm_cv_have_working_weakref=yes;;
> +esac])])
> +if test x"$libitm_cv_have_working_weakref" = xyes; then
> +  AC_DEFINE(HAVE_WORKING_WEAKREF, 1, [Define to 1 if target has a working 
> weakref.])
> +fi])
> +
>  sinclude(../libtool.m4)
>  dnl The lines below arrange for aclocal not to bring an installed
>  dnl libtool.m4 into aclocal.m4, while still arranging for automake to
> Index: libitm/configure.ac
> ===================================================================
> --- libitm/configure.ac       (revision 181470)
> +++ libitm/configure.ac       (working copy)
> @@ -238,6 +238,7 @@ CFLAGS="$save_CFLAGS $XCFLAGS"
>  LIBITM_CHECK_SYNC_BUILTINS
>  LIBITM_CHECK_64BIT_SYNC_BUILTINS
>  LIBITM_CHECK_AS_AVX
> +LIBITM_CHECK_WORKING_WEAKREF
>  
>  # Cleanup and exit.
>  CFLAGS="$save_CFLAGS"
> Index: libitm/alloc_cpp.cc
> ===================================================================
> --- libitm/alloc_cpp.cc       (revision 181470)
> +++ libitm/alloc_cpp.cc       (working copy)
> @@ -60,7 +60,7 @@ extern void _ZdlPvRKSt9nothrow_t (void *, c_nothro
>  extern void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) __attribute__((weak));
>  extern void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak));
>  
> -#ifdef __osf__ /* Really: !HAVE_WEAKDEF  */
> +#if !defined (HAVE_WORKING_WEAKREF)
>  void *_ZnwX (size_t) { return NULL; }
>  void _ZdlPv (void *) { return; }
>  void *_ZnaX (size_t) { return NULL; }
> @@ -70,7 +70,7 @@ void *_ZnwXRKSt9nothrow_t (size_t, c_nothrow_p) {
>  void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) { return; }
>  void *_ZnaXRKSt9nothrow_t (size_t, c_nothrow_p) { return NULL; }
>  void _ZdaPvRKSt9nothrow_t (void *, c_nothrow_p) { return; }
> -#endif /* __osf__ */
> +#endif /* HAVE_WORKING_WEAKREF */
>  
>  /* Wrap the delete nothrow symbols for usage with a single argument.
>     Perhaps should have a configure type check for this, because the
> Index: libitm/eh_cpp.cc
> ===================================================================
> --- libitm/eh_cpp.cc  (revision 181470)
> +++ libitm/eh_cpp.cc  (working copy)
> @@ -39,13 +39,13 @@ extern void *__cxa_begin_catch (void *) WEAK;
>  extern void *__cxa_end_catch (void) WEAK;
>  extern void __cxa_tm_cleanup (void *, void *, unsigned int) WEAK;
>  
> -#ifdef __osf__ /* Really: !HAVE_WEAKDEF  */
> +#if !defined (HAVE_WORKING_WEAKREF)
>  void *__cxa_allocate_exception (size_t) { return NULL; }
>  void __cxa_throw (void *, void *, void *) { return; }
>  void *__cxa_begin_catch (void *) { return NULL; }
>  void *__cxa_end_catch (void) { return NULL; }
>  void __cxa_tm_cleanup (void *, void *, unsigned int) { return; }
> -#endif
> +#endif /* HAVE_WORKING_WEAKREF */
>  
>  }
>  

>
>
>

Reply via email to