From e0ebcf42c2dfc4e486eb73807806ee813a9a0f50 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 28 Jan 2009 20:09:18 +0000 Subject: [PATCH] * gold.h: Include and . * version.cc: Include . * 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. --- gold/ChangeLog | 10 ++++++++++ gold/gold.h | 2 ++ gold/object.cc | 2 +- gold/reduced_debug_output.cc | 34 +++++++++++++++------------------- gold/version.cc | 1 + 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 19a5ad09c85..579835aa941 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,13 @@ +2009-01-28 Ian Lance Taylor + + * gold.h: Include and . + * version.cc: Include . + * 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. + 2009-01-27 Sriraman Tallam * Makefile.am (CCFILES): Add gc.cc. diff --git a/gold/gold.h b/gold/gold.h index 7e386686d01..964de32aff9 100644 --- a/gold/gold.h +++ b/gold/gold.h @@ -27,6 +27,8 @@ #include "ansidecl.h" #include +#include +#include #include #ifndef ENABLE_NLS diff --git a/gold/object.cc b/gold/object.cc index 9030abe5b33..a05dcfc5e71 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -913,7 +913,7 @@ Sized_relobj::do_layout(Symbol_table* symtab, && 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 diff --git a/gold/reduced_debug_output.cc b/gold/reduced_debug_output.cc index d195cfdd40d..48346943dd5 100644 --- a/gold/reduced_debug_output.cc +++ b/gold/reduced_debug_output.cc @@ -68,19 +68,15 @@ get_length_as_unsigned_LEB_128(uint64_t value) } template -void Insert_into_vector(std::vector* destination, +void insert_into_vector(std::vector* destination, typename elfcpp::Valtype_base::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::writeval(u.buffer, value); + elfcpp::Swap_unaligned::writeval(buffer, value); else - elfcpp::Swap::writeval(u.buffer, value); - destination->insert(destination->end(), u.buffer, u.buffer + valsize / 8); + elfcpp::Swap_unaligned::writeval(buffer, value); + destination->insert(destination->end(), buffer, buffer + valsize / 8); } template @@ -356,15 +352,15 @@ void Output_reduced_debug_info_section::set_final_data_size() 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::set_final_data_size() 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); } diff --git a/gold/version.cc b/gold/version.cc index 2e4b7776f2e..71d163bb9e8 100644 --- a/gold/version.cc +++ b/gold/version.cc @@ -23,6 +23,7 @@ #include "gold.h" #include +#include #include "../bfd/bfdver.h" -- 2.30.2