aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-spu.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-11-04 13:39:38 +1030
committerAlan Modra <amodra@gmail.com>2014-11-04 22:36:13 +1030
commitef42b83ec01d65286ba2906ef66caa3b943108dd (patch)
treecf9ab148004396f299e27bdcd04b288053e84357 /bfd/elf32-spu.c
parent049b0c3a2467c785f9068915d81fdba4985470bf (diff)
downloadgdb-ef42b83ec01d65286ba2906ef66caa3b943108dd.zip
gdb-ef42b83ec01d65286ba2906ef66caa3b943108dd.tar.gz
gdb-ef42b83ec01d65286ba2906ef66caa3b943108dd.tar.bz2
Provide stat function for spu overlay manager iovec
Commit f54498b4 broke spu-elf, specifically the change "Do not try to load a string table bigger than the file", because bfd_get_size returns zero for the spu built-in overlay manager bfd. * elf32-spu.c (ovl_mgr_stat): New function. (spu_elf_open_builtin_lib): Pass to bfd_openr_iovec.
Diffstat (limited to 'bfd/elf32-spu.c')
-rw-r--r--bfd/elf32-spu.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 13806ad..ebc9e6a 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -1828,6 +1828,18 @@ ovl_mgr_pread (struct bfd *abfd ATTRIBUTE_UNUSED,
return count;
}
+static int
+ovl_mgr_stat (struct bfd *abfd ATTRIBUTE_UNUSED,
+ void *stream,
+ struct stat *sb)
+{
+ struct _ovl_stream *os = (struct _ovl_stream *) stream;
+
+ memset (sb, 0, sizeof (*sb));
+ sb->st_size = (const char *) os->end - (const char *) os->start;
+ return 0;
+}
+
bfd_boolean
spu_elf_open_builtin_lib (bfd **ovl_bfd, const struct _ovl_stream *stream)
{
@@ -1837,7 +1849,7 @@ spu_elf_open_builtin_lib (bfd **ovl_bfd, const struct _ovl_stream *stream)
(void *) stream,
ovl_mgr_pread,
NULL,
- NULL);
+ ovl_mgr_stat);
return *ovl_bfd != NULL;
}