This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New Port: iq2000 bfd


Diffs from original posting...

--- elf32-iq2000.c	2002/12/05 15:43:36	1.1
+++ elf32-iq2000.c	2002/12/08 19:04:11
@@ -35,7 +35,7 @@ static void                  iq2000_info
 static boolean               iq2000_elf_relocate_section       PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
 static bfd_reloc_status_type iq2000_final_link_relocate        PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, bfd_vma));
 static boolean               iq2000_elf_gc_sweep_hook          PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *));
-static asection *            iq2000_elf_gc_mark_hook           PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static asection *            iq2000_elf_gc_mark_hook           PARAMS ((asection *sec, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *));
 static reloc_howto_type *    iq2000_reloc_type_lookup          PARAMS ((bfd *, bfd_reloc_code_real_type));
 static int                   elf32_iq2000_machine              PARAMS ((bfd *));
 static boolean               iq2000_elf_object_p               PARAMS ((bfd *));
@@ -84,7 +84,7 @@ static reloc_howto_type iq2000_elf_howto
   HOWTO (R_IQ2000_32, 		     /* type */
 	 0,			     /* rightshift */
 	 2,		    	     /* size (0 = byte, 1 = short, 2 = long) */
-	 32,			     /* bitsize */
+	 31,			     /* bitsize */
 	 false,			     /* pc_relative */
 	 0,		    	     /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
@@ -132,7 +132,7 @@ static reloc_howto_type iq2000_elf_howto
   HOWTO (R_IQ2000_HI16,		/* type */
 	 16,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
-	 16,			/* bitsize */
+	 15,			/* bitsize */
 	 false,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_dont, /* complain_on_overflow */
@@ -331,66 +331,6 @@ iq2000_elf_howto_hi16_reloc (abfd,
 }
 
 static bfd_reloc_status_type
-iq2000_elf_relocate_26 (input_bfd, relhi, contents, value)
-     bfd *input_bfd;
-     Elf_Internal_Rela *relhi;
-     bfd_byte *contents;
-     bfd_vma value;
-{
-  bfd_vma insn;
-
-  insn = bfd_get_32 (input_bfd, contents + relhi->r_offset);
-
-  value += relhi->r_addend;
-  value >>= 2;
-  value &= 0x3ffffff;
-  insn = ((insn & ~0x3FFFFFF) | value);
-
-  bfd_put_32 (input_bfd, insn, contents + relhi->r_offset);
-  return bfd_reloc_ok;
-}
-
-static bfd_reloc_status_type
-iq2000_elf_relocate_offset_16 (input_bfd, relhi, contents, value)
-     bfd *input_bfd;
-     Elf_Internal_Rela *relhi;
-     bfd_byte *contents;
-     bfd_vma value;
-{
-  bfd_vma insn;
-
-  insn = bfd_get_32 (input_bfd, contents + relhi->r_offset);
-
-  value += relhi->r_addend;
-  value >>= 2;
-  value &= 0xffff;
-  insn = ((insn & ~0xFFFF) | value);
-
-  bfd_put_32 (input_bfd, insn, contents + relhi->r_offset);
-  return bfd_reloc_ok;
-}
-
-bfd_reloc_status_type
-iq2000_elf_relocate_offset_21 (input_bfd, relhi, contents, value)
-     bfd *input_bfd;
-     Elf_Internal_Rela *relhi;
-     bfd_byte *contents;
-     bfd_vma value;
-{
-  bfd_vma insn;
-
-  insn = bfd_get_32 (input_bfd, contents + relhi->r_offset);
-
-  value += relhi->r_addend;
-  value >>= 2;
-  value &= 0x1fffff;
-  insn = ((insn & ~0x1FFFFF) | value);
-
-  bfd_put_32 (input_bfd, insn, contents + relhi->r_offset);
-  return bfd_reloc_ok;
-}
-
-static bfd_reloc_status_type
 iq2000_elf_relocate_hi16 (input_bfd, relhi, contents, value)
      bfd *input_bfd;
      Elf_Internal_Rela *relhi;
@@ -644,26 +584,6 @@ iq2000_elf_relocate_section (output_bfd,
       
       r_symndx = ELF32_R_SYM (rel->r_info);
 
-      if (info->relocateable)
-	{
-	  /* This is a relocateable link.  We don't have to change
-             anything, unless the reloc is against a section symbol,
-             in which case we have to adjust according to where the
-             section symbol winds up in the output section.  */
-	  if (r_symndx < symtab_hdr->sh_info)
-	    {
-	      sym = local_syms + r_symndx;
-	      
-	      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
-		{
-		  sec = local_sections [r_symndx];
-		  rel->r_addend += sec->output_offset + sym->st_value;
-		}
-	    }
-
-	  continue;
-	}
-
       /* This is a final link.  */
       howto  = iq2000_elf_howto_table + ELF32_R_TYPE (rel->r_info);
       h      = NULL;
@@ -739,15 +659,6 @@ iq2000_elf_relocate_section (output_bfd,
 	case R_IQ2000_HI16:
 	  r = iq2000_elf_relocate_hi16 (input_bfd, rel, contents, relocation);
 	  break;
-	case R_IQ2000_26:
-	  r = iq2000_elf_relocate_26 (input_bfd, rel, contents, relocation);
-	  break;
-	case R_IQ2000_OFFSET_16:
-	  r = iq2000_elf_relocate_offset_16 (input_bfd, rel, contents, relocation);
-	  break;
-	case R_IQ2000_OFFSET_21:
-	  r = iq2000_elf_relocate_offset_21 (input_bfd, rel, contents, relocation);
-	  break;
 	case R_IQ2000_PC16:
 	  rel->r_addend -= 4;
 	  /* Fall through.  */
@@ -822,8 +733,8 @@ iq2000_elf_gc_sweep_hook (abfd, info, se
    relocation.  */
 
 static asection *
-iq2000_elf_gc_mark_hook (abfd, info, rel, h, sym)
-     bfd *                        abfd;
+iq2000_elf_gc_mark_hook (sec, info, rel, h, sym)
+     asection *			  sec;
      struct bfd_link_info *       info ATTRIBUTE_UNUSED;
      Elf_Internal_Rela *          rel;
      struct elf_link_hash_entry * h;
@@ -853,13 +764,7 @@ iq2000_elf_gc_mark_hook (abfd, info, rel
 	}
     }
   else
-    {
-      if (!(elf_bad_symtab (abfd)
-	    && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
-	  && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
-		&& sym->st_shndx != SHN_COMMON))
-	return bfd_section_from_elf_index (abfd, sym->st_shndx);
-    }
+    return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
 
   return NULL;
 }
@@ -1058,6 +963,7 @@ iq2000_elf_object_p (abfd)
 #define elf_backend_gc_sweep_hook		iq2000_elf_gc_sweep_hook
 #define elf_backend_check_relocs                iq2000_elf_check_relocs
 #define elf_backend_object_p		        iq2000_elf_object_p
+#define elf_backend_rela_normal			1
 
 #define elf_backend_can_gc_sections		1
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]