summaryrefslogtreecommitdiff
path: root/bfd/elf32-m68hc1x.c
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2003-05-13 18:54:25 +0000
committerStephane Carrez <stcarrez@nerim.fr>2003-05-13 18:54:25 +0000
commit8062ee6f7f79b50a3d791c3b9c07a1491efe0ac5 (patch)
treecd9d9738e21e962709a11141788fbce9c73a78d4 /bfd/elf32-m68hc1x.c
parent323a570a7a5130c3b09d476c6b7ce56cc38431e6 (diff)
downloadbinutils-redhat-8062ee6f7f79b50a3d791c3b9c07a1491efe0ac5.tar.gz
* 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/elf32-m68hc1x.c')
-rw-r--r--bfd/elf32-m68hc1x.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index 3c2ff6118f..176a256c74 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;