This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On 19 Dec 2013, at 00:25, Cary Coutant <ccoutant@google.com> wrote:
>> That's not the right fix. That code should only be used if gold is
>> using <ext/hash_map>, which is a fall back for older compilers.
>> Currently gold prefers <tr1/unordered_map>. I think we need to add a
>> case to configure.ac and system.h to use <unordered_map> if it is
>> available, as I assume it is for libc++.
>
> Ian, does the attached patch look OK?
>
> Would we want to turn on C++11 at some point? I believe we get
> <unordered_map> in G++ if we turn on --std=c++11.
We had almost exactly the same patch for FreeBSD 10/11 (which uses libc++ by default), but with two additional changes:
diff --git a/gold/stringpool.cc b/gold/stringpool.cc
index 665fcc8..00ed184 100644
--- a/gold/stringpool.cc
+++ b/gold/stringpool.cc
@@ -73,7 +73,10 @@ Stringpool_template<Stringpool_char>::reserve(unsigned int n)
{
this->key_to_offset_.reserve(n);
-#if defined(HAVE_TR1_UNORDERED_MAP)
+#if defined(HAVE_UNORDERED_MAP)
+ this->string_set_.rehash(this->string_set_.size() + n);
+ return;
+#elif defined(HAVE_TR1_UNORDERED_MAP)
// rehash() implementation is broken in gcc 4.0.3's stl
//this->string_set_.rehash(this->string_set_.size() + n);
//return;
@@ -503,7 +506,7 @@ template<typename Stringpool_char>
void
Stringpool_template<Stringpool_char>::print_stats(const char* name) const
{
-#if defined(HAVE_TR1_UNORDERED_MAP) || defined(HAVE_EXT_HASH_MAP)
+#if defined(HAVE_UNORDERED_MAP) || defined(HAVE_TR1_UNORDERED_MAP) || defined(HAVE_EXT_HASH_MAP)
fprintf(stderr, _("%s: %s entries: %zu; buckets: %zu\n"),
program_name, name, this->string_set_.size(),
this->string_set_.bucket_count());
-Dimitry
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |