aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-10-27 12:45:38 +0000
committerNick Clifton <nickc@redhat.com>2003-10-27 12:45:38 +0000
commited570f48a0c7fa84eb8c8fb0a0861074ccd4f55f (patch)
tree33c69051a14ab60008d503161393ae18273e6e96 /binutils/objcopy.c
parent47eebc207fc8d4cc5611eb946ba04398e47ea15b (diff)
downloadgdb-ed570f48a0c7fa84eb8c8fb0a0861074ccd4f55f.zip
gdb-ed570f48a0c7fa84eb8c8fb0a0861074ccd4f55f.tar.gz
gdb-ed570f48a0c7fa84eb8c8fb0a0861074ccd4f55f.tar.bz2
Do not complain when copying a file format that does not support relocations.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index b48b84f..8a1a67a 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1885,10 +1885,18 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
if (bfd_get_format (obfd) == bfd_core)
relsize = 0;
else
- relsize = bfd_get_reloc_upper_bound (ibfd, isection);
+ {
+ relsize = bfd_get_reloc_upper_bound (ibfd, isection);
- if (relsize < 0)
- RETURN_NONFATAL (bfd_get_filename (ibfd));
+ if (relsize < 0)
+ {
+ /* Do not complain if the target does not support relocations. */
+ if (relsize == -1 && bfd_get_error () == bfd_error_invalid_operation)
+ relsize = 0;
+ else
+ RETURN_NONFATAL (bfd_get_filename (ibfd));
+ }
+ }
if (relsize == 0)
bfd_set_reloc (obfd, osection, NULL, 0);
@@ -2030,7 +2038,12 @@ mark_symbols_used_in_relocations (bfd *ibfd, sec_ptr isection, void *symbolsarg)
relsize = bfd_get_reloc_upper_bound (ibfd, isection);
if (relsize < 0)
- bfd_fatal (bfd_get_filename (ibfd));
+ {
+ /* Do not complain if the target does not support relocations. */
+ if (relsize == -1 && bfd_get_error () == bfd_error_invalid_operation)
+ return;
+ bfd_fatal (bfd_get_filename (ibfd));
+ }
if (relsize == 0)
return;