aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-12-21 23:08:25 +0000
committerIan Lance Taylor <iant@google.com>2007-12-21 23:08:25 +0000
commit8d32f93595f28c70f21566384ca1dc8a441297b9 (patch)
treee15b3e44f7a3b3e81f270f0bdc12d1fe661c4ace
parent2e324ab383362a9497e286b5c56c58a6e40d7170 (diff)
downloadgdb-8d32f93595f28c70f21566384ca1dc8a441297b9.zip
gdb-8d32f93595f28c70f21566384ca1dc8a441297b9.tar.gz
gdb-8d32f93595f28c70f21566384ca1dc8a441297b9.tar.bz2
Correct handling of non-section symbol in merged section. Avoid some
64-bit signed/unsigned warnings.
-rw-r--r--gold/fileread.cc2
-rw-r--r--gold/object.cc7
-rw-r--r--gold/output.cc2
-rw-r--r--gold/output.h3
-rw-r--r--gold/reloc.cc3
5 files changed, 9 insertions, 8 deletions
diff --git a/gold/fileread.cc b/gold/fileread.cc
index baa681a..defb3a0 100644
--- a/gold/fileread.cc
+++ b/gold/fileread.cc
@@ -288,7 +288,7 @@ File_read::find_or_make_view(off_t start, section_size_type size, bool cache)
section_size_type psize = File_read::pages(size + (start - poff));
- if (poff + psize >= this->size_)
+ if (poff + static_cast<off_t>(psize) >= this->size_)
{
psize = this->size_ - poff;
gold_assert(psize >= size);
diff --git a/gold/object.cc b/gold/object.cc
index e92a66d..1a0d064 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -896,12 +896,13 @@ Sized_relobj<size, big_endian>::do_finalize_local_symbols(unsigned int index,
// value. If it is a section symbol, we can not, as in
// that case we have to consider the addend to determine
// the value to use in a relocation.
- section_offset_type start =
- os->starting_output_address(this, shndx);
if (!lv.is_section_symbol())
- lv.set_output_value(lv.input_value() + start);
+ lv.set_output_value(os->output_address(this, shndx,
+ lv.input_value()));
else
{
+ section_offset_type start =
+ os->starting_output_address(this, shndx);
Merged_symbol_value<size>* msv =
new Merged_symbol_value<size>(lv.input_value(), start);
lv.set_merged_symbol_value(msv);
diff --git a/gold/output.cc b/gold/output.cc
index 3d1d27e..8a9e9b3 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -1695,8 +1695,6 @@ Output_section::output_address(const Relobj* object, unsigned int shndx,
off_t offset) const
{
gold_assert(object->is_section_specially_mapped(shndx));
- // This can only be called meaningfully when layout is complete.
- gold_assert(Output_data::is_layout_complete());
uint64_t addr = this->address() + this->first_input_offset_;
for (Input_section_list::const_iterator p = this->input_sections_.begin();
diff --git a/gold/output.h b/gold/output.h
index 3d1a44d..07a336d 100644
--- a/gold/output.h
+++ b/gold/output.h
@@ -2323,7 +2323,8 @@ class Output_file
unsigned char*
get_output_view(off_t start, size_t size)
{
- gold_assert(start >= 0 && start + size <= this->file_size_);
+ gold_assert(start >= 0
+ && start + static_cast<off_t>(size) <= this->file_size_);
return this->base_ + start;
}
diff --git a/gold/reloc.cc b/gold/reloc.cc
index e9c1326..f88151f 100644
--- a/gold/reloc.cc
+++ b/gold/reloc.cc
@@ -459,7 +459,8 @@ Sized_relobj<size, big_endian>::write_sections(const unsigned char* pshdrs,
gold_assert(output_offset == -1
|| (output_offset >= 0
- && output_offset + view_size <= output_section_size));
+ && (output_offset + static_cast<off_t>(view_size)
+ <= output_section_size)));
unsigned char* view;
if (os->requires_postprocessing())