From 048d873d6955915e73916ff8b17d8ba291d0d288 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 2 Jun 2002 08:35:51 +0000 Subject: * elf64-alpha.c (elf64_alpha_relocate_section): Don't dereference null when there are no got entries for a symbol. (elf64_alpha_relax_find_tls_segment): Rearrange to avoid uninitialized variable warning. --- bfd/ChangeLog | 7 +++++++ bfd/elf64-alpha.c | 24 ++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 87e62af..b768b0d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2002-06-02 Richard Henderson + + * elf64-alpha.c (elf64_alpha_relocate_section): Don't dereference + null when there are no got entries for a symbol. + (elf64_alpha_relax_find_tls_segment): Rearrange to avoid + uninitialized variable warning. + 2002-06-01 Richard Henderson * elf64-alpha.c (elf64_alpha_relax_with_lituse): Don't test for diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index bdae249..8fcfeb3 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -1988,24 +1988,21 @@ elf64_alpha_relax_find_tls_segment (info, seg) struct elf_link_tls_segment *seg; { bfd *output_bfd = info->sec->output_section->owner; - asection *first_tls_sec = NULL, *o; + asection *o; unsigned int align; bfd_vma base, end; for (o = output_bfd->sections; o ; o = o->next) if ((o->flags & SEC_THREAD_LOCAL) != 0 && (o->flags & SEC_LOAD) != 0) - { - first_tls_sec = o; - break; - } - if (!first_tls_sec) + break; + if (!o) return NULL; - base = first_tls_sec->vma; + base = o->vma; align = 0; - for (o = first_tls_sec; o && (o->flags & SEC_THREAD_LOCAL); o = o->next) + do { bfd_vma size; @@ -2021,7 +2018,9 @@ elf64_alpha_relax_find_tls_segment (info, seg) size = lo->offset + lo->size; } end = o->vma + size; + o = o->next; } + while (o && (o->flags & SEC_THREAD_LOCAL)); seg->start = base; seg->size = end - base; @@ -4366,10 +4365,11 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, /* Need to adjust local GOT entries' addends for SEC_MERGE unless it has been done already. */ if ((sec->flags & SEC_MERGE) - && ELF_ST_TYPE (sym->st_info) == STT_SECTION - && (elf_section_data (sec)->sec_info_type - == ELF_INFO_TYPE_MERGE) - && !gotent->reloc_xlated) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION + && (elf_section_data (sec)->sec_info_type + == ELF_INFO_TYPE_MERGE) + && gotent + && !gotent->reloc_xlated) { struct alpha_elf_got_entry *ent; asection *msec; -- cgit v1.1