Blame SOURCES/binutils-2.23.51.0.3-Provide-std-tr1-hash.patch

83c6f5
From b9fe56f2e08939e68cabda378c7e5c4775ed381e Mon Sep 17 00:00:00 2001
83c6f5
From: root <root@auto-i386-001.ss.eng.bos.redhat.com>
83c6f5
Date: Tue, 16 Oct 2012 04:27:15 -0400
83c6f5
Subject: [PATCH] Provide std::tr1::hash{<unsigned long long>, <long long>}
83c6f5
83c6f5
When compiling powerpc.cc on gcc 4.1 i386, we fail on line 68
83c6f5
because we try to instantiate unordered_map with a key that is
83c6f5
elfcpp::Elf_types<size>::Elf_Addr where size seems to be uint64_t.
83c6f5
83c6f5
That amounts to trying to use an std::tr1::hash<unsigned long long>
83c6f5
but then system.h only defines an std::tr1::hash<off_t> with off_t
83c6f5
defined to long long.
83c6f5
83c6f5
This patch defines a specialization for std::tr1::hash<unsigned long long>
83c6f5
and std::tr1::hash<long long>, similarly to what is done by recent libstdc++
83c6f5
in the file functional_hash.h.
83c6f5
83c6f5
gold/
83c6f5
83c6f5
	* system.h (tr1_hashtable_define_trivial_hash): Define new macro.
83c6f5
	  Use it to define specializations std::tr1::hash<long long>
83c6f5
	  and std::tr1::hash<unsiged long long>.
83c6f5
---
83c6f5
 gold/gold.h |   21 ++++++++++++++-------
83c6f5
 1 files changed, 14 insertions(+), 7 deletions(-)
83c6f5
83c6f5
diff -Nrup a/gold/system.h b/gold/system.h
83c6f5
--- a/gold/system.h     2012-12-21 14:40:41.000000000 -0500
83c6f5
+++ b/gold/system.h     2013-01-08 13:29:21.872781906 -0500
83c6f5
@@ -77,13 +77,20 @@
83c6f5
 // arises with GCC 4.1.x when compiling in 32-bit mode with a 64-bit
83c6f5
 // off_t type.
83c6f5
 namespace std { namespace tr1 {
83c6f5
-template<>
83c6f5
-struct hash<off_t> : public std::unary_function<off_t, std::size_t>
83c6f5
-{
83c6f5
-  std::size_t
83c6f5
-  operator()(off_t val) const
83c6f5
-  { return static_cast<std::size_t>(val); }
83c6f5
-};
83c6f5
+#define tr1_hashtable_define_trivial_hash(T)            \
83c6f5
+  template<>                                           \
83c6f5
+  struct hash<T>                                       \
83c6f5
+    : public std::unary_function<T, std::size_t>       \
83c6f5
+  {                                                    \
83c6f5
+    std::size_t                                                \
83c6f5
+      operator()(T val) const                          \
83c6f5
+    { return static_cast<std::size_t>(val); }          \
83c6f5
+  }
83c6f5
+  template<typename T> struct hash;
83c6f5
+
83c6f5
+  tr1_hashtable_define_trivial_hash(long long);
83c6f5
+  tr1_hashtable_define_trivial_hash(unsigned long long);
83c6f5
+#undef tr1_hashtable_define_trivial_hash
83c6f5
 } } // Close namespaces.
83c6f5
 #endif // !defined(HAVE_TR1_HASH_OFF_T)
83c6f5