]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
config:
authoriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Nov 2011 14:49:11 +0000 (14:49 +0000)
committeriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Nov 2011 14:49:11 +0000 (14:49 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181618 138bc75d-0d04-0410-961f-82ee72b054a4

config/ChangeLog
config/weakref.m4 [new file with mode: 0644]
libitm/ChangeLog
libitm/Makefile.in
libitm/aclocal.m4
libitm/alloc_cpp.cc
libitm/config.h.in
libitm/configure
libitm/configure.ac
libitm/eh_cpp.cc
libitm/testsuite/Makefile.in

index 4f202ffbc9affd6208136b20e1d35d699f352e87..4ebecc32f703a9c86b33c339cf38369a33b7383a 100644 (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.
diff --git a/config/weakref.m4 b/config/weakref.m4
new file mode 100644 (file)
index 0000000..39b63d3
--- /dev/null
@@ -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])
+
index ae091d871810eb2f24e2df350e47b6b439059a8a..ab21cc5b99d254bc8d252ebe62854e63581664f6 100644 (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.
 
index d3872c9d36e73a699ba850ecccaa4bb7cc045144..a1bc47645e0946ef0a677a636900fe65f6901943 100644 (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 \
index 96617e6e4db9a0085ca18258627259ed8a493095..625404e06f675e78bf0517260b27ba71a7420d2f 100644 (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])
index d298bd49e820f2400cf6795436b434e18e409f58..0789b2e5342988486ab41d1148de22213f575028 100644 (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
index 52db1a6fdc1c122b100dfe0699aee0f69c100ae1..1c3469cd5f950e992caecf167d434b2f859a675e 100644 (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
 
index 024f39688bf3761263f5ec1a4207a4a6b9889677..9b06359411192e2474a2469347cc7a784cc3c8c2 100644 (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
index 672b71279e381efc086b13e6daf74c9f7e986095..45ee8701e3854df27ffeef05073cc47944987255 100644 (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
index 7a378622772e1d3daa2dade59828ec01cfec7256..6f302cdc4aee1939afa3c5fbe1ffb37383ea5f79 100644 (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 */
 
 }
 
index 6990cfeb6812bec5a74dd9efa402b7e9715a88b3..8066a2a038863859d786791fdb84f6860b7ce807 100644 (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