* elf64-ppc.c (get_tls_mask): Don't segfault on NULL elf_section_data.
authorAlan Modra <amodra@gmail.com>
Sun, 27 Jun 2010 08:37:22 +0000 (08:37 +0000)
committerAlan Modra <amodra@gmail.com>
Sun, 27 Jun 2010 08:37:22 +0000 (08:37 +0000)
(group_sections): Likewise.

bfd/ChangeLog
bfd/elf64-ppc.c

index 2369ad2438014dc9eabd148b6d16bf83e3670abe..631aa4b96558171724df505417a47d846ef057d3 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-27  Alan Modra  <amodra@gmail.com>
+
+       * elf64-ppc.c (get_tls_mask): Don't segfault on NULL elf_section_data.
+       (group_sections): Likewise.
+
 2010-06-27  Alan Modra  <amodra@gmail.com>
 
        * bout.c (aligncode): Delete set but unused variables.
index 90a2518f8dc3ae6ad7e62f21c725b43189f69b03..97d607b22c2fd7cc5df1ecff7e0076ffb1f74f3c 100644 (file)
@@ -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)
                {