From 6bee8834bf2941010b7587b7d76a7f162cef1e37 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sun, 27 Jun 2010 08:37:22 +0000 Subject: [PATCH] * elf64-ppc.c (get_tls_mask): Don't segfault on NULL elf_section_data. (group_sections): Likewise. --- bfd/ChangeLog | 5 +++++ bfd/elf64-ppc.c | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2369ad24380..631aa4b9655 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2010-06-27 Alan Modra + + * elf64-ppc.c (get_tls_mask): Don't segfault on NULL elf_section_data. + (group_sections): Likewise. + 2010-06-27 Alan Modra * bout.c (aligncode): Delete set but unused variables. diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 90a2518f8dc..97d607b22c2 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -6689,6 +6689,7 @@ get_tls_mask (unsigned char **tls_maskp, if ((*tls_maskp != NULL && **tls_maskp != 0) || sec == NULL + || ppc64_elf_section_data (sec) == NULL || ppc64_elf_section_data (sec)->sec_type != sec_toc) return 1; @@ -10666,7 +10667,8 @@ group_sections (struct ppc_link_hash_table *htab, curr = tail; total = tail->size; - big_sec = total > (ppc64_elf_section_data (tail)->has_14bit_branch + big_sec = total > (ppc64_elf_section_data (tail) != NULL + && ppc64_elf_section_data (tail)->has_14bit_branch ? stub14_group_size : stub_group_size); if (big_sec && !suppress_size_errors) (*_bfd_error_handler) (_("%B section %A exceeds stub group size"), @@ -10675,7 +10677,8 @@ group_sections (struct ppc_link_hash_table *htab, while ((prev = PREV_SEC (curr)) != NULL && ((total += curr->output_offset - prev->output_offset) - < (ppc64_elf_section_data (prev)->has_14bit_branch + < (ppc64_elf_section_data (prev) != NULL + && ppc64_elf_section_data (prev)->has_14bit_branch ? stub14_group_size : stub_group_size)) && htab->stub_group[prev->id].toc_off == curr_toc) curr = prev; @@ -10708,7 +10711,8 @@ group_sections (struct ppc_link_hash_table *htab, total = 0; while (prev != NULL && ((total += tail->output_offset - prev->output_offset) - < (ppc64_elf_section_data (prev)->has_14bit_branch + < (ppc64_elf_section_data (prev) != NULL + && ppc64_elf_section_data (prev)->has_14bit_branch ? stub14_group_size : stub_group_size)) && htab->stub_group[prev->id].toc_off == curr_toc) { -- 2.30.2