aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-05-22 18:44:02 +0000
committerNick Clifton <nickc@redhat.com>2000-05-22 18:44:02 +0000
commit1fe494a57221726e49417427cbb2cde8516d9a6f (patch)
treeacf2cbc468dc985ce4ca78f0fc38b94dd58f40c9
parent0ab71ce35ae2c5ef6dfa88af81d5b45b00ec6c7a (diff)
downloadgdb-1fe494a57221726e49417427cbb2cde8516d9a6f.zip
gdb-1fe494a57221726e49417427cbb2cde8516d9a6f.tar.gz
gdb-1fe494a57221726e49417427cbb2cde8516d9a6f.tar.bz2
Use bfd_generic_verify_endian_match() and fix it to only check when endianness
is known.
-rw-r--r--bfd/ChangeLog18
-rw-r--r--bfd/elf32-arm.h19
-rw-r--r--bfd/elf32-mcore.c14
-rw-r--r--bfd/elf32-mips.c17
-rw-r--r--bfd/elf32-ppc.c17
-rw-r--r--bfd/libbfd.c14
6 files changed, 37 insertions, 62 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 87e24bb..0223020 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,21 @@
+2000-05-22 Momchil Velikov <velco@fadata.bg>
+
+ * libbfd.c (_bfd_generic_verify_endian_match): Compare endianess
+ only if it is known for both input and output bfds. Separate
+ error message strings as in some languages, it may be necessary
+ to change more than one place in the string to change between
+ 'big' and 'little'.
+
+ * elf32-ppc.c (ppc_elf_merge_private_bfd_data): Remove inline
+ endianess checks, call _bfd_generic_verify_endian_match() instead.
+
+ * elf32-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
+
+ * elf32-mcore.c (mcore_elf_merge_private_bfd_data): Likewise.
+
+ * elf32-arm.h (elf32_arm_merge_private_bfd_data): Likewise. Verify
+ endianess before checking bfd flavours.
+
2000-05-22 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_link_output_extsym): Clear the visibility
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index a666293..fce2331 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -2007,25 +2007,14 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd)
flagword out_flags;
flagword in_flags;
+ /* Check if we have the same endianess */
+ if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
+ return false;
+
if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return true;
- /* Check if we have the same endianess */
- if ( ibfd->xvec->byteorder != obfd->xvec->byteorder
- && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
- && ibfd->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;
- }
-
/* The input BFD must have had its flags initialised. */
/* The following seems bogus to me -- The flags are initialized in
the assembler but I don't think an elf_flags_init field is
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index 5963a9e..7e0c30c 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -322,18 +322,8 @@ mcore_elf_merge_private_bfd_data (ibfd, obfd)
flagword new_flags;
/* Check if we have the same endianess */
- 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.\n"),
- 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;
- }
+ if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
+ return false;
if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index c1506e1..4892d5a 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -2460,21 +2460,8 @@ _bfd_mips_elf_merge_private_bfd_data (ibfd, obfd)
boolean ok;
/* Check if we have the same endianess */
- if (ibfd->xvec->byteorder != obfd->xvec->byteorder
- && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
- {
- const char *msg;
-
- if (bfd_big_endian (ibfd))
- msg = _("%s: compiled for a big endian system and target is little endian");
- else
- msg = _("%s: compiled for a little endian system and target is big endian");
-
- (*_bfd_error_handler) (msg, bfd_get_filename (ibfd));
-
- bfd_set_error (bfd_error_wrong_format);
- return false;
- }
+ if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
+ return false;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 0ec909a..b7e8592 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -1399,21 +1399,8 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
boolean error;
/* Check if we have the same endianess */
- if (ibfd->xvec->byteorder != obfd->xvec->byteorder
- && obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
- {
- const char *msg;
-
- if (bfd_big_endian (ibfd))
- msg = _("%s: compiled for a big endian system and target is little endian");
- else
- msg = _("%s: compiled for a little endian system and target is big endian");
-
- (*_bfd_error_handler) (msg, bfd_get_filename (ibfd));
-
- bfd_set_error (bfd_error_wrong_format);
- return false;
- }
+ if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
+ return false;
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 881af73..1bc0f33 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -1306,13 +1306,17 @@ _bfd_generic_verify_endian_match (ibfd, obfd)
bfd *obfd;
{
if (ibfd->xvec->byteorder != obfd->xvec->byteorder
+ && ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN
&& 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");
+ const char *msg;
+
+ if (bfd_big_endian (ibfd))
+ msg = _("%s: compiled for a big endian system and target is little endian");
+ else
+ msg = _("%s: compiled for a little endian system and target is big endian");
+
+ (*_bfd_error_handler) (msg, bfd_get_filename (ibfd));
bfd_set_error (bfd_error_wrong_format);
return false;