* 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.
This commit is contained in:
Stephane Carrez 2003-05-13 18:54:25 +00:00
parent 5c449c3fa6
commit 47247ced96
3 changed files with 47 additions and 6 deletions

View File

@ -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.

View File

@ -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,
};

View File

@ -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;