Stop objcopy trying to convert endianness.
authorNick Clifton <nickc@redhat.com>
Thu, 18 Jan 2001 00:17:43 +0000 (00:17 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 18 Jan 2001 00:17:43 +0000 (00:17 +0000)
binutils/ChangeLog
binutils/objcopy.c

index fe1cdd3b73a75f2ffd0375ace65dfa99be43ca75..f86805ffb61f238a79db8346d8f8264a54b7aaa7 100644 (file)
@@ -1,3 +1,10 @@
+2001-01-17  Nick Clifton  <nickc@redhat.com>
+
+       * objcopy.c (copy_object): Fail if attempting to convert the
+       endianness of the input object file.
+
+       * binutils.texi: Explain that objcopy cannot convert endianness.
+       
 2001-01-16  Nick Clifton  <nickc@redhat.com>
 
        * readelf.c (string_table_length): New variable.
index 21f579366dd6b390c5820ec0108064c1a7b42d6b..cae66fc87fbaae7674281cf476216939521052d5 100644 (file)
@@ -1,5 +1,5 @@
 /* objcopy.c -- copy object file from input to output, optionally massaging it.
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
@@ -765,6 +765,13 @@ copy_object (ibfd, obfd)
   long symsize;
   PTR dhandle;
 
+  if (ibfd->xvec->byteorder != obfd->xvec->byteorder
+      && ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
+      && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
+    {
+      fatal (_("Unable to change endianness of input file(s)"));
+      return;
+    }
 
   if (!bfd_set_format (obfd, bfd_get_format (ibfd)))
     RETURN_NONFATAL (bfd_get_filename (obfd));