aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2005-01-09 19:49:22 +0000
committerEric Botcazou <ebotcazou@libertysurf.fr>2005-01-09 19:49:22 +0000
commit01aac484a67ed6747510d50822fa488d96461133 (patch)
tree432dc55363060d1513801928e03000414517f302
parenta51a7930ba7a2a6439e35ae66c76c3029deecd72 (diff)
downloadgdb-01aac484a67ed6747510d50822fa488d96461133.zip
gdb-01aac484a67ed6747510d50822fa488d96461133.tar.gz
gdb-01aac484a67ed6747510d50822fa488d96461133.tar.bz2
* elf32-sparc.c (elf32_sparc_link_hash_table_create): Use bfd_zmalloc
to zero the structure. (create_got_section): Use BFD_ASSERT instead of abort.
-rw-r--r--bfd/ChangeLog3
-rw-r--r--bfd/elf32-sparc.c24
2 files changed, 11 insertions, 16 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f163660..04894f0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,8 @@
2005-01-09 Eric Botcazou <ebotcazou@libertysurf.fr>
+ * elf32-sparc.c (elf32_sparc_link_hash_table_create): Use bfd_zmalloc
+ to zero the structure.
+ (create_got_section): Use BFD_ASSERT instead of abort.
* elf64-sparc.c (struct sparc64_elf_link_hash_table): New 'sgot' and
'srelgot' fields.
(create_got_section): New function.
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index be3dfae..18a2e49 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -695,7 +695,7 @@ elf32_sparc_link_hash_table_create (abfd)
struct elf32_sparc_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf32_sparc_link_hash_table);
- ret = (struct elf32_sparc_link_hash_table *) bfd_malloc (amt);
+ ret = (struct elf32_sparc_link_hash_table *) bfd_zmalloc (amt);
if (ret == NULL)
return NULL;
@@ -705,15 +705,6 @@ elf32_sparc_link_hash_table_create (abfd)
return NULL;
}
- ret->sgot = NULL;
- ret->srelgot = NULL;
- ret->splt = NULL;
- ret->srelplt = NULL;
- ret->sdynbss = NULL;
- ret->srelbss = NULL;
- ret->tls_ldm_got.refcount = 0;
- ret->sym_sec.abfd = NULL;
-
return &ret->elf.root;
}
@@ -732,15 +723,16 @@ create_got_section (dynobj, info)
htab = elf32_sparc_hash_table (info);
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
- if (!htab->sgot)
- abort ();
+ BFD_ASSERT (htab->sgot != NULL);
htab->srelgot = bfd_make_section (dynobj, ".rela.got");
if (htab->srelgot == NULL
- || ! bfd_set_section_flags (dynobj, htab->srelgot,
- (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY))
+ || ! bfd_set_section_flags (dynobj, htab->srelgot, SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY)
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
return FALSE;
return TRUE;