This is the mail archive of the 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]

Re: [PATCH][gold] compiling gold with libc++ and __stl_hash_string

On 19 Dec 2013, at 00:25, Cary Coutant <> 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 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/ b/gold/
index 665fcc8..00ed184 100644
--- a/gold/
+++ b/gold/
@@ -73,7 +73,10 @@ Stringpool_template<Stringpool_char>::reserve(unsigned int 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);
@@ -503,7 +506,7 @@ template<typename Stringpool_char>
 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(),


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]