* sysdep.h (stpcpy): Wrap declaration in parentheses.
[deliverable/binutils-gdb.git] / bfd / elf32-cris.c
index d043111b663f2fbf9ba581d66cfdcea1d0b39f78..6b21de75009780cd4321c63ca30904a072b25acb 100644 (file)
@@ -1,5 +1,6 @@
 /* CRIS-specific support for 32-bit ELF.
-   Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
    Contributed by Axis Communications AB.
    Written by Hans-Peter Nilsson, based on elf32-fr30.c
    PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c.
@@ -18,7 +19,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -1984,16 +1985,23 @@ cris_elf_gc_sweep_hook (abfd, info, sec, relocs)
   for (rel = relocs; rel < relend; rel++)
     {
       unsigned long r_symndx;
-      struct elf_link_hash_entry *h;
+      struct elf_link_hash_entry *h = NULL;
+
+      r_symndx = ELF32_R_SYM (rel->r_info);
+      if (r_symndx >= symtab_hdr->sh_info)
+       {
+         h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+         while (h->root.type == bfd_link_hash_indirect
+                || h->root.type == bfd_link_hash_warning)
+           h = (struct elf_link_hash_entry *) h->root.u.i.link;
+       }
 
       switch (ELF32_R_TYPE (rel->r_info))
        {
        case R_CRIS_16_GOT:
        case R_CRIS_32_GOT:
-         r_symndx = ELF32_R_SYM (rel->r_info);
-         if (r_symndx >= symtab_hdr->sh_info)
+         if (h != NULL)
            {
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
              if (h->got.refcount > 0)
                {
                  --h->got.refcount;
@@ -2027,23 +2035,22 @@ cris_elf_gc_sweep_hook (abfd, info, sec, relocs)
        case R_CRIS_16_GOTPLT:
        case R_CRIS_32_GOTPLT:
          /* For local symbols, treat these like GOT relocs.  */
-         r_symndx = ELF32_R_SYM (rel->r_info);
-         if (r_symndx < symtab_hdr->sh_info)
+         if (h == NULL)
            goto local_got_reloc;
          /* Fall through.  */
+
        case R_CRIS_32_PLT_GOTREL:
          /* FIXME: We don't garbage-collect away the .got section.  */
          if (local_got_refcounts != NULL)
            local_got_refcounts[-1]--;
          /* Fall through.  */
+
        case R_CRIS_8_PCREL:
        case R_CRIS_16_PCREL:
        case R_CRIS_32_PCREL:
        case R_CRIS_32_PLT_PCREL:
-         r_symndx = ELF32_R_SYM (rel->r_info);
-         if (r_symndx >= symtab_hdr->sh_info)
+         if (h != NULL)
            {
-             h = sym_hashes[r_symndx - symtab_hdr->sh_info];
              if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
                  && h->plt.refcount > 0)
                --h->plt.refcount;
@@ -2984,7 +2991,7 @@ elf_cris_size_dynamic_sections (output_bfd, info)
 
       if (strip)
        {
-         _bfd_strip_section_from_output (info, s);
+         s->flags |= SEC_EXCLUDE;
          continue;
        }
 
@@ -3123,6 +3130,7 @@ elf_cris_discard_excess_program_dynamics (h, inf)
         introduce new problems.  Of course we don't do this if we're
         exporting all dynamic symbols.  */
       if (! info->export_dynamic
+         && h->root.dynindx != -1
          && !h->root.def_dynamic
          && !h->root.ref_dynamic)
        {
This page took 0.026789 seconds and 4 git commands to generate.