* bucomm.c (bfd_nonfatal_message): New.
* bucomm.h (bfd_nonfatal_message): Declare. * objcopy.c (RETURN_NONFATAL): Take BFD not NAME, use bfd_nonfatal_message. (copy_unknown_object): Adjust bfd_nonfatal and RETURN_NONFATAL calls, or replace with bfd_nonfatal_message calls as appropriate. (copy_object, copy_archive, copy_file, setup_section, copy_section, write_debugging_info): Likewise.
This commit is contained in:
parent
876d4bfa30
commit
2db6cde736
4 changed files with 172 additions and 78 deletions
|
@ -1,3 +1,14 @@
|
|||
2007-08-30 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* bucomm.c (bfd_nonfatal_message): New.
|
||||
* bucomm.h (bfd_nonfatal_message): Declare.
|
||||
* objcopy.c (RETURN_NONFATAL): Take BFD not NAME, use
|
||||
bfd_nonfatal_message.
|
||||
(copy_unknown_object): Adjust bfd_nonfatal and RETURN_NONFATAL
|
||||
calls, or replace with bfd_nonfatal_message calls as appropriate.
|
||||
(copy_object, copy_archive, copy_file, setup_section,
|
||||
copy_section, write_debugging_info): Likewise.
|
||||
|
||||
2007-08-28 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* NEWS: Mention Coverity's contribution.
|
||||
|
|
|
@ -60,6 +60,52 @@ bfd_nonfatal (const char *string)
|
|||
fprintf (stderr, "%s: %s\n", program_name, errmsg);
|
||||
}
|
||||
|
||||
/* Issue a non fatal error message. FILENAME, or if NULL then BFD,
|
||||
are used to indicate the problematic file. SECTION, if non NULL,
|
||||
is used to provide a section name. If FORMAT is non-null, then it
|
||||
is used to print additional information via vfprintf. Finally the
|
||||
bfd error message is printed. In summary, error messages are of
|
||||
one of the following forms:
|
||||
|
||||
PROGRAM:file: bfd-error-message
|
||||
PROGRAM:file[section]: bfd-error-message
|
||||
PROGRAM:file: printf-message: bfd-error-message
|
||||
PROGRAM:file[section]: printf-message: bfd-error-message
|
||||
*/
|
||||
|
||||
void
|
||||
bfd_nonfatal_message (const char *filename,
|
||||
const bfd *bfd, const asection *section,
|
||||
const char *format, ...)
|
||||
{
|
||||
const char *errmsg = bfd_errmsg (bfd_get_error ());
|
||||
const char *section_name = NULL;
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
fprintf (stderr, "%s", program_name);
|
||||
|
||||
if (bfd)
|
||||
{
|
||||
if (!filename)
|
||||
filename = bfd_get_filename (bfd);
|
||||
if (section)
|
||||
section_name = bfd_get_section_name (bfd, section);
|
||||
}
|
||||
if (section_name)
|
||||
fprintf (stderr, ":%s[%s]", filename, section_name);
|
||||
else
|
||||
fprintf (stderr, ":%s", filename);
|
||||
|
||||
if (format)
|
||||
{
|
||||
fprintf (stderr, ": ");
|
||||
vfprintf (stderr, format, args);
|
||||
}
|
||||
fprintf (stderr, ": %s\n", errmsg);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
bfd_fatal (const char *string)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,9 @@ const char *bfd_get_archive_filename (bfd *);
|
|||
|
||||
void bfd_nonfatal (const char *);
|
||||
|
||||
void bfd_nonfatal_message (const char *, const bfd *, const asection *,
|
||||
const char *, ...);
|
||||
|
||||
void bfd_fatal (const char *) ATTRIBUTE_NORETURN;
|
||||
|
||||
void report (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
|
||||
|
|
|
@ -64,7 +64,10 @@ section_rename;
|
|||
/* List of sections to be renamed. */
|
||||
static section_rename *section_rename_list;
|
||||
|
||||
#define RETURN_NONFATAL(s) {bfd_nonfatal (s); status = 1; return;}
|
||||
#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. */
|
||||
|
@ -1254,7 +1257,7 @@ copy_unknown_object (bfd *ibfd, bfd *obfd)
|
|||
|
||||
if (bfd_stat_arch_elt (ibfd, &buf) != 0)
|
||||
{
|
||||
bfd_nonfatal (bfd_get_archive_filename (ibfd));
|
||||
bfd_nonfatal_message (bfd_get_archive_filename (ibfd), NULL, NULL, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1287,7 +1290,8 @@ copy_unknown_object (bfd *ibfd, bfd *obfd)
|
|||
if (bfd_bread (cbuf, (bfd_size_type) tocopy, ibfd)
|
||||
!= (bfd_size_type) tocopy)
|
||||
{
|
||||
bfd_nonfatal (bfd_get_archive_filename (ibfd));
|
||||
bfd_nonfatal_message (bfd_get_archive_filename (ibfd),
|
||||
NULL, NULL, NULL);
|
||||
free (cbuf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1295,7 +1299,7 @@ copy_unknown_object (bfd *ibfd, bfd *obfd)
|
|||
if (bfd_bwrite (cbuf, (bfd_size_type) tocopy, obfd)
|
||||
!= (bfd_size_type) tocopy)
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (obfd));
|
||||
bfd_nonfatal_message (NULL, obfd, NULL, NULL);
|
||||
free (cbuf);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1332,7 +1336,7 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
|
||||
if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (obfd));
|
||||
bfd_nonfatal_message (NULL, obfd, NULL, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1366,7 +1370,8 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
if (!bfd_set_start_address (obfd, start)
|
||||
|| !bfd_set_file_flags (obfd, flags))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_archive_filename (ibfd));
|
||||
bfd_nonfatal_message (bfd_get_archive_filename (ibfd),
|
||||
NULL, NULL, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -1390,7 +1395,7 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
|
||||
if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_archive_filename (ibfd));
|
||||
bfd_nonfatal_message (bfd_get_archive_filename (ibfd), NULL, NULL, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1406,7 +1411,7 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
symsize = bfd_get_symtab_upper_bound (ibfd);
|
||||
if (symsize < 0)
|
||||
{
|
||||
bfd_nonfatal (bfd_get_archive_filename (ibfd));
|
||||
bfd_nonfatal_message (bfd_get_archive_filename (ibfd), NULL, NULL, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1414,7 +1419,7 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
symcount = bfd_canonicalize_symtab (ibfd, isympp);
|
||||
if (symcount < 0)
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (ibfd));
|
||||
bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1445,7 +1450,8 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
error codes, so check for the most likely user error first. */
|
||||
if (bfd_get_section_by_name (obfd, padd->name))
|
||||
{
|
||||
non_fatal (_("can't add section '%s' - it already exists!"), padd->name);
|
||||
bfd_nonfatal_message (NULL, obfd, NULL,
|
||||
_("can't add section '%s'"), padd->name);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
@ -1453,15 +1459,16 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
padd->section = bfd_make_section_with_flags (obfd, padd->name, flags);
|
||||
if (padd->section == NULL)
|
||||
{
|
||||
non_fatal (_("can't create section `%s': %s"),
|
||||
padd->name, bfd_errmsg (bfd_get_error ()));
|
||||
bfd_nonfatal_message (NULL, obfd, NULL,
|
||||
_("can't create section `%s'"),
|
||||
padd->name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (! bfd_set_section_size (obfd, padd->section, padd->size))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (obfd));
|
||||
bfd_nonfatal_message (NULL, obfd, padd->section, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1471,7 +1478,7 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
if (! bfd_set_section_vma (obfd, padd->section,
|
||||
pset->vma_val))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (obfd));
|
||||
bfd_nonfatal_message (NULL, obfd, padd->section, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1483,7 +1490,7 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
(obfd, padd->section,
|
||||
bfd_section_alignment (obfd, padd->section)))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (obfd));
|
||||
bfd_nonfatal_message (NULL, obfd, padd->section, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -1498,7 +1505,9 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
|
||||
if (gnu_debuglink_section == NULL)
|
||||
{
|
||||
bfd_nonfatal (gnu_debuglink_filename);
|
||||
bfd_nonfatal_message (NULL, obfd, NULL,
|
||||
_("cannot create debug link section `%s'"),
|
||||
gnu_debuglink_filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1589,9 +1598,8 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
if (! bfd_set_section_size (obfd, osections[i],
|
||||
size + (gap_stop - gap_start)))
|
||||
{
|
||||
non_fatal (_("Can't fill gap after %s: %s"),
|
||||
bfd_get_section_name (obfd, osections[i]),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
bfd_nonfatal_message (NULL, obfd, osections[i],
|
||||
_("Can't fill gap after section"));
|
||||
status = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -1614,9 +1622,8 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
if (! bfd_set_section_size (obfd, osections[c - 1],
|
||||
pad_to - lma))
|
||||
{
|
||||
non_fatal (_("Can't add padding to %s: %s"),
|
||||
bfd_get_section_name (obfd, osections[c - 1]),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
bfd_nonfatal_message (NULL, obfd, osections[c - 1],
|
||||
_("can't add padding"));
|
||||
status = 1;
|
||||
}
|
||||
else
|
||||
|
@ -1695,7 +1702,7 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
if (! bfd_set_section_contents (obfd, padd->section, padd->contents,
|
||||
0, padd->size))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (obfd));
|
||||
bfd_nonfatal_message (NULL, obfd, padd->section, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -1706,7 +1713,9 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
if (! bfd_fill_in_gnu_debuglink_section
|
||||
(obfd, gnu_debuglink_section, gnu_debuglink_filename))
|
||||
{
|
||||
bfd_nonfatal (gnu_debuglink_filename);
|
||||
bfd_nonfatal_message (NULL, obfd, NULL,
|
||||
_("cannot fill debug link section `%s'"),
|
||||
gnu_debuglink_filename);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -1745,7 +1754,7 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
if (! bfd_set_section_contents (obfd, osections[i], buf,
|
||||
off, now))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (obfd));
|
||||
bfd_nonfatal_message (NULL, obfd, osections[i], NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1767,9 +1776,8 @@ copy_object (bfd *ibfd, bfd *obfd)
|
|||
important for the ECOFF code at least. */
|
||||
if (! bfd_copy_private_bfd_data (ibfd, obfd))
|
||||
{
|
||||
non_fatal (_("%s: error copying private BFD data: %s"),
|
||||
bfd_get_filename (obfd),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
bfd_nonfatal_message (NULL, obfd, NULL,
|
||||
_("error copying private BFD data"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1828,7 +1836,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
|
|||
this_element = bfd_openr_next_archived_file (ibfd, NULL);
|
||||
|
||||
if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
|
||||
RETURN_NONFATAL (bfd_get_filename (obfd));
|
||||
RETURN_NONFATAL (obfd);
|
||||
|
||||
while (!status && this_element != NULL)
|
||||
{
|
||||
|
@ -1885,7 +1893,11 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
|
|||
output_bfd = bfd_openw (output_name, bfd_get_target (this_element));
|
||||
|
||||
if (output_bfd == NULL)
|
||||
RETURN_NONFATAL (output_name);
|
||||
{
|
||||
bfd_nonfatal_message (output_name, NULL, NULL, NULL);
|
||||
status = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
delete = ! copy_object (this_element, output_bfd);
|
||||
|
||||
|
@ -1894,7 +1906,7 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
|
|||
{
|
||||
if (!bfd_close (output_bfd))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (output_bfd));
|
||||
bfd_nonfatal_message (NULL, output_bfd, NULL, NULL);
|
||||
/* Error in new object file. Don't change archive. */
|
||||
status = 1;
|
||||
}
|
||||
|
@ -1904,15 +1916,16 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
|
|||
}
|
||||
else
|
||||
{
|
||||
non_fatal (_("Unable to recognise the format of the input file `%s'"),
|
||||
bfd_get_archive_filename (this_element));
|
||||
bfd_nonfatal_message (bfd_get_archive_filename (this_element),
|
||||
NULL, NULL,
|
||||
_("Unable to recognise the format of file"));
|
||||
|
||||
output_bfd = bfd_openw (output_name, output_target);
|
||||
copy_unknown_element:
|
||||
delete = !copy_unknown_object (this_element, output_bfd);
|
||||
if (!bfd_close_all_done (output_bfd))
|
||||
{
|
||||
bfd_nonfatal (bfd_get_filename (output_bfd));
|
||||
bfd_nonfatal_message (NULL, output_bfd, NULL, NULL);
|
||||
/* Error in new object file. Don't change archive. */
|
||||
status = 1;
|
||||
}
|
||||
|
@ -1946,10 +1959,10 @@ copy_unknown_element:
|
|||
*ptr = NULL;
|
||||
|
||||
if (!bfd_close (obfd))
|
||||
RETURN_NONFATAL (bfd_get_filename (obfd));
|
||||
RETURN_NONFATAL (obfd);
|
||||
|
||||
if (!bfd_close (ibfd))
|
||||
RETURN_NONFATAL (bfd_get_filename (ibfd));
|
||||
RETURN_NONFATAL (obfd);
|
||||
|
||||
/* Delete all the files that we opened. */
|
||||
for (l = list; l != NULL; l = l->next)
|
||||
|
@ -1985,7 +1998,11 @@ copy_file (const char *input_filename, const char *output_filename,
|
|||
non-object file, failures are nonfatal. */
|
||||
ibfd = bfd_openr (input_filename, input_target);
|
||||
if (ibfd == NULL)
|
||||
RETURN_NONFATAL (input_filename);
|
||||
{
|
||||
bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
|
||||
status = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bfd_check_format (ibfd, bfd_archive))
|
||||
{
|
||||
|
@ -2004,7 +2021,11 @@ copy_file (const char *input_filename, const char *output_filename,
|
|||
|
||||
obfd = bfd_openw (output_filename, output_target);
|
||||
if (obfd == NULL)
|
||||
RETURN_NONFATAL (output_filename);
|
||||
{
|
||||
bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
|
||||
status = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
copy_archive (ibfd, obfd, output_target, force_output_target);
|
||||
}
|
||||
|
@ -2020,17 +2041,20 @@ copy_file (const char *input_filename, const char *output_filename,
|
|||
|
||||
obfd = bfd_openw (output_filename, output_target);
|
||||
if (obfd == NULL)
|
||||
RETURN_NONFATAL (output_filename);
|
||||
{
|
||||
bfd_nonfatal_message (output_filename, NULL, NULL, NULL);
|
||||
status = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (! copy_object (ibfd, obfd))
|
||||
status = 1;
|
||||
|
||||
if (!bfd_close (obfd))
|
||||
RETURN_NONFATAL (output_filename);
|
||||
RETURN_NONFATAL (obfd);
|
||||
|
||||
if (!bfd_close (ibfd))
|
||||
RETURN_NONFATAL (input_filename);
|
||||
|
||||
RETURN_NONFATAL (ibfd);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2050,7 +2074,7 @@ copy_file (const char *input_filename, const char *output_filename,
|
|||
if (obj_error != core_error)
|
||||
bfd_set_error (obj_error);
|
||||
|
||||
bfd_nonfatal (input_filename);
|
||||
bfd_nonfatal_message (input_filename, NULL, NULL, NULL);
|
||||
|
||||
if (obj_error == bfd_error_file_ambiguously_recognized)
|
||||
{
|
||||
|
@ -2129,24 +2153,18 @@ find_section_rename (bfd * ibfd ATTRIBUTE_UNUSED, sec_ptr isection,
|
|||
static void
|
||||
setup_bfd_headers (bfd *ibfd, bfd *obfd)
|
||||
{
|
||||
const char *err;
|
||||
|
||||
/* Allow the BFD backend to copy any private data it understands
|
||||
from the input section to the output section. */
|
||||
if (! bfd_copy_private_header_data (ibfd, obfd))
|
||||
{
|
||||
err = _("private header data");
|
||||
goto loser;
|
||||
status = 1;
|
||||
bfd_nonfatal_message (NULL, ibfd, NULL,
|
||||
_("error in private h eader data"));
|
||||
return;
|
||||
}
|
||||
|
||||
/* All went well. */
|
||||
return;
|
||||
|
||||
loser:
|
||||
non_fatal (_("%s: error in %s: %s"),
|
||||
bfd_get_filename (ibfd),
|
||||
err, bfd_errmsg (bfd_get_error ()));
|
||||
status = 1;
|
||||
}
|
||||
|
||||
/* Create a section in OBFD with the same
|
||||
|
@ -2219,7 +2237,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
|
||||
if (osection == NULL)
|
||||
{
|
||||
err = _("making");
|
||||
err = _("failed to create output section");
|
||||
goto loser;
|
||||
}
|
||||
|
||||
|
@ -2233,7 +2251,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
size = 0;
|
||||
if (! bfd_set_section_size (obfd, osection, size))
|
||||
{
|
||||
err = _("size");
|
||||
err = _("failed to set size");
|
||||
goto loser;
|
||||
}
|
||||
|
||||
|
@ -2247,7 +2265,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
|
||||
if (! bfd_set_section_vma (obfd, osection, extract_symbol ? 0 : vma))
|
||||
{
|
||||
err = _("vma");
|
||||
err = _("failed to set vma");
|
||||
goto loser;
|
||||
}
|
||||
|
||||
|
@ -2272,7 +2290,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
osection,
|
||||
bfd_section_alignment (ibfd, isection)))
|
||||
{
|
||||
err = _("alignment");
|
||||
err = _("failed to set alignment");
|
||||
goto loser;
|
||||
}
|
||||
|
||||
|
@ -2294,7 +2312,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
from the input section to the output section. */
|
||||
if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
|
||||
{
|
||||
err = _("private data");
|
||||
err = _("failed to copy private data");
|
||||
goto loser;
|
||||
}
|
||||
else if ((isection->flags & SEC_GROUP) != 0)
|
||||
|
@ -2309,11 +2327,8 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
return;
|
||||
|
||||
loser:
|
||||
non_fatal (_("%s: section `%s': error in %s: %s"),
|
||||
bfd_get_filename (ibfd),
|
||||
bfd_section_name (ibfd, isection),
|
||||
err, bfd_errmsg (bfd_get_error ()));
|
||||
status = 1;
|
||||
bfd_nonfatal_message (NULL, obfd, osection, err);
|
||||
}
|
||||
|
||||
/* Copy the data of input section ISECTION of IBFD
|
||||
|
@ -2365,7 +2380,11 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
if (relsize == -1 && bfd_get_error () == bfd_error_invalid_operation)
|
||||
relsize = 0;
|
||||
else
|
||||
RETURN_NONFATAL (bfd_get_filename (ibfd));
|
||||
{
|
||||
status = 1;
|
||||
bfd_nonfatal_message (NULL, ibfd, isection, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2376,7 +2395,12 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
relpp = xmalloc (relsize);
|
||||
relcount = bfd_canonicalize_reloc (ibfd, isection, relpp, isympp);
|
||||
if (relcount < 0)
|
||||
RETURN_NONFATAL (bfd_get_filename (ibfd));
|
||||
{
|
||||
status = 1;
|
||||
bfd_nonfatal_message (NULL, ibfd, isection,
|
||||
_("relocation count is negative"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (strip_symbols == STRIP_ALL)
|
||||
{
|
||||
|
@ -2410,7 +2434,11 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
void *memhunk = xmalloc (size);
|
||||
|
||||
if (!bfd_get_section_contents (ibfd, isection, memhunk, 0, size))
|
||||
RETURN_NONFATAL (bfd_get_filename (ibfd));
|
||||
{
|
||||
status = 1;
|
||||
bfd_nonfatal_message (NULL, ibfd, isection, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (reverse_bytes)
|
||||
{
|
||||
|
@ -2453,8 +2481,11 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
}
|
||||
|
||||
if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
|
||||
RETURN_NONFATAL (bfd_get_filename (obfd));
|
||||
|
||||
{
|
||||
status = 1;
|
||||
bfd_nonfatal_message (NULL, obfd, osection, NULL);
|
||||
return;
|
||||
}
|
||||
free (memhunk);
|
||||
}
|
||||
else if (p != NULL && p->set_flags && (p->flags & SEC_HAS_CONTENTS) != 0)
|
||||
|
@ -2469,7 +2500,11 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
|
||||
memset (memhunk, 0, size);
|
||||
if (! bfd_set_section_contents (obfd, osection, memhunk, 0, size))
|
||||
RETURN_NONFATAL (bfd_get_filename (obfd));
|
||||
{
|
||||
status = 1;
|
||||
bfd_nonfatal_message (NULL, obfd, osection, NULL);
|
||||
return;
|
||||
}
|
||||
free (memhunk);
|
||||
}
|
||||
}
|
||||
|
@ -2610,9 +2645,8 @@ write_debugging_info (bfd *obfd, void *dhandle,
|
|||
|| ! bfd_set_section_alignment (obfd, stabsec, 2)
|
||||
|| ! bfd_set_section_alignment (obfd, stabstrsec, 0))
|
||||
{
|
||||
non_fatal (_("%s: can't create debugging section: %s"),
|
||||
bfd_get_filename (obfd),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
bfd_nonfatal_message (NULL, obfd, NULL,
|
||||
_("can't create debugging section"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2624,17 +2658,17 @@ write_debugging_info (bfd *obfd, void *dhandle,
|
|||
|| ! bfd_set_section_contents (obfd, stabstrsec, strings, 0,
|
||||
stringsize))
|
||||
{
|
||||
non_fatal (_("%s: can't set debugging section contents: %s"),
|
||||
bfd_get_filename (obfd),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
bfd_nonfatal_message (NULL, obfd, NULL,
|
||||
_("can't set debugging section contents"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
non_fatal (_("%s: don't know how to write debugging information for %s"),
|
||||
bfd_get_filename (obfd), bfd_get_target (obfd));
|
||||
bfd_nonfatal_message (NULL, obfd, NULL,
|
||||
_("don't know how to write debugging information for %s"),
|
||||
bfd_get_target (obfd));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2774,8 +2808,8 @@ strip_main (int argc, char *argv[])
|
|||
|
||||
if (tmpname == NULL)
|
||||
{
|
||||
non_fatal (_("could not create temporary file to hold stripped copy of '%s'"),
|
||||
argv[i]);
|
||||
bfd_nonfatal_message (argv[i], NULL, NULL,
|
||||
_("could not create temporary file to hold stripped copy"));
|
||||
status = 1;
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue