* elf32-spu.c (spu_elf_find_overlays): Call bfd_set_error on errors.
authorAlan Modra <amodra@gmail.com>
Mon, 9 Feb 2009 14:24:41 +0000 (14:24 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 9 Feb 2009 14:24:41 +0000 (14:24 +0000)
(find_function): Likewise.
(pasted_function): Don't error if no prior function found.
(discover_functions): Revert 2008-12-10 change.  Extend first
function range to start of section.

bfd/ChangeLog
bfd/elf32-spu.c

index ecc442ff12cd39a2d352a4c26a8f9602a5e954f6..fb902bd9f18ce1a20c1957770859215208ae39f7 100644 (file)
@@ -1,3 +1,11 @@
+2009-02-09  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf32-spu.c (spu_elf_find_overlays): Call bfd_set_error on errors.
+       (find_function): Likewise.
+       (pasted_function): Don't error if no prior function found.
+       (discover_functions): Revert 2008-12-10 change.  Extend first
+       function range to start of section.
+
 2009-02-08  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        * elf64-hppa.c: Remove PARAMS macro.  Replace PTR with void *.  Convert
index 725eb5a5a00214f7e5aad9d93ed4012ea43a69f8..3015cd65bee5721b781218a1358c6789350aa7a8 100644 (file)
@@ -686,6 +686,7 @@ spu_elf_find_overlays (struct bfd_link_info *info)
                  info->callbacks->einfo (_("%X%P: overlay section %A "
                                            "does not start on a cache line.\n"),
                                          s);
+                 bfd_set_error (bfd_error_bad_value);
                  return FALSE;
                }
              else if (s->size > htab->params->line_size)
@@ -693,6 +694,7 @@ spu_elf_find_overlays (struct bfd_link_info *info)
                  info->callbacks->einfo (_("%X%P: overlay section %A "
                                            "is larger than a cache line.\n"),
                                          s);
+                 bfd_set_error (bfd_error_bad_value);
                  return FALSE;
                }
 
@@ -712,6 +714,7 @@ spu_elf_find_overlays (struct bfd_link_info *info)
              info->callbacks->einfo (_("%X%P: overlay section %A "
                                        "is not in cache area.\n"),
                                      alloc_sec[i-1]);
+             bfd_set_error (bfd_error_bad_value);
              return FALSE;
            }
          else
@@ -752,6 +755,7 @@ spu_elf_find_overlays (struct bfd_link_info *info)
                                                "and %A do not start at the "
                                                "same address.\n"),
                                              s0, s);
+                     bfd_set_error (bfd_error_bad_value);
                      return FALSE;
                    }
                  if (ovl_end < s->vma + s->size)
@@ -2473,6 +2477,7 @@ find_function (asection *sec, bfd_vma offset, struct bfd_link_info *info)
     }
   info->callbacks->einfo (_("%A:0x%v not found in function table\n"),
                          sec, offset);
+  bfd_set_error (bfd_error_bad_value);
   return NULL;
 }
 
@@ -2744,7 +2749,7 @@ mark_functions_via_relocs (asection *sec,
    These sections are pasted together to form a single function.  */
 
 static bfd_boolean
-pasted_function (asection *sec, struct bfd_link_info *info)
+pasted_function (asection *sec)
 {
   struct bfd_link_order *l;
   struct _spu_elf_section_data *sec_data;
@@ -2793,8 +2798,9 @@ pasted_function (asection *sec, struct bfd_link_info *info)
        fun_start = &sinfo->fun[sinfo->num_fun - 1];
     }
 
-  info->callbacks->einfo (_("%A link_order not found\n"), sec);
-  return FALSE;
+  /* Don't return an error if we did not find a function preceding this
+     section.  The section may have incorrect flags.  */
+  return TRUE;
 }
 
 /* Map address ranges in code sections to functions.  */
@@ -2818,7 +2824,6 @@ discover_functions (struct bfd_link_info *info)
   sec_arr = bfd_zmalloc (bfd_idx * sizeof (*sec_arr));
   if (sec_arr == NULL)
     return FALSE;
-
   
   for (ibfd = info->input_bfds, bfd_idx = 0;
        ibfd != NULL;
@@ -2873,8 +2878,7 @@ discover_functions (struct bfd_link_info *info)
       sec_arr[bfd_idx] = psecs;
       for (psy = psyms, p = psecs, sy = syms; sy < syms + symcount; ++p, ++sy)
        if (ELF_ST_TYPE (sy->st_info) == STT_NOTYPE
-           || ELF_ST_TYPE (sy->st_info) == STT_FUNC
-           || ELF_ST_TYPE (sy->st_info) == STT_SECTION)
+           || ELF_ST_TYPE (sy->st_info) == STT_FUNC)
          {
            asection *s;
 
@@ -3004,7 +3008,7 @@ discover_functions (struct bfd_link_info *info)
 
                sec_data = spu_elf_section_data (sec);
                sinfo = sec_data->u.i.stack_info;
-               if (sinfo != NULL)
+               if (sinfo != NULL && sinfo->num_fun != 0)
                  {
                    int fun_idx;
                    bfd_vma hi = sec->size;
@@ -3014,10 +3018,12 @@ discover_functions (struct bfd_link_info *info)
                        sinfo->fun[fun_idx].hi = hi;
                        hi = sinfo->fun[fun_idx].lo;
                      }
+
+                   sinfo->fun[0].lo = 0;
                  }
                /* No symbols in this section.  Must be .init or .fini
                   or something similar.  */
-               else if (!pasted_function (sec, info))
+               else if (!pasted_function (sec))
                  return FALSE;
              }
        }
This page took 0.029942 seconds and 4 git commands to generate.