diff options
author | Joern Rennecke <joern.rennecke@embecosm.com> | 1999-06-03 18:48:24 +0000 |
---|---|---|
committer | Joern Rennecke <joern.rennecke@embecosm.com> | 1999-06-03 18:48:24 +0000 |
commit | 875f7f6940b2e802454dac25028ad90abf254562 (patch) | |
tree | 13763ca85897ad1ae8fc636b87631822c2a4f005 /bfd | |
parent | 762100ed5601d4decef0849bca204f27f94fc6c4 (diff) | |
download | gdb-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')
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/coff-sh.c | 27 | ||||
-rw-r--r-- | bfd/elf32-sh.c | 2 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 3 | ||||
-rw-r--r-- | bfd/libbfd.c | 23 | ||||
-rw-r--r-- | bfd/libbfd.h | 3 |
6 files changed, 42 insertions, 26 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1492c9d..4784772 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +Fri Jun 4 02:29:34 1999 J"orn Rennecke <amylaar@cygnus.co.uk> + + * 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. + 1999-06-03 Ulrich Drepper <drepper@cygnus.com> * elf32-arm.h: Fix typo: change ELF_MAXPAGE_SIZE to ELF_MAXPAGESIZE. diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index e3d6eec..8c6028d 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -32,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ static bfd_reloc_status_type sh_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static long get_symbol_value PARAMS ((asymbol *)); -static boolean sh_merge_private_data PARAMS ((bfd *, bfd *)); static boolean sh_relax_section PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); static boolean sh_relax_delete_bytes @@ -442,31 +441,7 @@ sh_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, return bfd_reloc_ok; } -/* This routine checks for linking big and little endian objects - together. */ - -static boolean -sh_merge_private_data (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; -} - -#define coff_bfd_merge_private_bfd_data sh_merge_private_data +#define coff_bfd_merge_private_bfd_data _bfd_generic_verify_endian_match /* We can do relaxing. */ #define coff_bfd_relax_section sh_relax_section diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index ebbe352..aa9bc00 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2050,6 +2050,8 @@ sh_elf_check_relocs (abfd, info, sec, relocs) #define elf_backend_relocate_section sh_elf_relocate_section #define bfd_elf32_bfd_get_relocated_section_contents \ sh_elf_get_relocated_section_contents +#define bfd_elf32_bfd_merge_private_bfd_data \ + _bfd_generic_verify_endian_match #define elf_backend_gc_mark_hook sh_elf_gc_mark_hook #define elf_backend_gc_sweep_hook sh_elf_gc_sweep_hook diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 057bba2..dd6b72c 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -479,6 +479,9 @@ extern bfd_size_type _bfd_stringtab_add /* Write out a string table. */ extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *)); + +/* Check that endianness of input and output file match. */ +extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *)); /* Macros to tell if bfds are read or write enabled. 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; +} diff --git a/bfd/libbfd.h b/bfd/libbfd.h index e395f72..c2f0a15 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -479,6 +479,9 @@ extern bfd_size_type _bfd_stringtab_add /* Write out a string table. */ extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *)); + +/* Check that endianness of input and output file match. */ +extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *)); /* Macros to tell if bfds are read or write enabled. |