diff options
author | Stephane Carrez <stcarrez@nerim.fr> | 2003-05-13 18:54:25 +0000 |
---|---|---|
committer | Stephane Carrez <stcarrez@nerim.fr> | 2003-05-13 18:54:25 +0000 |
commit | 47247ced96f6979baa7a23f2bc53ccb6c1b19212 (patch) | |
tree | be56a30c5038624c5a8446cd49dceb1ad18bb1af /bfd | |
parent | 5c449c3fa673077d0395f0f76346bf2d96869030 (diff) | |
download | gdb-47247ced96f6979baa7a23f2bc53ccb6c1b19212.zip gdb-47247ced96f6979baa7a23f2bc53ccb6c1b19212.tar.gz gdb-47247ced96f6979baa7a23f2bc53ccb6c1b19212.tar.bz2 |
* elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Check for
processor capability, allow merge of HC12 and HCS12 in some cases.
(m68hc11_elf_hash_table_create): Use bfd_malloc instead of bfd_zalloc.
* cpu-m68hc12.c (bfd_m68hc12s_arch): New struct.
(bfd_m68hc12_arch): Link it.
(scan_mach): New function.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/cpu-m68hc12.c | 22 | ||||
-rw-r--r-- | bfd/elf32-m68hc1x.c | 22 |
3 files changed, 47 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0046a36..550dcc0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2003-05-13 Stephane Carrez <stcarrez@nerim.fr> + + * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Check for + processor capability, allow merge of HC12 and HCS12 in some cases. + (m68hc11_elf_hash_table_create): Use bfd_malloc instead of bfd_zalloc. + * cpu-m68hc12.c (bfd_m68hc12s_arch): New struct. + (bfd_m68hc12_arch): Link it. + (scan_mach): New function. + 2003-05-13 Andrew Haley <aph@redhat.com> * elf.c (bfd_elf_hash): Mask lower 32 bits of hash. diff --git a/bfd/cpu-m68hc12.c b/bfd/cpu-m68hc12.c index d43eb95..f4c8c9e 100644 --- a/bfd/cpu-m68hc12.c +++ b/bfd/cpu-m68hc12.c @@ -1,5 +1,5 @@ /* BFD support for the Motorola 68HC12 processor - Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -21,10 +21,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "sysdep.h" #include "libbfd.h" +const bfd_arch_info_type bfd_m68hc12s_arch = +{ + 16, /* 16 bits in a word */ + 32, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_m68hc12, + bfd_mach_m6812s, + "m68hc12:HCS12", + "m68hc12", + 4, /* section alignment power */ + TRUE, + bfd_default_compatible, + bfd_default_scan, + 0, +}; + const bfd_arch_info_type bfd_m68hc12_arch = { 16, /* 16 bits in a word */ - 16, /* 16 bits in an address */ + 32, /* 16 bits in an address */ 8, /* 8 bits in a byte */ bfd_arch_m68hc12, 0, @@ -34,5 +50,5 @@ const bfd_arch_info_type bfd_m68hc12_arch = TRUE, bfd_default_compatible, bfd_default_scan, - 0, + &bfd_m68hc12s_arch, }; diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 3c2ff61..176a256 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -75,14 +75,15 @@ m68hc11_elf_hash_table_create (abfd) struct m68hc11_elf_link_hash_table *ret; bfd_size_type amt = sizeof (struct m68hc11_elf_link_hash_table); - ret = (struct m68hc11_elf_link_hash_table *) bfd_zalloc (abfd, amt); + ret = (struct m68hc11_elf_link_hash_table *) bfd_malloc (amt); if (ret == (struct m68hc11_elf_link_hash_table *) NULL) return NULL; + memset (ret, 0, amt); if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, _bfd_elf_link_hash_newfunc)) { - bfd_release (abfd, ret); + free (ret); return NULL; } @@ -91,7 +92,7 @@ m68hc11_elf_hash_table_create (abfd) ret->stub_hash_table = (struct bfd_hash_table*) bfd_malloc (amt); if (ret->stub_hash_table == NULL) { - bfd_release (abfd, ret); + free (ret); return NULL; } if (!bfd_hash_table_init (ret->stub_hash_table, stub_hash_newfunc)) @@ -1405,6 +1406,21 @@ _bfd_m68hc11_elf_merge_private_bfd_data (ibfd, obfd) bfd_archive_filename (ibfd)); ok = FALSE; } + + /* Processor compatibility. */ + if (!EF_M68HC11_CAN_MERGE_MACH (new_flags, old_flags)) + { + (*_bfd_error_handler) + (_("%s: linking files compiled for HCS12 with " + "others compiled for HC12"), + bfd_archive_filename (ibfd)); + ok = FALSE; + } + new_flags = ((new_flags & ~EF_M68HC11_MACH_MASK) + | (EF_M68HC11_MERGE_MACH (new_flags, old_flags))); + + elf_elfheader (obfd)->e_flags = new_flags; + new_flags &= ~EF_M68HC11_ABI; old_flags &= ~EF_M68HC11_ABI; |