aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gold/ChangeLog8
-rw-r--r--gold/config.in3
-rwxr-xr-xgold/configure67
-rw-r--r--gold/configure.ac13
-rw-r--r--gold/gold.h3
5 files changed, 93 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 3841da2..bec3a75 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,11 @@
+2009-04-23 Chris Demetriou <cgd@google.com>
+
+ * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
+ if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
+
2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
* incremental.cc (Incremental_inputs_header_data): Renamed from
diff --git a/gold/config.in b/gold/config.in
index 97af335..1ab4ca5 100644
--- a/gold/config.in
+++ b/gold/config.in
@@ -97,6 +97,9 @@
/* Define to 1 if you have the <tr1/unordered_map> header file. */
#undef HAVE_TR1_UNORDERED_MAP
+/* Define if ::std::tr1::unordered_map::rehash is usable */
+#undef HAVE_TR1_UNORDERED_MAP_REHASH
+
/* Define to 1 if you have the <tr1/unordered_set> header file. */
#undef HAVE_TR1_UNORDERED_SET
diff --git a/gold/configure b/gold/configure
index 8cd5153..45a2c24 100755
--- a/gold/configure
+++ b/gold/configure
@@ -6855,6 +6855,73 @@ fi
done
+# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
+# at link time with some versions of GCC.
+echo "$as_me:$LINENO: checking whether ::std::tr1::unordered_map::rehash is usable." >&5
+echo $ECHO_N "checking whether ::std::tr1::unordered_map::rehash is usable.... $ECHO_C" >&6
+if test "${gold_cv_unordered_map_rehash+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <tr1/unordered_map>
+void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); }
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ gold_cv_unordered_map_rehash=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gold_cv_unordered_map_rehash=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $gold_cv_unordered_map_rehash" >&5
+echo "${ECHO_T}$gold_cv_unordered_map_rehash" >&6
+if test "$gold_cv_unordered_map_rehash" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_TR1_UNORDERED_MAP_REHASH 1
+_ACEOF
+
+fi
+
# gcc 4.3.0 doesn't recognize the printf attribute on a template
# function. Check for that. This is gcc bug 35546. This test can
# probably be removed after the bug has been fixed for a while.
diff --git a/gold/configure.ac b/gold/configure.ac
index e8d5762..ad04fa6 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -325,6 +325,19 @@ AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
AC_CHECK_HEADERS(byteswap.h)
AC_CHECK_FUNCS(mallinfo posix_fallocate)
+# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
+# at link time with some versions of GCC.
+AC_CACHE_CHECK([whether ::std::tr1::unordered_map::rehash is usable.],
+[gold_cv_unordered_map_rehash],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#include <tr1/unordered_map>
+void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); }
+]])], [gold_cv_unordered_map_rehash=yes], [gold_cv_unordered_map_rehash=no])])
+if test "$gold_cv_unordered_map_rehash" = "yes"; then
+ AC_DEFINE(HAVE_TR1_UNORDERED_MAP_REHASH, 1,
+ [Define if ::std::tr1::unordered_map::rehash is usable])
+fi
+
# gcc 4.3.0 doesn't recognize the printf attribute on a template
# function. Check for that. This is gcc bug 35546. This test can
# probably be removed after the bug has been fixed for a while.
diff --git a/gold/gold.h b/gold/gold.h
index 4c23aa6..efebda8 100644
--- a/gold/gold.h
+++ b/gold/gold.h
@@ -65,7 +65,8 @@
// Figure out how to get a hash set and a hash map.
-#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP)
+#if defined(HAVE_TR1_UNORDERED_SET) && defined(HAVE_TR1_UNORDERED_MAP) \
+ && defined(HAVE_TR1_UNORDERED_MAP_REHASH)
#include <tr1/unordered_set>
#include <tr1/unordered_map>