summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authoriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-22 14:49:11 +0000
committeriains <iains@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-22 14:49:11 +0000
commit07acf71267309fd593fafe0d25ed5a805aee0977 (patch)
tree2c26188cd406f39ca321e6a5612b5d17b6376b1e /config
parente3eb42090469340ec4e2c93cfb0347d35230d62d (diff)
downloadgcc-07acf71267309fd593fafe0d25ed5a805aee0977.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181618 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'config')
-rw-r--r--config/ChangeLog4
-rw-r--r--config/weakref.m448
2 files changed, 52 insertions, 0 deletions
diff --git a/config/ChangeLog b/config/ChangeLog
index 4f202ffbc9a..4ebecc32f70 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -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
index 00000000000..39b63d39b8a
--- /dev/null
+++ b/config/weakref.m4
@@ -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])
+