* elf64-alpha.c (elf64_alpha_merge_gots): Fix gotent iteration

in the presence of deleting elements.
        (elf64_alpha_size_got_sections): Zero dead got section size.
This commit is contained in:
Richard Henderson 2005-05-25 20:00:40 +00:00
parent 1dc3053fea
commit 308da68f56
2 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2005-05-25 Richard Henderson <rth@redhat.com>
* elf64-alpha.c (elf64_alpha_merge_gots): Fix gotent iteration
in the presence of deleting elements.
(elf64_alpha_size_got_sections): Zero dead got section size.
2005-05-23 Fred Fish <fnf@specifixinc.com> 2005-05-23 Fred Fish <fnf@specifixinc.com>
* dwarf2.c (struct dwarf2_debug): Add inliner_chain member. * dwarf2.c (struct dwarf2_debug): Add inliner_chain member.

View File

@ -3523,16 +3523,17 @@ elf64_alpha_merge_gots (a, b)
|| h->root.root.type == bfd_link_hash_warning) || h->root.root.type == bfd_link_hash_warning)
h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link; h = (struct alpha_elf_link_hash_entry *)h->root.root.u.i.link;
start = &h->got_entries; pbe = start = &h->got_entries;
for (pbe = start, be = *start; be ; pbe = &be->next, be = be->next) while ((be = *pbe) != NULL)
{ {
if (be->use_count == 0) if (be->use_count == 0)
{ {
*pbe = be->next; *pbe = be->next;
continue; memset (be, 0xa5, sizeof (*be));
goto kill;
} }
if (be->gotobj != b) if (be->gotobj != b)
continue; goto next;
for (ae = *start; ae ; ae = ae->next) for (ae = *start; ae ; ae = ae->next)
if (ae->gotobj == a if (ae->gotobj == a
@ -3542,12 +3543,15 @@ elf64_alpha_merge_gots (a, b)
ae->flags |= be->flags; ae->flags |= be->flags;
ae->use_count += be->use_count; ae->use_count += be->use_count;
*pbe = be->next; *pbe = be->next;
goto global_found; memset (be, 0xa5, sizeof (*be));
goto kill;
} }
be->gotobj = a; be->gotobj = a;
total += alpha_got_entry_size (be->reloc_type); total += alpha_got_entry_size (be->reloc_type);
global_found:; next:;
pbe = &be->next;
kill:;
} }
} }
@ -3703,8 +3707,11 @@ elf64_alpha_size_got_sections (info)
if (elf64_alpha_can_merge_gots (cur_got_obj, i)) if (elf64_alpha_can_merge_gots (cur_got_obj, i))
{ {
elf64_alpha_merge_gots (cur_got_obj, i); elf64_alpha_merge_gots (cur_got_obj, i);
alpha_elf_tdata(i)->got->size = 0;
i = alpha_elf_tdata(i)->got_link_next; i = alpha_elf_tdata(i)->got_link_next;
alpha_elf_tdata(cur_got_obj)->got_link_next = i; alpha_elf_tdata(cur_got_obj)->got_link_next = i;
something_changed = 1; something_changed = 1;
} }
else else