This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Patch] objdump/xcoff: allow missing string table length
- From: Tristan Gingold <gingold at adacore dot com>
- To: binutils Development <binutils at sourceware dot org>
- Date: Thu, 9 Jun 2011 12:12:52 +0200
- Subject: [Patch] objdump/xcoff: allow missing string table length
Hi,
The AIX assembler/compiler doesn't write the symbol string table length field if there is no symbols.
In such case, objdump -P syms fails to read the symbol table, which is a bug.
This patch fixes this issue.
No testcase as gas doesn't generate such files.
Ok for trunk ?
Tristan.
binutils/
2011-06-09 Tristan Gingold <gingold@adacore.com>
* od-xcoff.c (xcoff32_read_symbols): Allow missing string table length.
diff --git a/binutils/od-xcoff.c b/binutils/od-xcoff.c
index 47d0248..8884894 100644
--- a/binutils/od-xcoff.c
+++ b/binutils/od-xcoff.c
@@ -639,17 +639,14 @@ xcoff32_read_symbols (bfd *abfd, struct xcoff_dump *data)
+ data->nsyms * (unsigned)sizeof (struct external_syment);
/* Read string table. */
- if (bfd_seek (abfd, stptr, SEEK_SET) != 0)
+ if (bfd_seek (abfd, stptr, SEEK_SET) != 0
+ || bfd_bread (&stsz_arr, sizeof (stsz_arr), abfd) != sizeof (stsz_arr))
{
+ non_fatal (_("cannot read strings table len"));
data->strings_size = 0;
}
else
{
- if (bfd_bread (&stsz_arr, sizeof (stsz_arr), abfd) != sizeof (stsz_arr))
- {
- non_fatal (_("cannot read strings table len"));
- return;
- }
data->strings_size = bfd_h_get_32 (abfd, stsz_arr);
if (data->strings_size > sizeof (stsz_arr))
{