This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH][gold] compiling gold with libc++ and __stl_hash_string
- From: Jan Voung <jvoung at google dot com>
- To: binutils at sourceware dot org
- Date: Wed, 18 Dec 2013 10:25:01 -0800
- Subject: [PATCH][gold] compiling gold with libc++ and __stl_hash_string
- Authentication-results: sourceware.org; auth=none
Hi all,
I've tried to compile gold with clang and libc++. I ran into an issue
with __stl_hash_string. With the following patch, gold compiles.
diff --git a/gold/system.h b/gold/system.h
index 3e6fe1d..e84b87f 100644
--- a/gold/system.h
+++ b/gold/system.h
@@ -97,6 +97,9 @@ struct hash<off_t> : public
std::unary_function<off_t, std::size_t>
#define Unordered_map __gnu_cxx::hash_map
#define Unordered_multimap __gnu_cxx::hash_multimap
+// libc++ does not have __stl_hash_string, but uses std::hash
+// for hash_map, etc.
+#if !defined(_LIBCPP_VERSION)
namespace __gnu_cxx
{
@@ -117,6 +120,7 @@ struct hash<T*>
};
}
+#endif // !defined(_LIBCPP_VERSION)
#define reserve_unordered_map(map, n) ((map)->resize(n))