aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-06-23 07:19:35 +0000
committerIan Lance Taylor <ian@airs.com>2009-06-23 07:19:35 +0000
commit8d63875c54e54fa171c2fbe9ff5611d57d334875 (patch)
tree629ad0ffd13c9d8f0433f1db38e625eeb79dfff5 /gold
parentf7c8a183e8d2c83eddadddb3b473338abf30a1d5 (diff)
downloadgdb-8d63875c54e54fa171c2fbe9ff5611d57d334875.zip
gdb-8d63875c54e54fa171c2fbe9ff5611d57d334875.tar.gz
gdb-8d63875c54e54fa171c2fbe9ff5611d57d334875.tar.bz2
PR 10147
* object.cc (Object::section_contents): Don't try to get a view if the section has length zero. (Object::handle_gnu_warning_section): If the section is empty, use the name of the section as the warning.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog8
-rw-r--r--gold/object.cc11
2 files changed, 19 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index c62aa99..b4d7ee6 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,13 @@
2009-06-23 Ian Lance Taylor <iant@google.com>
+ PR 10147
+ * object.cc (Object::section_contents): Don't try to get a view if
+ the section has length zero.
+ (Object::handle_gnu_warning_section): If the section is empty, use
+ the name of the section as the warning.
+
+2009-06-23 Ian Lance Taylor <iant@google.com>
+
PR 10133
* stringpool.h (class Stringpool_template): Add optimize_ field.
(Stringpool_template::set_optimize): New function.
diff --git a/gold/object.cc b/gold/object.cc
index c3c9c7bcf..75e5a2e 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -170,6 +170,11 @@ Object::section_contents(unsigned int shndx, section_size_type* plen,
{
Location loc(this->do_section_contents(shndx));
*plen = convert_to_section_size_type(loc.data_size);
+ if (*plen == 0)
+ {
+ static const unsigned char empty[1] = { '\0' };
+ return empty;
+ }
return this->get_view(loc.file_offset, *plen, true, cache);
}
@@ -226,6 +231,12 @@ Object::handle_gnu_warning_section(const char* name, unsigned int shndx,
section_size_type len;
const unsigned char* contents = this->section_contents(shndx, &len,
false);
+ if (len == 0)
+ {
+ const char* warning = name + warn_prefix_len;
+ contents = reinterpret_cast<const unsigned char*>(warning);
+ len = strlen(warning);
+ }
std::string warning(reinterpret_cast<const char*>(contents), len);
symtab->add_warning(name + warn_prefix_len, this, warning);
return true;