* bucomm.c (bfd_nonfatal_message): Use bfd_get_archive_filename.
(bfd_get_archive_filename): Constify param.
* bucomm.h (bfd_get_archive_filename): Update prototype.
* objcopy.c (RETURN_NONFATAL): Delete.
(copy_unknown_object): Don't call bfd_get_archive_filename for
bfd_nonfatal_message filename, instead just pass bfd.
(copy_object): Likewise.
(copy_archive, copy_file): Likewise. Expand RETURN_NONFATAL. On
bfd_close errors, do not pass the bfd to bfd_nonfatal_message.
(setup_bfd_headers): Fix error message.
+2009-01-29 Alan Modra <amodra@bigpond.net.au>
+
+ PR 9798
+ * bucomm.c (bfd_nonfatal_message): Use bfd_get_archive_filename.
+ (bfd_get_archive_filename): Constify param.
+ * bucomm.h (bfd_get_archive_filename): Update prototype.
+ * objcopy.c (RETURN_NONFATAL): Delete.
+ (copy_unknown_object): Don't call bfd_get_archive_filename for
+ bfd_nonfatal_message filename, instead just pass bfd.
+ (copy_object): Likewise.
+ (copy_archive, copy_file): Likewise. Expand RETURN_NONFATAL. On
+ bfd_close errors, do not pass the bfd to bfd_nonfatal_message.
+ (setup_bfd_headers): Fix error message.
+
2009-01-27 Nick Clifton <nickc@redhat.com>
PR 9774
2009-01-27 Nick Clifton <nickc@redhat.com>
PR 9774
/* bucomm.c -- Bin Utils COMmon code.
Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002,
/* bucomm.c -- Bin Utils COMmon code.
Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002,
+ 2003, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GNU Binutils.
Free Software Foundation, Inc.
This file is part of GNU Binutils.
if (bfd)
{
if (!filename)
if (bfd)
{
if (!filename)
- filename = bfd_get_filename (bfd);
+ filename = bfd_get_archive_filename (bfd);
if (section)
section_name = bfd_get_section_name (bfd, section);
}
if (section)
section_name = bfd_get_section_name (bfd, section);
}
/* Return the filename in a static buffer. */
const char *
/* Return the filename in a static buffer. */
const char *
-bfd_get_archive_filename (bfd *abfd)
+bfd_get_archive_filename (const bfd *abfd)
{
static size_t curr = 0;
static char *buf;
{
static size_t curr = 0;
static char *buf;
/* bucomm.h -- binutils common include file.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
/* bucomm.h -- binutils common include file.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
This file is part of GNU Binutils.
This file is part of GNU Binutils.
#define _BUCOMM_H
/* Return the filename in a static buffer. */
#define _BUCOMM_H
/* Return the filename in a static buffer. */
-const char *bfd_get_archive_filename (bfd *);
+const char *bfd_get_archive_filename (const bfd *);
void bfd_nonfatal (const char *);
void bfd_nonfatal (const char *);
/* objcopy.c -- copy object file from input to output, optionally massaging it.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
/* objcopy.c -- copy object file from input to output, optionally massaging it.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GNU Binutils.
Free Software Foundation, Inc.
This file is part of GNU Binutils.
/* List of sections to be renamed. */
static section_rename *section_rename_list;
/* List of sections to be renamed. */
static section_rename *section_rename_list;
-#define RETURN_NONFATAL(bfd) \
- do { \
- status = 1; bfd_nonfatal_message (NULL, bfd, NULL, NULL); return; \
- } while (0)
-
static asymbol **isympp = NULL; /* Input symbols. */
static asymbol **osympp = NULL; /* Output symbols that survive stripping. */
static asymbol **isympp = NULL; /* Input symbols. */
static asymbol **osympp = NULL; /* Output symbols that survive stripping. */
if (bfd_stat_arch_elt (ibfd, &buf) != 0)
{
if (bfd_stat_arch_elt (ibfd, &buf) != 0)
{
- bfd_nonfatal_message (bfd_get_archive_filename (ibfd), NULL, NULL, NULL);
+ bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
if (bfd_bread (cbuf, (bfd_size_type) tocopy, ibfd)
!= (bfd_size_type) tocopy)
{
if (bfd_bread (cbuf, (bfd_size_type) tocopy, ibfd)
!= (bfd_size_type) tocopy)
{
- bfd_nonfatal_message (bfd_get_archive_filename (ibfd),
- NULL, NULL, NULL);
+ bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
free (cbuf);
return FALSE;
}
free (cbuf);
return FALSE;
}
if (!bfd_set_start_address (obfd, start)
|| !bfd_set_file_flags (obfd, flags))
{
if (!bfd_set_start_address (obfd, start)
|| !bfd_set_file_flags (obfd, flags))
{
- bfd_nonfatal_message (bfd_get_archive_filename (ibfd),
- NULL, NULL, NULL);
+ bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
{
if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
{
- bfd_nonfatal_message (bfd_get_archive_filename (ibfd), NULL, NULL, NULL);
+ bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
symsize = bfd_get_symtab_upper_bound (ibfd);
if (symsize < 0)
{
symsize = bfd_get_symtab_upper_bound (ibfd);
if (symsize < 0)
{
- bfd_nonfatal_message (bfd_get_archive_filename (ibfd), NULL, NULL, NULL);
+ bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
} *list, *l;
bfd **ptr = &obfd->archive_head;
bfd *this_element;
} *list, *l;
bfd **ptr = &obfd->archive_head;
bfd *this_element;
+ char *dir;
+ const char *filename;
/* Make a temp directory to hold the contents. */
dir = make_tempdir (bfd_get_filename (obfd));
/* Make a temp directory to hold the contents. */
dir = make_tempdir (bfd_get_filename (obfd));
this_element = bfd_openr_next_archived_file (ibfd, NULL);
if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
this_element = bfd_openr_next_archived_file (ibfd, NULL);
if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
- RETURN_NONFATAL (obfd);
+ {
+ status = 1;
+ bfd_nonfatal_message (NULL, obfd, NULL, NULL);
+ return;
+ }
while (!status && this_element != NULL)
{
while (!status && this_element != NULL)
{
{
if (!bfd_close (output_bfd))
{
{
if (!bfd_close (output_bfd))
{
- bfd_nonfatal_message (NULL, output_bfd, NULL, NULL);
+ bfd_nonfatal_message (output_name, NULL, NULL, NULL);
/* Error in new object file. Don't change archive. */
status = 1;
}
/* Error in new object file. Don't change archive. */
status = 1;
}
- bfd_nonfatal_message (bfd_get_archive_filename (this_element),
- NULL, NULL,
+ bfd_nonfatal_message (NULL, this_element, NULL,
_("Unable to recognise the format of file"));
output_bfd = bfd_openw (output_name, output_target);
_("Unable to recognise the format of file"));
output_bfd = bfd_openw (output_name, output_target);
delete = !copy_unknown_object (this_element, output_bfd);
if (!bfd_close_all_done (output_bfd))
{
delete = !copy_unknown_object (this_element, output_bfd);
if (!bfd_close_all_done (output_bfd))
{
- bfd_nonfatal_message (NULL, output_bfd, NULL, NULL);
+ bfd_nonfatal_message (output_name, NULL, NULL, NULL);
/* Error in new object file. Don't change archive. */
status = 1;
}
/* Error in new object file. Don't change archive. */
status = 1;
}
+ filename = bfd_get_filename (obfd);
- RETURN_NONFATAL (obfd);
+ {
+ status = 1;
+ bfd_nonfatal_message (filename, NULL, NULL, NULL);
+ return;
+ }
+ filename = bfd_get_filename (ibfd);
- RETURN_NONFATAL (obfd);
+ {
+ status = 1;
+ bfd_nonfatal_message (filename, NULL, NULL, NULL);
+ return;
+ }
/* Delete all the files that we opened. */
for (l = list; l != NULL; l = l->next)
/* Delete all the files that we opened. */
for (l = list; l != NULL; l = l->next)
status = 1;
if (!bfd_close (obfd))
status = 1;
if (!bfd_close (obfd))
- RETURN_NONFATAL (obfd);
+ {
+ status = 1;
+ bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
+ return;
+ }
- RETURN_NONFATAL (ibfd);
+ {
+ status = 1;
+ bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
+ return;
+ }
{
status = 1;
bfd_nonfatal_message (NULL, ibfd, NULL,
{
status = 1;
bfd_nonfatal_message (NULL, ibfd, NULL,
- _("error in private h eader data"));
+ _("error in private header data"));