2013-05-06 Paul Brook <paul@codesourcery.com>
[deliverable/binutils-gdb.git] / bfd / elf32-xgate.c
index bd62438eff46649ce52f31559ad5353888b9beab..b822260277ca30a290679d7d7649995d11b8f79b 100644 (file)
@@ -106,8 +106,8 @@ static reloc_howto_type elf_xgate_howto_table[] =
         bfd_elf_generic_reloc, /* special_function */
         "R_XGATE_16", /* name */
         FALSE, /* partial_inplace */
-        0x00ff, /* src_mask */
-        0x00ff, /* dst_mask */
+        0xffff, /* src_mask */
+        0xffff, /* dst_mask */
         FALSE), /* pcrel_offset */
 
   /* A 32 bit absolute relocation.  This one is never used for the
@@ -437,7 +437,7 @@ xgate_elf_bfd_link_hash_table_free (struct bfd_link_hash_table *hash)
 
   bfd_hash_table_free (ret->stub_hash_table);
   free (ret->stub_hash_table);
-  _bfd_generic_link_hash_table_free (hash);
+  _bfd_elf_link_hash_table_free (hash);
 }
 
 /* Create a XGATE ELF linker hash table.  */
@@ -448,11 +448,10 @@ xgate_elf_bfd_link_hash_table_create (bfd *abfd)
   struct xgate_elf_link_hash_table *ret;
   bfd_size_type amt = sizeof(struct xgate_elf_link_hash_table);
 
-  ret = (struct xgate_elf_link_hash_table *) bfd_malloc (amt);
+  ret = (struct xgate_elf_link_hash_table *) bfd_zmalloc (amt);
   if (ret == (struct xgate_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, sizeof(struct elf_link_hash_entry),
       XGATE_ELF_DATA))
@@ -463,7 +462,7 @@ xgate_elf_bfd_link_hash_table_create (bfd *abfd)
 
   /* Init the stub hash table too.  */
   amt = sizeof(struct bfd_hash_table);
-  ret->stub_hash_table = (struct bfd_hash_table*) bfd_malloc (amt);
+  ret->stub_hash_table = (struct bfd_hash_table*) bfd_zmalloc (amt);
   if (ret->stub_hash_table == NULL)
     {
       free (ret);
@@ -472,12 +471,11 @@ xgate_elf_bfd_link_hash_table_create (bfd *abfd)
 
   if (!bfd_hash_table_init (ret->stub_hash_table, stub_hash_newfunc,
       sizeof(struct elf32_xgate_stub_hash_entry)))
-    return NULL;
-
-  ret->stub_bfd = NULL;
-  ret->stub_section = 0;
-  ret->add_stub_section = NULL;
-  ret->sym_cache.abfd = NULL;
+    {
+      free (ret->stub_hash_table);
+      free (ret);
+      return NULL;
+    }
 
   return &ret->root.root;
 }
This page took 0.024003 seconds and 4 git commands to generate.