diff options
author | Ian Lance Taylor <ian@airs.com> | 2009-01-28 20:09:18 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2009-01-28 20:09:18 +0000 |
commit | e0ebcf42c2dfc4e486eb73807806ee813a9a0f50 (patch) | |
tree | 30bb2d0be9fc41217341f6fe2686a6ca4ade3ff0 /gold/reduced_debug_output.cc | |
parent | 528aeb629fb4b25a56e0a523a3cbc2c5366fa6b0 (diff) | |
download | gdb-e0ebcf42c2dfc4e486eb73807806ee813a9a0f50.zip gdb-e0ebcf42c2dfc4e486eb73807806ee813a9a0f50.tar.gz gdb-e0ebcf42c2dfc4e486eb73807806ee813a9a0f50.tar.bz2 |
* 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.
Diffstat (limited to 'gold/reduced_debug_output.cc')
-rw-r--r-- | gold/reduced_debug_output.cc | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/gold/reduced_debug_output.cc b/gold/reduced_debug_output.cc index d195cfd..4834694 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 <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::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); } |