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]

gold patch: Fixes to build with gcc 4.4


I committed these patches to let gold build with mainline gcc.

Ian


2009-01-28  Ian Lance Taylor  <iant@google.com>

	* gold.h: Include <cstring> and <stdint.h>.
	* version.cc: Include <cstdio>.
	* object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
	warning.
	* reduced_debug_output.cc (insert_into_vector): Rename from
	Insert_into_vector; change all callers.  Use Swap_unaligned to
	avoid aliasing issue; remove union since it is unnecessary.


Index: gold.h
===================================================================
RCS file: /cvs/src/src/gold/gold.h,v
retrieving revision 1.29
diff -p -u -r1.29 gold.h
--- gold.h	28 Jan 2009 02:25:33 -0000	1.29
+++ gold.h	28 Jan 2009 20:07:17 -0000
@@ -27,6 +27,8 @@
 #include "ansidecl.h"
 
 #include <cstddef>
+#include <cstring>
+#include <stdint.h>
 #include <sys/types.h>
 
 #ifndef ENABLE_NLS
Index: object.cc
===================================================================
RCS file: /cvs/src/src/gold/object.cc,v
retrieving revision 1.81
diff -p -u -r1.81 object.cc
--- object.cc	28 Jan 2009 02:25:33 -0000	1.81
+++ object.cc	28 Jan 2009 20:07:17 -0000
@@ -913,7 +913,7 @@ Sized_relobj<size, big_endian>::do_layou
                          && symtab->gc()->is_worklist_ready());
   if (shnum == 0)
     return;
-  Symbols_data* gc_sd;
+  Symbols_data* gc_sd = NULL;
   if (is_gc_pass_one)
     {
       // During garbage collection save the symbols data to use it when 
Index: reduced_debug_output.cc
===================================================================
RCS file: /cvs/src/src/gold/reduced_debug_output.cc,v
retrieving revision 1.1
diff -p -u -r1.1 reduced_debug_output.cc
--- reduced_debug_output.cc	28 May 2008 20:48:16 -0000	1.1
+++ reduced_debug_output.cc	28 Jan 2009 20:07:17 -0000
@@ -68,19 +68,15 @@ get_length_as_unsigned_LEB_128(uint64_t 
 }
 
 template <int valsize>
-void Insert_into_vector(std::vector<unsigned char>* destination,
+void insert_into_vector(std::vector<unsigned char>* destination,
                         typename elfcpp::Valtype_base<valsize>::Valtype value)
 {
-  union
-    {
-      unsigned char buffer[valsize / 8];
-      long long align;
-    } u;
+  unsigned char buffer[valsize / 8];
   if (parameters->target().is_big_endian())
-    elfcpp::Swap<valsize, true>::writeval(u.buffer, value);
+    elfcpp::Swap_unaligned<valsize, true>::writeval(buffer, value);
   else
-    elfcpp::Swap<valsize, false>::writeval(u.buffer, value);
-  destination->insert(destination->end(), u.buffer, u.buffer + valsize / 8);
+    elfcpp::Swap_unaligned<valsize, false>::writeval(buffer, value);
+  destination->insert(destination->end(), buffer, buffer + valsize / 8);
 }
 
 template <int valsize>
@@ -356,15 +352,15 @@ void Output_reduced_debug_info_section::
               return;
             }
 
-          Insert_into_vector<32>(&this->data_, 0xFFFFFFFF);
-          Insert_into_vector<32>(&this->data_, 0);
-          Insert_into_vector<64>(
+          insert_into_vector<32>(&this->data_, 0xFFFFFFFF);
+          insert_into_vector<32>(&this->data_, 0);
+          insert_into_vector<64>(
               &this->data_,
               (11 + get_length_as_unsigned_LEB_128(abbreviation_number)
 	       + die_end - debug_info));
-          Insert_into_vector<16>(&this->data_, version);
-          Insert_into_vector<64>(&this->data_, 0);
-          Insert_into_vector<8>(&this->data_, address_size);
+          insert_into_vector<16>(&this->data_, version);
+          insert_into_vector<64>(&this->data_, 0);
+          insert_into_vector<8>(&this->data_, address_size);
           write_unsigned_LEB_128(&this->data_, abbreviation_number);
           this->data_.insert(this->data_.end(), debug_info, die_end);
         }
@@ -398,13 +394,13 @@ void Output_reduced_debug_info_section::
               return;
             }
 
-          Insert_into_vector<32>(
+          insert_into_vector<32>(
               &this->data_,
               (7 + get_length_as_unsigned_LEB_128(abbreviation_number)
 	       + die_end - debug_info));
-          Insert_into_vector<16>(&this->data_, version);
-          Insert_into_vector<32>(&this->data_, 0);
-          Insert_into_vector<8>(&this->data_, address_size);
+          insert_into_vector<16>(&this->data_, version);
+          insert_into_vector<32>(&this->data_, 0);
+          insert_into_vector<8>(&this->data_, address_size);
           write_unsigned_LEB_128(&this->data_, abbreviation_number);
           this->data_.insert(this->data_.end(), debug_info, die_end);
         }
Index: version.cc
===================================================================
RCS file: /cvs/src/src/gold/version.cc,v
retrieving revision 1.15
diff -p -u -r1.15 version.cc
--- version.cc	7 Jan 2009 21:39:25 -0000	1.15
+++ version.cc	28 Jan 2009 20:07:17 -0000
@@ -23,6 +23,7 @@
 #include "gold.h"
 
 #include <string>
+#include <cstdio>
 
 #include "../bfd/bfdver.h"
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]