summaryrefslogtreecommitdiff
path: root/bfd/elf32-m68hc1x.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-m68hc1x.c')
-rw-r--r--bfd/elf32-m68hc1x.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index 0696a36425..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))
@@ -476,9 +477,9 @@ elf32_m68hc11_size_stubs (output_bfd, stub_bfd, info, add_stub_section)
/* Get the relocs. */
internal_relocs
- = _bfd_elf32_link_read_relocs (input_bfd, section, NULL,
- (Elf_Internal_Rela *) NULL,
- info->keep_memory);
+ = _bfd_elf_link_read_relocs (input_bfd, section, NULL,
+ (Elf_Internal_Rela *) NULL,
+ info->keep_memory);
if (internal_relocs == NULL)
goto error_ret_free_local;
@@ -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;