* elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Check for
authorStephane Carrez <stcarrez@nerim.fr>
Tue, 13 May 2003 18:54:25 +0000 (18:54 +0000)
committerStephane Carrez <stcarrez@nerim.fr>
Tue, 13 May 2003 18:54:25 +0000 (18:54 +0000)
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.

bfd/ChangeLog
bfd/cpu-m68hc12.c
bfd/elf32-m68hc1x.c

index 0046a366942e68669962343ee26230b7094f5022..550dcc02822d0a4fef59ede2ed3971ca51c9bf19 100644 (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.
index d43eb95fc17c2c98b033e5437874e3cdcf9cf185..f4c8c9e758181ad2dbcdc52011d4550c562bc77b 100644 (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,
 };
index 3c2ff6118f5e81db92cd9d551dcd9fadf628231e..176a256c744fb62bc0329ec988532482da73a552 100644 (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;
 
This page took 0.030306 seconds and 4 git commands to generate.