Add -Wshadow to the gcc command line options used when compiling the binutils.
[deliverable/binutils-gdb.git] / bfd / elf32-sh.c
index 89cef677696d8dd208870328023dab0553f8ab74..b16e3e1dd7b28378ae4069bf1a80c58d9b69e350 100644 (file)
@@ -1,6 +1,6 @@
 /* Renesas / SuperH SH specific support for 32-bit ELF
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009 Free Software Foundation, Inc.
    Contributed by Ian Lance Taylor, Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -2089,9 +2089,9 @@ get_plt_index (const struct elf_sh_plt_info *info, bfd_vma offset)
 /* Do the inverse operation.  */
 
 static bfd_vma
-get_plt_offset (const struct elf_sh_plt_info *info, bfd_vma index)
+get_plt_offset (const struct elf_sh_plt_info *info, bfd_vma plt_index)
 {
-  return info->plt0_entry_size + (index * info->symbol_entry_size);
+  return info->plt0_entry_size + (plt_index * info->symbol_entry_size);
 }
 
 /* The sh linker needs to keep track of the number of relocs that it
@@ -2187,8 +2187,8 @@ struct elf_sh_link_hash_table
   /* The (unloaded but important) VxWorks .rela.plt.unloaded section.  */
   asection *srelplt2;
 
-  /* Small local sym to section mapping cache.  */
-  struct sym_sec_cache sym_sec;
+  /* Small local sym cache.  */
+  struct sym_cache sym_cache;
 
   /* A counter or offset to track a TLS got entry.  */
   union
@@ -2281,7 +2281,7 @@ sh_elf_link_hash_table_create (bfd *abfd)
   ret->sdynbss = NULL;
   ret->srelbss = NULL;
   ret->srelplt2 = NULL;
-  ret->sym_sec.abfd = NULL;
+  ret->sym_cache.abfd = NULL;
   ret->tls_ldm_got.refcount = 0;
   ret->plt_info = NULL;
   ret->vxworks_p = vxworks_object_p (abfd);
@@ -2303,18 +2303,9 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
   htab = sh_elf_hash_table (info);
   htab->sgot = bfd_get_section_by_name (dynobj, ".got");
   htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
-  if (! htab->sgot || ! htab->sgotplt)
+  htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
+  if (! htab->sgot || ! htab->sgotplt || ! htab->srelgot)
     abort ();
-
-  htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
-                                              (SEC_ALLOC | SEC_LOAD
-                                               | SEC_HAS_CONTENTS
-                                               | SEC_IN_MEMORY
-                                               | SEC_LINKER_CREATED
-                                               | SEC_READONLY));
-  if (htab->srelgot == NULL
-      || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
-    return FALSE;
   return TRUE;
 }
 
@@ -2325,7 +2316,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
 {
   struct elf_sh_link_hash_table *htab;
   flagword flags, pltflags;
-  register asection *s;
+  asection *s;
   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
   int ptralign = 0;
 
@@ -4052,7 +4043,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                }
              else
                {
-                 int index;
+                 int target;
 
                  /* IE->LE transition:
                     mov.l 1f,r0; stc gbr,rN; mov.l @(r0,r12),rM;
@@ -4074,12 +4065,12 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                    }
 
                  BFD_ASSERT ((insn & 0xff00) == 0xd000);
-                 index = insn & 0x00ff;
+                 target = insn & 0x00ff;
                  insn = bfd_get_16 (input_bfd, contents + offset + 2);
                  BFD_ASSERT ((insn & 0xf0ff) == 0x0012);
                  insn = bfd_get_16 (input_bfd, contents + offset + 4);
                  BFD_ASSERT ((insn & 0xf0ff) == 0x00ce);
-                 insn = 0xd000 | (insn & 0x0f00) | index;
+                 insn = 0xd000 | (insn & 0x0f00) | target;
                  bfd_put_16 (output_bfd, insn, contents + offset + 0);
                  bfd_put_16 (output_bfd, 0x0009, contents + offset + 4);
                }
@@ -5212,15 +5203,20 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
                head = &((struct elf_sh_link_hash_entry *) h)->dyn_relocs;
              else
                {
+                 /* Track dynamic relocs needed for local syms too.  */
                  asection *s;
                  void *vpp;
+                 Elf_Internal_Sym *isym;
 
-                 /* Track dynamic relocs needed for local syms too.  */
-                 s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
-                                                sec, r_symndx);
-                 if (s == NULL)
+                 isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+                                               abfd, r_symndx);
+                 if (isym == NULL)
                    return FALSE;
 
+                 s = bfd_section_from_elf_index (abfd, isym->st_shndx);
+                 if (s == NULL)
+                   s = sec;
+
                  vpp = &elf_section_data (s)->local_dynrel;
                  head = (struct elf_sh_dyn_relocs **) vpp;
                }
This page took 0.053187 seconds and 4 git commands to generate.