aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-06-25 17:10:08 +0000
committerCary Coutant <ccoutant@google.com>2008-06-25 17:10:08 +0000
commit3f2e6a2da5d9348efaa98eb06c430bec5fbe596b (patch)
treebcc83ddeb7ca9e2c1b44767bb6246ffecd594b92 /gold
parentc8187e1509b28d4d9c0bbc2de688144ef80537c0 (diff)
downloadgdb-3f2e6a2da5d9348efaa98eb06c430bec5fbe596b.zip
gdb-3f2e6a2da5d9348efaa98eb06c430bec5fbe596b.tar.gz
gdb-3f2e6a2da5d9348efaa98eb06c430bec5fbe596b.tar.bz2
2008-06-25 Cary Coutant <ccoutant@google.com>
* fileread.cc (File_read::make_view): Assert on zero-length view. * object.cc (Sized_relobj::do_read_symbols): Don't try to read symbol table when there are no symbols to read.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/fileread.cc2
-rw-r--r--gold/object.cc6
3 files changed, 14 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 22f549b..b8d8118 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-25 Cary Coutant <ccoutant@google.com>
+
+ * fileread.cc (File_read::make_view): Assert on zero-length view.
+ * object.cc (Sized_relobj::do_read_symbols): Don't try to read
+ symbol table when there are no symbols to read.
+
2008-06-23 Craig Silverstein <csilvers@google.com>
* version.cc (version_string): Bump to 1.7
diff --git a/gold/fileread.cc b/gold/fileread.cc
index 6cb056f..cfe0ee6 100644
--- a/gold/fileread.cc
+++ b/gold/fileread.cc
@@ -327,6 +327,8 @@ File_read::View*
File_read::make_view(off_t start, section_size_type size,
unsigned int byteshift, bool cache)
{
+ gold_assert(size > 0);
+
off_t poff = File_read::page_offset(start);
section_size_type psize = File_read::pages(size + (start - poff));
diff --git a/gold/object.cc b/gold/object.cc
index b49bee1..8659cb2 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -452,6 +452,12 @@ Sized_relobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
off_t readoff = this->has_eh_frame_ ? dataoff : extoff;
section_size_type readsize = this->has_eh_frame_ ? datasize : extsize;
+ if (readsize == 0)
+ {
+ // No external symbols. Also weird but also legal.
+ return;
+ }
+
File_view* fvsymtab = this->get_lasting_view(readoff, readsize, true, false);
// Read the section header for the symbol names.