aboutsummaryrefslogtreecommitdiff
path: root/bfd/libbfd.c
diff options
context:
space:
mode:
authorJoern Rennecke <joern.rennecke@embecosm.com>1999-06-03 18:48:24 +0000
committerJoern Rennecke <joern.rennecke@embecosm.com>1999-06-03 18:48:24 +0000
commit875f7f6940b2e802454dac25028ad90abf254562 (patch)
tree13763ca85897ad1ae8fc636b87631822c2a4f005 /bfd/libbfd.c
parent762100ed5601d4decef0849bca204f27f94fc6c4 (diff)
downloadgdb-875f7f6940b2e802454dac25028ad90abf254562.zip
gdb-875f7f6940b2e802454dac25028ad90abf254562.tar.gz
gdb-875f7f6940b2e802454dac25028ad90abf254562.tar.bz2
* libbfd.c (_bfd_generic_verify_endian_match): New function.
* libbfd-in.h (_bfd_generic_verify_endian_match): Declare. * libbfd.h: Regenerate. * coff-sh.c (sh_merge_private_data): Delete. (coff_bfd_merge_private_bfd_data): Change to _bfd_generic_verify_endian_match. (elf32-sh.c): bfd_elf32_bfd_merge_private_bfd_data: Define.
Diffstat (limited to 'bfd/libbfd.c')
-rw-r--r--bfd/libbfd.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 8abd1f5..8da3de0 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -1261,3 +1261,26 @@ bfd_generic_is_local_label_name (abfd, name)
return (name[0] == locals_prefix);
}
+/* Can be used from / for bfd_merge_private_bfd_data to check that
+ endianness matches between input and output file. Returns
+ true for a match, otherwise returns false and emits an error. */
+boolean
+_bfd_generic_verify_endian_match (ibfd, obfd)
+ bfd *ibfd;
+ bfd *obfd;
+{
+ if (ibfd->xvec->byteorder != obfd->xvec->byteorder
+ && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
+ {
+ (*_bfd_error_handler)
+ ("%s: compiled for a %s endian system and target is %s endian",
+ bfd_get_filename (ibfd),
+ bfd_big_endian (ibfd) ? "big" : "little",
+ bfd_big_endian (obfd) ? "big" : "little");
+
+ bfd_set_error (bfd_error_wrong_format);
+ return false;
+ }
+
+ return true;
+}