weakref.m4: New file.

config:

	* weakref.m4: New file.

libitm:

	* configure.ac: Use GCC_CHECK_ELF_STYLE_WEAKREF.
	* alloc_cpp.cc: Generate dummy functions if we don't
	HAVE_ELF_STYLE_WEAKREF.
	* eh_cpp.cc: Likewise.
	* configure: Regenerate.
	* aclocal.m4:  Likewise.
	* config.h.in: Likewise.
	* Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.

From-SVN: r181618
This commit is contained in:
Iain Sandoe 2011-11-22 14:49:11 +00:00
parent 8fb013576c
commit 8cf36bb3b8
11 changed files with 139 additions and 14 deletions

View File

@ -1,3 +1,7 @@
2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
* weakref.m4: New file.
2011-11-09 Richard Henderson <rth@redhat.com>
* asmcfi.m4: New file.

48
config/weakref.m4 Normal file
View File

@ -0,0 +1,48 @@
dnl Check if the target supports weak.
AC_DEFUN([GCC_CHECK_ATTRIBUTE_WEAK], [
AC_CACHE_CHECK([whether the target supports weak],
ac_cv_have_attribute_weak, [
weakref_m4_saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((weak)) foo(void) { }],
[], ac_cv_have_attribute_weak=yes,
ac_cv_have_attribute_weak=no)
CFLAGS="$weakref_m4_saved_CFLAGS"])
if test x"$ac_cv_have_attribute_weak" = xyes; then
AC_DEFINE(HAVE_ATTRIBUTE_WEAK, 1,
[Define to 1 if the target supports __attribute__((weak)).])
fi])
dnl Check whether weak refs work like the ELF ones.
dnl This means that the weak reference works without having to satify
dnl linkage for the item.
dnl There are targets (at least Darwin) where we have fully functional
dnl weakrefs at runtime, but must supply the referenced item at link time.
AC_DEFUN([GCC_CHECK_ELF_STYLE_WEAKREF], [
AC_CACHE_CHECK([whether weak refs work like ELF],
ac_cv_have_elf_style_weakref, [
weakref_m4_saved_CFLAGS="$CFLAGS"
case "${host}" in
*-apple-darwin*) CFLAGS="$CFLAGS -Wl,-undefined,dynamic_lookup" ;;
*) ;;
esac
AC_RUN_IFELSE([AC_LANG_SOURCE([[
extern void fNotToBeFound(void) __attribute__((weak));
int main ()
{
if (fNotToBeFound)
return 1;
else
return 0;
}
]])], ac_cv_have_elf_style_weakref=yes, ac_cv_have_elf_style_weakref=no, [
case "${host}" in
alpha*-dec-osf*) ac_cv_have_elf_style_weakref=no ;;
*-apple-darwin[[89]]*) ac_cv_have_elf_style_weakref=no ;;
*) ac_cv_have_elf_style_weakref=yes;;
esac])CFLAGS="$weakref_m4_saved_CFLAGS"])
if test x"$ac_cv_have_elf_style_weakref" = xyes; then
AC_DEFINE(HAVE_ELF_STYLE_WEAKREF, 1, [Define to 1 if target has a weakref that works like the ELF one.])
fi])

View File

@ -1,11 +1,23 @@
2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
* configure.ac: Use GCC_CHECK_ELF_STYLE_WEAKREF.
* alloc_cpp.cc: Generate dummy functions if we don't
HAVE_ELF_STYLE_WEAKREF.
* eh_cpp.cc: Likewise.
* configure: Regenerate.
* aclocal.m4: Likewise.
* config.h.in: Likewise.
* Makefile.in: Likewise.
* testsuite/Makefile.in: Likewise.
2011-11-22 Iain Sandoe <iains@gcc.gnu.org>
* config/x86/sjlj.S (CONCAT1, CONCAT2, SYM): Respond to
__USER_LABEL_PREFIX__ for targets that use it.
TYPE, SIZE, HIDDEN): New macros to assist on non-elf targets.
(TYPE, SIZE, HIDDEN): New macros to assist on non-elf targets.
(_ITM_beginTransaction): Use SYM, TYPE, SIZE macros to assist
in portability to non-elf targets.
(GTM_longjmp): LIkewise.
(GTM_longjmp): Likewise.
* libitm_i.h (begin_transaction): Apply __USER_LABEL_PREFIX__
where required.

