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