mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 02:24:46 +08:00
bfd/
* opncls.c (bfd_openr_iovec): Add "stat" parameter. (struct opncls): Add "stat" field. (opncls_bstat): Call vec->stat. * bfd-in2.h: Regenerate. * elf32-spu.c (spu_elf_open_builtin_lib): Adjust. gdb/ * spu-linux-nat.c (spu_bfd_iovec_stat): New function. (spu_bfd_open): Adjust bfd_openr_iovec call.
This commit is contained in:
parent
263c8770d6
commit
f6cf9273b3
@ -1,3 +1,11 @@
|
|||||||
|
2006-12-15 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* opncls.c (bfd_openr_iovec): Add "stat" parameter.
|
||||||
|
(struct opncls): Add "stat" field.
|
||||||
|
(opncls_bstat): Call vec->stat.
|
||||||
|
* bfd-in2.h: Regenerate.
|
||||||
|
* elf32-spu.c (spu_elf_open_builtin_lib): Adjust.
|
||||||
|
|
||||||
2006-12-14 Alan Modra <amodra@bigpond.net.au>
|
2006-12-14 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
* elf-bfd.h (struct bfd_elf_section_data): Clarify sec_group
|
* elf-bfd.h (struct bfd_elf_section_data): Clarify sec_group
|
||||||
|
@ -970,7 +970,10 @@ bfd *bfd_openr_iovec (const char *filename, const char *target,
|
|||||||
file_ptr nbytes,
|
file_ptr nbytes,
|
||||||
file_ptr offset),
|
file_ptr offset),
|
||||||
int (*close) (struct bfd *nbfd,
|
int (*close) (struct bfd *nbfd,
|
||||||
void *stream));
|
void *stream),
|
||||||
|
int (*stat) (struct bfd *abfd,
|
||||||
|
void *stream,
|
||||||
|
struct stat *sb));
|
||||||
|
|
||||||
bfd *bfd_openw (const char *filename, const char *target);
|
bfd *bfd_openw (const char *filename, const char *target);
|
||||||
|
|
||||||
|
@ -1090,6 +1090,7 @@ spu_elf_open_builtin_lib (bfd **ovl_bfd, const struct _ovl_stream *stream)
|
|||||||
ovl_mgr_open,
|
ovl_mgr_open,
|
||||||
(void *) stream,
|
(void *) stream,
|
||||||
ovl_mgr_pread,
|
ovl_mgr_pread,
|
||||||
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
return *ovl_bfd != NULL;
|
return *ovl_bfd != NULL;
|
||||||
}
|
}
|
||||||
|
25
bfd/opncls.c
25
bfd/opncls.c
@ -384,7 +384,10 @@ SYNOPSIS
|
|||||||
file_ptr nbytes,
|
file_ptr nbytes,
|
||||||
file_ptr offset),
|
file_ptr offset),
|
||||||
int (*close) (struct bfd *nbfd,
|
int (*close) (struct bfd *nbfd,
|
||||||
void *stream));
|
void *stream),
|
||||||
|
int (*stat) (struct bfd *abfd,
|
||||||
|
void *stream,
|
||||||
|
struct stat *sb));
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|
||||||
@ -411,6 +414,10 @@ DESCRIPTION
|
|||||||
<<bfd_close>>. @var{close} either succeeds returning 0, or
|
<<bfd_close>>. @var{close} either succeeds returning 0, or
|
||||||
fails returning -1 (setting <<bfd_error>>).
|
fails returning -1 (setting <<bfd_error>>).
|
||||||
|
|
||||||
|
Calls @var{stat} to fill in a stat structure for bfd_stat,
|
||||||
|
bfd_get_size, and bfd_get_mtime calls. @var{stat} returns 0
|
||||||
|
on success, or returns -1 on failure (setting <<bfd_error>>).
|
||||||
|
|
||||||
If <<bfd_openr_iovec>> returns <<NULL>> then an error has
|
If <<bfd_openr_iovec>> returns <<NULL>> then an error has
|
||||||
occurred. Possible errors are <<bfd_error_no_memory>>,
|
occurred. Possible errors are <<bfd_error_no_memory>>,
|
||||||
<<bfd_error_invalid_target>> and <<bfd_error_system_call>>.
|
<<bfd_error_invalid_target>> and <<bfd_error_system_call>>.
|
||||||
@ -423,6 +430,7 @@ struct opncls
|
|||||||
file_ptr (*pread) (struct bfd *abfd, void *stream, void *buf,
|
file_ptr (*pread) (struct bfd *abfd, void *stream, void *buf,
|
||||||
file_ptr nbytes, file_ptr offset);
|
file_ptr nbytes, file_ptr offset);
|
||||||
int (*close) (struct bfd *abfd, void *stream);
|
int (*close) (struct bfd *abfd, void *stream);
|
||||||
|
int (*stat) (struct bfd *abfd, void *stream, struct stat *sb);
|
||||||
file_ptr where;
|
file_ptr where;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -485,10 +493,15 @@ opncls_bflush (struct bfd *abfd ATTRIBUTE_UNUSED)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
opncls_bstat (struct bfd *abfd ATTRIBUTE_UNUSED, struct stat *sb)
|
opncls_bstat (struct bfd *abfd, struct stat *sb)
|
||||||
{
|
{
|
||||||
|
struct opncls *vec = abfd->iostream;
|
||||||
|
|
||||||
memset (sb, 0, sizeof (*sb));
|
memset (sb, 0, sizeof (*sb));
|
||||||
return 0;
|
if (vec->stat == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return (vec->stat) (abfd, vec->stream, sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct bfd_iovec opncls_iovec = {
|
static const struct bfd_iovec opncls_iovec = {
|
||||||
@ -507,7 +520,10 @@ bfd_openr_iovec (const char *filename, const char *target,
|
|||||||
file_ptr nbytes,
|
file_ptr nbytes,
|
||||||
file_ptr offset),
|
file_ptr offset),
|
||||||
int (*close) (struct bfd *nbfd,
|
int (*close) (struct bfd *nbfd,
|
||||||
void *stream))
|
void *stream),
|
||||||
|
int (*stat) (struct bfd *abfd,
|
||||||
|
void *stream,
|
||||||
|
struct stat *sb))
|
||||||
{
|
{
|
||||||
bfd *nbfd;
|
bfd *nbfd;
|
||||||
const bfd_target *target_vec;
|
const bfd_target *target_vec;
|
||||||
@ -539,6 +555,7 @@ bfd_openr_iovec (const char *filename, const char *target,
|
|||||||
vec->stream = stream;
|
vec->stream = stream;
|
||||||
vec->pread = pread;
|
vec->pread = pread;
|
||||||
vec->close = close;
|
vec->close = close;
|
||||||
|
vec->stat = stat;
|
||||||
|
|
||||||
nbfd->iovec = &opncls_iovec;
|
nbfd->iovec = &opncls_iovec;
|
||||||
nbfd->iostream = vec;
|
nbfd->iostream = vec;
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2006-12-15 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* spu-linux-nat.c (spu_bfd_iovec_stat): New function.
|
||||||
|
(spu_bfd_open): Adjust bfd_openr_iovec call.
|
||||||
|
|
||||||
2006-12-13 Jim Blandy <jimb@codesourcery.com>
|
2006-12-13 Jim Blandy <jimb@codesourcery.com>
|
||||||
|
|
||||||
* value.c (value_copy): Copy the full 'location' contents, instead
|
* value.c (value_copy): Copy the full 'location' contents, instead
|
||||||
|
@ -281,6 +281,18 @@ spu_bfd_iovec_pread (struct bfd *abfd, void *stream, void *buf,
|
|||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
spu_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb)
|
||||||
|
{
|
||||||
|
/* We don't have an easy way of finding the size of embedded spu
|
||||||
|
images. We could parse the in-memory ELF header and section
|
||||||
|
table to find the extent of the last section but that seems
|
||||||
|
pointless when the size is needed only for checks of other
|
||||||
|
parsed values in dbxread.c. */
|
||||||
|
sb->st_size = INT_MAX;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static bfd *
|
static bfd *
|
||||||
spu_bfd_open (CORE_ADDR addr)
|
spu_bfd_open (CORE_ADDR addr)
|
||||||
{
|
{
|
||||||
@ -291,7 +303,8 @@ spu_bfd_open (CORE_ADDR addr)
|
|||||||
|
|
||||||
nbfd = bfd_openr_iovec (xstrdup ("<in-memory>"), "elf32-spu",
|
nbfd = bfd_openr_iovec (xstrdup ("<in-memory>"), "elf32-spu",
|
||||||
spu_bfd_iovec_open, open_closure,
|
spu_bfd_iovec_open, open_closure,
|
||||||
spu_bfd_iovec_pread, spu_bfd_iovec_close);
|
spu_bfd_iovec_pread, spu_bfd_iovec_close,
|
||||||
|
spu_bfd_iovec_stat);
|
||||||
if (!nbfd)
|
if (!nbfd)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user