diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 931d9d080d..56df68f03c 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2014-04-07 Alan Modra + + PR binutils/16811 + * objcopy.c (copy_object): Error if no sections. + 2014-04-03 Markus Trippelsdorf PR binutils/14698 diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 6215919bb7..873908c688 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1598,6 +1598,13 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) return FALSE; } + if (ibfd->sections == NULL) + { + non_fatal (_("error: the input file '%s' has no sections"), + bfd_get_archive_filename (ibfd)); + return FALSE; + } + if (verbose) printf (_("copy from `%s' [%s] to `%s' [%s]\n"), bfd_get_archive_filename (ibfd), bfd_get_target (ibfd),