[PATCH][GOLD] Fix OSX build breakage.

Doug Kwan (關振德) dougkwan@google.com
Sat Oct 2 03:27:00 GMT 2010


Hi Ian,

    This fixes a problem seen by Cary in which an undefined symbol in
incremental.o broke gold on OSX.  The hash function was used in the ++
operator of an iterator in incremental.cc but the function was defined
as an inline function inside symtab.cc.  I moved the inline defintion
to symtab.h so that it is visible to incremental.cc.   I tested it on
Linux natively and as an ARM cross-linker on OSX.

-Doug

2010-10-02  Doug Kwan  <dougkwan@google.com>

	* symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
	defintion to symtab.h
	* symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
	declaration to defintion.
-------------- next part --------------
Index: gold/symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.144
diff -u -u -p -r1.144 symtab.cc
--- gold/symtab.cc	25 Aug 2010 08:36:54 -0000	1.144
+++ gold/symtab.cc	2 Oct 2010 03:18:07 -0000
@@ -501,14 +501,6 @@ Symbol_table::~Symbol_table()
 {
 }
 
-// The hash function.  The key values are Stringpool keys.
-
-inline size_t
-Symbol_table::Symbol_table_hash::operator()(const Symbol_table_key& key) const
-{
-  return key.first ^ key.second;
-}
-
 // The symbol table key equality function.  This is called with
 // Stringpool keys.
 
Index: gold/symtab.h
===================================================================
RCS file: /cvs/src/src/gold/symtab.h,v
retrieving revision 1.114
diff -u -u -p -r1.114 symtab.h
--- gold/symtab.h	12 Sep 2010 19:58:01 -0000	1.114
+++ gold/symtab.h	2 Oct 2010 03:18:07 -0000
@@ -1545,10 +1545,14 @@ class Symbol_table
 
   typedef std::pair<Stringpool::Key, Stringpool::Key> Symbol_table_key;
 
+  // The hash function.  The key values are Stringpool keys.
   struct Symbol_table_hash
   {
-    size_t
-    operator()(const Symbol_table_key&) const;
+    inline size_t
+    operator()(const Symbol_table_key& key) const
+    {
+      return key.first ^ key.second;
+    }
   };
 
   struct Symbol_table_eq


More information about the Binutils mailing list