View File

@ -57,10 +57,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../ltoptions.m4 \
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/../config/tls.m4 \
$(top_srcdir)/../config/weakref.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \

1
libitm/aclocal.m4 vendored
View File

@ -1001,6 +1001,7 @@ m4_include([../config/multi.m4])
m4_include([../config/override.m4])
m4_include([../config/stdint.m4])
m4_include([../config/tls.m4])
m4_include([../config/weakref.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
m4_include([../ltversion.m4])

View File

@ -60,7 +60,7 @@ extern void _ZdlPvRKSt9nothrow_t (void *, c_nothrow_p) __attribute__((weak));
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_ELF_STYLE_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) { return NULL; }
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_ELF_STYLE_WEAKREF */
/* Wrap the delete nothrow symbols for usage with a single argument.
Perhaps should have a configure type check for this, because the

View File

@ -30,6 +30,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if target has a weakref that works like the ELF one. */
#undef HAVE_ELF_STYLE_WEAKREF
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

51
libitm/configure vendored
View File

@ -17213,6 +17213,57 @@ $as_echo "#define HAVE_AS_AVX 1" >>confdefs.h
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether weak refs work like ELF" >&5
$as_echo_n "checking whether weak refs work like ELF... " >&6; }
if test "${ac_cv_have_elf_style_weakref+set}" = set; then :
$as_echo_n "(cached) " >&6
else
weakref_m4_saved_CFLAGS="$CFLAGS"
case "${host}" in
*-apple-darwin*) CFLAGS="$CFLAGS -Wl,-undefined,dynamic_lookup" ;;
*) ;;
esac
if test "$cross_compiling" = yes; then :
case "${host}" in
alpha*-dec-osf*) ac_cv_have_elf_style_weakref=no ;;
*-apple-darwin[89]*) ac_cv_have_elf_style_weakref=no ;;
*) ac_cv_have_elf_style_weakref=yes;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
extern void fNotToBeFound(void) __attribute__((weak));
int main ()
{
if (fNotToBeFound)
return 1;
else
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
ac_cv_have_elf_style_weakref=yes
else
ac_cv_have_elf_style_weakref=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
CFLAGS="$weakref_m4_saved_CFLAGS"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_elf_style_weakref" >&5
$as_echo "$ac_cv_have_elf_style_weakref" >&6; }
if test x"$ac_cv_have_elf_style_weakref" = xyes; then
$as_echo "#define HAVE_ELF_STYLE_WEAKREF 1" >>confdefs.h
fi
# Cleanup and exit.
CFLAGS="$save_CFLAGS"
cat >confcache <<\_ACEOF

View File

@ -239,6 +239,8 @@ LIBITM_CHECK_SYNC_BUILTINS
LIBITM_CHECK_64BIT_SYNC_BUILTINS
LIBITM_CHECK_AS_AVX
GCC_CHECK_ELF_STYLE_WEAKREF
# Cleanup and exit.
CFLAGS="$save_CFLAGS"
AC_CACHE_SAVE

View File

@ -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_ELF_STYLE_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_ELF_STYLE_WEAKREF */
}

View File

@ -47,10 +47,12 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/multi.m4 \
$(top_srcdir)/../config/override.m4 \
$(top_srcdir)/../config/stdint.m4 \
$(top_srcdir)/../config/tls.m4 $(top_srcdir)/../ltoptions.m4 \
$(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
$(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
$(top_srcdir)/../config/tls.m4 \
$(top_srcdir)/../config/weakref.m4 \
$(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs