PR gold/14309
authorIan Lance Taylor <ian@airs.com>
Tue, 10 Jul 2012 14:54:29 +0000 (14:54 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 10 Jul 2012 14:54:29 +0000 (14:54 +0000)
* configure.ac: Test whether std::tr1::hash<off_t> works.
* gold.h: Add a specialization for std::tr1::hash<off_t> if
needed.
* output.h (class Output_fill): Add virtual destructor.
* configure, config.in: Rebuild.

gold/ChangeLog
gold/config.in
gold/configure
gold/configure.ac
gold/gold.h
gold/output.h

index 601753025cee34184561b5958ec4895d7b0eea65..33317bff8934e7522e2eb89bf00a9411363815b9 100644 (file)
@@ -1,3 +1,13 @@
+2012-07-10  Dodji Seketeli  <dodji@redhat.com>
+           Ian Lance Taylor  <iant@google.com>
+
+       PR gold/14309
+       * configure.ac: Test whether std::tr1::hash<off_t> works.
+       * gold.h: Add a specialization for std::tr1::hash<off_t> if
+       needed.
+       * output.h (class Output_fill): Add virtual destructor.
+       * configure, config.in: Rebuild.
+
 2012-06-22  Roland McGrath  <mcgrathr@google.com>
 
        * layout.cc (finalize): Define __ehdr_start symbol if applicable.
index ff4d5ee5b9eed9a82af85427b1e7eb99d264609a..3edc0d684f6cc12f5272099e36447f1fe9669822 100644 (file)
 /* Define to 1 if you have the `times' function. */
 #undef HAVE_TIMES
 
+/* Define if std::tr1::hash<off_t> is usable */
+#undef HAVE_TR1_HASH_OFF_T
+
 /* Define to 1 if you have the <tr1/unordered_map> header file. */
 #undef HAVE_TR1_UNORDERED_MAP
 
index b84234a8483423b00c415aafe56dfbe0afe80150..b9967ae89de9aa5340985c1f578b7826991a1c09 100755 (executable)
@@ -7266,6 +7266,39 @@ $as_echo "#define HAVE_TR1_UNORDERED_MAP_REHASH 1" >>confdefs.h
 
 fi
 
+# Use of tr1/unordered_map with off_t as a key is not supported on GCC
+# 4.1.xx when compiling in 32-bit mode with a 64-bit off_t type.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether std::tr1::hash<off_t> is defined" >&5
+$as_echo_n "checking whether std::tr1::hash<off_t> is defined... " >&6; }
+if test "${gold_cv_hash_off_t+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  CXXFLAGS_hold=$CXXFLAGS
+CXXFLAGS="$CXXFLAGS $LFS_CFLAGS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <sys/types.h>
+#include <tr1/unordered_map>
+std::tr1::hash<off_t> h;
+
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  gold_cv_hash_off_t=yes
+else
+  gold_cv_hash_off_t=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CXXFLAGS=$CFLAGS_hold
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gold_cv_hash_off_t" >&5
+$as_echo "$gold_cv_hash_off_t" >&6; }
+if test "$gold_cv_hash_off_t" = "yes"; then
+
+$as_echo "#define HAVE_TR1_HASH_OFF_T 1" >>confdefs.h
+
+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.
index fdea6291edb918e6d7be147ec790a9625e50ddf6..5e3dc0601c04074213ce82180f2c1c42211a8d0e 100644 (file)
@@ -515,6 +515,25 @@ if test "$gold_cv_unordered_map_rehash" = "yes"; then
            [Define if ::std::tr1::unordered_map::rehash is usable])
 fi
 
+# Use of tr1/unordered_map with off_t as a key is not supported on GCC
+# 4.1.xx when compiling in 32-bit mode with a 64-bit off_t type.
+AC_CACHE_CHECK([whether std::tr1::hash<off_t> is defined],
+[gold_cv_hash_off_t],
+[CXXFLAGS_hold=$CXXFLAGS
+CXXFLAGS="$CXXFLAGS $LFS_CFLAGS"
+AC_COMPILE_IFELSE([
+#include <sys/types.h>
+#include <tr1/unordered_map>
+std::tr1::hash<off_t> h;
+],
+[gold_cv_hash_off_t=yes],
+[gold_cv_hash_off_t=no])
+CXXFLAGS=$CFLAGS_hold])
+if test "$gold_cv_hash_off_t" = "yes"; then
+   AC_DEFINE(HAVE_TR1_HASH_OFF_T, 1,
+            [Define if std::tr1::hash<off_t> 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.
index 4258d5543d7e8087dd920dd7a2004b87221ba0b6..9aa7cf3506ced351a33451bf088d33be203bc33a 100644 (file)
 
 #define reserve_unordered_map(map, n) ((map)->rehash(n))
 
+#ifndef HAVE_TR1_HASH_OFF_T
+// The library does not support hashes of off_t values.  Add support
+// here.  This is likely to be specific to libstdc++.  This issue
+// arises with GCC 4.1.x when compiling in 32-bit mode with a 64-bit
+// off_t type.
+namespace std { namespace tr1 {
+template<>
+struct hash<off_t> : public std::unary_function<off_t, std::size_t>
+{
+  std::size_t
+  operator()(off_t val) const
+  { return static_cast<std::size_t>(val); }
+};
+} } // Close namespaces.
+#endif // !defined(HAVE_TR1_HASH_OFF_T)
+
 #elif defined(HAVE_EXT_HASH_MAP) && defined(HAVE_EXT_HASH_SET)
 
 #include <ext/hash_map>
index 3796e9120cea9dac483edc20d9460f9d471519fd..170f0ff890ef600868e844cc9f4c4da7ccec4833 100644 (file)
@@ -2819,6 +2819,10 @@ class Output_fill
     : is_big_endian_(parameters->target().is_big_endian())
   { }
 
+  virtual
+  ~Output_fill()
+  { }
+
   // Return the smallest size chunk of free space that can be
   // filled with a dummy compilation unit.
   size_t
This page took 0.036291 seconds and 4 git commands to generate.