This is the mail archive of the binutils@sourceware.org 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]

[binutils-or32 1/7] bfd: fix partial_inplace,


bfd: fix partial_inplace, rewrite hi/lo cont relocation, excerpts from mips.
         use generic_reloc whenever is possible, and get rid of local 
         reloc functions.


-- 
Balint Cristian
diff -Nru binutils-2005-12-13-ORIG/src/bfd/elf32-or32.c binutils-2005-12-13-DONE/src/bfd/elf32-or32.c
--- binutils-2005-12-13-ORIG/src/bfd/elf32-or32.c	2005-07-01 14:16:29.000000000 +0300
+++ binutils-2005-12-13-DONE/src/bfd/elf32-or32.c	2005-12-13 18:45:23.000000000 +0200
@@ -1,7 +1,10 @@
 /* OR32-specific support for 32-bit ELF
-   Copyright 2002, 2004, 2005 Free Software Foundation, Inc.
-   Contributed by Ivan Guzvinec  <ivang@opencores.org>
+   Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
+   Contributed by Ivan Guzvinec  <ivang@opencores.org>
+   Modified by Gyorgy Jeney <nog@sdf.lonestar.org>
+	       Balint Cristian <rezso@rdsor.ro>
+	       
    This file is part of BFD, the Binary File Descriptor library.
 
    This program is free software; you can redistribute it and/or modify
@@ -16,283 +19,38 @@
 
    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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
 #include "libbfd.h"
 #include "elf-bfd.h"
 #include "elf/or32.h"
+#include "elf/common.h"
 #include "libiberty.h"
 
-/* Try to minimize the amount of space occupied by relocation tables
-   on the ROM (not that the ROM won't be swamped by other ELF overhead).  */
-#define USE_REL	1
-
-/* Set the right machine number for an OR32 ELF file.  */
-
-static bfd_boolean
-or32_elf_object_p (bfd *abfd)
-{
-  (void) bfd_default_set_arch_mach (abfd, bfd_arch_or32, 0);
-  return TRUE;
-}
-
-/* The final processing done just before writing out an OR32 ELF object file.
-   This gets the OR32 architecture right based on the machine number.  */
-
-static void
-or32_elf_final_write_processing (bfd *abfd,
-				 bfd_boolean linker ATTRIBUTE_UNUSED)
-{
-  elf_elfheader (abfd)->e_flags &=~ EF_OR32_MACH;
-}
-
-static bfd_reloc_status_type
-or32_elf_32_reloc (bfd *abfd,
-		   arelent *reloc_entry,
-		   asymbol *symbol,
-		   void * data,
-		   asection *input_section,
-		   bfd *output_bfd,
-		   char **error_message ATTRIBUTE_UNUSED)
-{
-  if (output_bfd != NULL)
-    {
-      unsigned long insn;
-      bfd_size_type addr = reloc_entry->address;
-
-      reloc_entry->address += input_section->output_offset;
-
-      insn = bfd_get_32 (abfd, (bfd_byte *) data + addr);
-      insn += symbol->section->output_section->vma;
-      insn += symbol->section->output_offset;
-      insn += symbol->value;
-      bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
-
-      return bfd_reloc_ok;
-    }
-
-  return bfd_reloc_continue;
-}
-
-static bfd_reloc_status_type
-or32_elf_16_reloc (bfd *abfd,
-		   arelent *reloc_entry,
-		   asymbol *symbol,
-		   void * data,
-		   asection *input_section,
-		   bfd *output_bfd,
-		   char **error_message ATTRIBUTE_UNUSED)
-{
-  if (output_bfd != NULL)
-    {
-      unsigned short insn;
-      bfd_size_type addr = reloc_entry->address;
-
-      reloc_entry->address += input_section->output_offset;
-
-      insn = bfd_get_16 (abfd, (bfd_byte *) data + addr);
-      insn += symbol->section->output_section->vma;
-      insn += symbol->section->output_offset;
-      insn += symbol->value;
-      bfd_put_16 (abfd, insn, (bfd_byte *) data + addr);
-
-      return bfd_reloc_ok;
-    }
-
-  return bfd_reloc_continue;
-}
-
-static bfd_reloc_status_type
-or32_elf_8_reloc (bfd *abfd ATTRIBUTE_UNUSED,
-		  arelent *reloc_entry,
-		  asymbol *symbol,
-		  void * data,
-		  asection *input_section,
-		  bfd *output_bfd,
-		  char **error_message ATTRIBUTE_UNUSED)
-{
-  if (output_bfd != NULL)
-    {
-      unsigned char insn;
-      bfd_size_type addr = reloc_entry->address;
-
-      reloc_entry->address += input_section->output_offset;
-
-      insn = bfd_get_8 (abfd, (bfd_byte *) data + addr);
-      insn += symbol->section->output_section->vma;
-      insn += symbol->section->output_offset;
-      insn += symbol->value;
-      bfd_put_8 (abfd, insn, (bfd_byte *) data + addr);
-
-      return bfd_reloc_ok;
-    }
-
-  return bfd_reloc_continue;
-}
-
-/* Do a R_OR32_CONSTH relocation.  This has to be done in combination
-   with a R_OR32_CONST reloc, because there is a carry from the LO16 to
-   the HI16.  Here we just save the information we need; we do the
-   actual relocation when we see the LO16.  OR32 ELF requires that the
-   LO16 immediately follow the HI16.  As a GNU extension, we permit an
-   arbitrary number of HI16 relocs to be associated with a single LO16
-   reloc.  This extension permits gcc to output the HI and LO relocs
-   itself. This code is copied from the elf32-mips.c.  */
-
-struct or32_consth
-{
-  struct or32_consth *next;
-  bfd_byte *addr;
-  bfd_vma addend;
-};
-
-/* FIXME: This should not be a static variable.  */
-
-static struct or32_consth *or32_consth_list;
-
-static bfd_reloc_status_type
-or32_elf_consth_reloc (bfd *abfd ATTRIBUTE_UNUSED,
-		       arelent *reloc_entry,
-		       asymbol *symbol,
-		       void * data,
-		       asection *input_section,
-		       bfd *output_bfd,
-		       char **error_message ATTRIBUTE_UNUSED)
-{
-  bfd_reloc_status_type ret;
-  bfd_vma relocation;
-  struct or32_consth *n;
-
-  ret = bfd_reloc_ok;
-
-  if (bfd_is_und_section (symbol->section)
-      && output_bfd == NULL)
-    ret = bfd_reloc_undefined;
-
-  if (bfd_is_com_section (symbol->section))
-    relocation = 0;
-  else
-    relocation = symbol->value;
-
-  relocation += symbol->section->output_section->vma;
-  relocation += symbol->section->output_offset;
-  relocation += reloc_entry->addend;
-
-  if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
-    return bfd_reloc_outofrange;
-
-  /* Save the information, and let LO16 do the actual relocation.  */
-  n = bfd_malloc (sizeof *n);
-  if (n == NULL)
-    return bfd_reloc_outofrange;
-  n->addr = (bfd_byte *) data + reloc_entry->address;
-  n->addend = relocation;
-  n->next = or32_consth_list;
-  or32_consth_list = n;
 
-  if (output_bfd != NULL)
-    reloc_entry->address += input_section->output_offset;
-
-  return ret;
-}
-
-/* Do a R_OR32_CONST relocation.  This is a straightforward 16 bit
-   inplace relocation; this function exists in order to do the
-   R_OR32_CONSTH relocation described above.  */
-
-static bfd_reloc_status_type
-or32_elf_const_reloc (bfd *abfd,
-		      arelent *reloc_entry,
-		      asymbol *symbol,
-		      void * data,
-		      asection *input_section,
-		      bfd *output_bfd,
-		      char **error_message)
-{
-  if (or32_consth_list != NULL)
-    {
-      struct or32_consth *l;
-
-      l = or32_consth_list;
-      while (l != NULL)
-	{
-	  unsigned long insn;
-	  unsigned long val;
-          unsigned long vallo;
-	  struct or32_consth *next;
-
-	  /* Do the HI16 relocation.  Note that we actually don't need
-	     to know anything about the LO16 itself, except where to
-	     find the low 16 bits of the addend needed by the LO16.  */
-	  insn = bfd_get_32 (abfd, l->addr);
-	  vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address)
-		   & 0xffff);
-	  val = ((insn & 0xffff) << 16) + vallo;
-	  val += l->addend;
-
-	  insn = (insn &~ 0xffff) | ((val >> 16) & 0xffff);
-	  bfd_put_32 (abfd, insn, l->addr);
-
-	  next = l->next;
-	  free (l);
-	  l = next;
-	}
-
-      or32_consth_list = NULL;
-    }
-
-  if (output_bfd != NULL)
-    {
-      unsigned long insn, tmp;
-      bfd_size_type addr = reloc_entry->address;
-
-      reloc_entry->address += input_section->output_offset;
-
-      insn = bfd_get_32 (abfd, (bfd_byte *) data + addr);
-      tmp = insn & 0x0000ffff;
-      tmp += symbol->section->output_section->vma;
-      tmp += symbol->section->output_offset;
-      tmp += symbol->value;
-      insn = (insn & 0xffff0000) | (tmp & 0x0000ffff);
-      bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
-
-      return bfd_reloc_ok;
-    }
-
-  /* Now do the LO16 reloc in the usual way.  */
-  return bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
-				input_section, output_bfd, error_message);
-}
-
-static bfd_reloc_status_type
-or32_elf_jumptarg_reloc (bfd *abfd,
-			 arelent *reloc_entry,
-			 asymbol *symbol ATTRIBUTE_UNUSED,
-			 void * data,
-			 asection *input_section,
-			 bfd *output_bfd,
-			 char **error_message ATTRIBUTE_UNUSED)
-{
-  if (output_bfd != NULL)
-    {
-      unsigned long insn, tmp;
-      bfd_size_type addr = reloc_entry->address;
+static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
+  PARAMS ((bfd *, bfd_reloc_code_real_type));
+static void or32_info_to_howto_rel
+  PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+static bfd_boolean or32_elf_object_p
+  PARAMS ((bfd *));
+static void or32_elf_final_write_processing
+  PARAMS ((bfd *, bfd_boolean));
+static bfd_reloc_status_type or32_elf_const_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type or32_elf_consth_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type _bfd_or32_elf_generic_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **));
 
-      reloc_entry->address += input_section->output_offset;
+#define ELF_R_SYM(i)  (ELF32_R_SYM (i))
 
-      insn = bfd_get_32 (abfd, (bfd_byte *) data + addr);
-      tmp = insn | 0xfc000000;
-      tmp -= (input_section->output_offset >> 2);
-      insn = (insn & 0xfc000000) | (tmp & 0x03ffffff);
-      bfd_put_32 (abfd, insn, (bfd_byte *) data + addr);
 
-      return bfd_reloc_ok;
-    }
-
-  return bfd_reloc_continue;
-}
+/* Try to minimize the amount of space occupied by relocation tables
+   on the ROM (not that the ROM won't be swamped by other ELF overhead).  */
+#define USE_REL 	1
 
 static reloc_howto_type elf_or32_howto_table[] =
 {
@@ -319,9 +77,9 @@
 	 FALSE,	                /* pc_relative */
 	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 or32_elf_32_reloc, 	/* special_function */
+	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_OR32_32",		/* name */
-	 FALSE,	                /* partial_inplace */
+	 TRUE,	                /* partial_inplace */
 	 0xffffffff,	        /* src_mask */
 	 0xffffffff,   		/* dst_mask */
 	 FALSE),                /* pcrel_offset */
@@ -334,9 +92,9 @@
 	 FALSE,	                /* pc_relative */
 	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 or32_elf_16_reloc, 	/* special_function */
+	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_OR32_16",		/* name */
-	 FALSE,	                /* partial_inplace */
+	 TRUE,	                /* partial_inplace */
 	 0x0000ffff,	        /* src_mask */
 	 0x0000ffff,   		/* dst_mask */
 	 FALSE),                /* pcrel_offset */
@@ -349,9 +107,9 @@
 	 FALSE,	                /* pc_relative */
 	 0,	                /* bitpos */
 	 complain_overflow_bitfield, /* complain_on_overflow */
-	 or32_elf_8_reloc, 	/* special_function */
+	 bfd_elf_generic_reloc,	/* special_function */
 	 "R_OR32_8",		/* name */
-	 FALSE,	                /* partial_inplace */
+	 TRUE,	                /* partial_inplace */
 	 0x000000ff,	        /* src_mask */
 	 0x000000ff,   		/* dst_mask */
 	 FALSE),                /* pcrel_offset */
@@ -366,7 +124,7 @@
 	 complain_overflow_dont, /* complain_on_overflow */
 	 or32_elf_const_reloc,	/* special_function */
 	 "R_OR32_CONST",	/* name */
-	 FALSE,			/* partial_inplace */
+	 TRUE,			/* partial_inplace */
 	 0x0000ffff,		/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
@@ -376,13 +134,13 @@
 	 16,			/* rightshift */
 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
 	 16,			/* bitsize */
-	 TRUE,			/* pc_relative */
+	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_dont, /* complain_on_overflow */
 	 or32_elf_consth_reloc,	/* special_function */
 	 "R_OR32_CONSTH",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0xffff0000,		/* src_mask */
+	 TRUE,			/* partial_inplace */
+	 0x0000ffff,		/* src_mask */
 	 0x0000ffff,		/* dst_mask */
 	 FALSE),		/* pcrel_offset */
 
@@ -394,10 +152,10 @@
 	 TRUE,			/* pc_relative */
 	 0,			/* bitpos */
 	 complain_overflow_signed, /* complain_on_overflow */
-	 or32_elf_jumptarg_reloc,/* special_function */
+	 _bfd_or32_elf_generic_reloc,	/* special_function */
 	 "R_OR32_JUMPTARG",	/* name */
-	 FALSE,			/* partial_inplace */
-	 0,			/* src_mask */
+	 TRUE,			/* partial_inplace */
+	 0x03ffffff,		/* src_mask *//* markom, was: 0 */
 	 0x03ffffff,		/* dst_mask */
 	 TRUE), 		/* pcrel_offset */
 
@@ -448,20 +206,23 @@
   { BFD_RELOC_8, R_OR32_8 },
   { BFD_RELOC_LO16, R_OR32_CONST },
   { BFD_RELOC_HI16, R_OR32_CONSTH },
-  { BFD_RELOC_32_GOT_PCREL, R_OR32_JUMPTARG },
+  { BFD_RELOC_28_PCREL_S2, R_OR32_JUMPTARG },
   { BFD_RELOC_VTABLE_INHERIT, R_OR32_GNU_VTINHERIT },
   { BFD_RELOC_VTABLE_ENTRY, R_OR32_GNU_VTENTRY },
 };
 
 static reloc_howto_type *
-bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
-				 bfd_reloc_code_real_type code)
+bfd_elf32_bfd_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
 {
   unsigned int i;
 
   for (i = ARRAY_SIZE (or32_reloc_map); i--;)
-    if (or32_reloc_map[i].bfd_reloc_val == code)
-      return &elf_or32_howto_table[or32_reloc_map[i].elf_reloc_val];
+    {
+      if (or32_reloc_map[i].bfd_reloc_val == code)
+	return &elf_or32_howto_table[or32_reloc_map[i].elf_reloc_val];
+    }
 
   return NULL;
 }
@@ -469,15 +230,230 @@
 /* Set the howto pointer for an OR32 ELF reloc.  */
 
 static void
-or32_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
-			arelent *cache_ptr,
-			Elf_Internal_Rela *dst)
+or32_info_to_howto_rel (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf_Internal_Rela *dst;
 {
   unsigned int r_type;
 
+//static void or32_elf_info_to_howto_rel
+//  (bfd *bfd, 
+//   arelent *relent, 
+//   Elf_Internal_Rela *rela)
+
   r_type = ELF32_R_TYPE (dst->r_info);
   BFD_ASSERT (r_type < (unsigned int) R_OR32_max);
   cache_ptr->howto = &elf_or32_howto_table[r_type];
+
+      asymbol *s = *(cache_ptr->sym_ptr_ptr);
+  if(ELF_R_SYM(dst->r_info) && (s->flags & BSF_SECTION_SYM))
+      cache_ptr->sym_ptr_ptr = s->section->symbol_ptr_ptr;
+
+}
+
+/* Set the right machine number for an OR32 ELF file.  */
+
+static bfd_boolean
+or32_elf_object_p (abfd)
+     bfd *abfd;
+{
+  (void) bfd_default_set_arch_mach (abfd, bfd_arch_or32, 0);
+  return TRUE;
+}
+
+/* The final processing done just before writing out an OR32 ELF object file.
+   This gets the OR32 architecture right based on the machine number.  */
+
+static void
+or32_elf_final_write_processing (abfd, linker)
+     bfd *abfd;
+     bfd_boolean linker ATTRIBUTE_UNUSED;
+{
+  int mach;
+  unsigned long val;
+
+  switch (mach = bfd_get_mach (abfd))
+    {
+    /*
+    case bfd_mach_arc_base:
+      val = E_OR32_MACH_BASE;
+      break;
+    */
+    default:
+      val = 0;
+      return;
+    }
+
+  elf_elfheader (abfd)->e_flags &=~ EF_OR32_MACH;
+  elf_elfheader (abfd)->e_flags |= val;
+}
+
+static bfd_reloc_status_type
+_bfd_or32_elf_generic_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
+			     asymbol *symbol, void *data ATTRIBUTE_UNUSED,
+			     asection *input_section, bfd *output_bfd,
+			     char **error_message ATTRIBUTE_UNUSED)
+{
+  bfd_signed_vma val;
+  bfd_reloc_status_type status;
+  bfd_boolean relocatable;
+
+  relocatable = (output_bfd != NULL);
+
+  if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+    return bfd_reloc_outofrange;
+
+  /* Build up the field adjustment in VAL.  */
+  val = 0;
+  if (!relocatable || (symbol->flags & BSF_SECTION_SYM) != 0)
+    {
+      /* Either we're calculating the final field value or we have a
+	 relocation against a section symbol.  Add in the section's
+	 offset or address.  */
+      val += symbol->section->output_section->vma;
+      val += symbol->section->output_offset;
+    }
+
+  if (!relocatable)
+    {
+      /* We're calculating the final field value.  Add in the symbol's value
+	 and, if pc-relative, subtract the address of the field itself.  */
+      val += symbol->value;
+      if (reloc_entry->howto->pc_relative)
+	val -= input_section->output_section->vma;
+    }
+
+  if (reloc_entry->howto->pc_relative)
+    val -= input_section->output_offset;
+
+  /* VAL is now the final adjustment.  If we're keeping this relocation
+     in the output file, and if the relocation uses a separate addend,
+     we just need to add VAL to that addend.  Otherwise we need to add
+     VAL to the relocation field itself.  */
+  if (relocatable && !reloc_entry->howto->partial_inplace)
+    reloc_entry->addend += val;
+  else
+    {
+      /* Add in the separate addend, if any.  */
+      val += reloc_entry->addend;
+
+      /* Add VAL to the relocation field.  */
+      status = _bfd_relocate_contents (reloc_entry->howto, abfd, val,
+				       (bfd_byte *) data
+				       + reloc_entry->address);
+      if (status != bfd_reloc_ok)
+	return status;
+    }
+
+  if (relocatable)
+    reloc_entry->address += input_section->output_offset;
+
+  return bfd_reloc_ok;
+}
+
+
+/* Do a R_OR32_CONSTH relocation.  This has to be done in combination
+   with a R_OR32_CONST reloc, because there is a carry from the LO16 to
+   the HI16.  Here we just save the information we need; we do the
+   actual relocation when we see the LO16.  OR32 ELF requires that the
+   LO16 immediately follow the HI16.  As a GNU extension, we permit an
+   arbitrary number of HI16 relocs to be associated with a single LO16
+   reloc.  This extension permits gcc to output the HI and LO relocs
+   itself. This code is copied from the elf32-mips.c.  */
+
+struct or32_consth
+{
+  struct or32_consth *next;
+  bfd_byte *data;
+  asection *input_section;
+  arelent rel;
+};
+
+/* FIXME: This should not be a static variable.  */
+
+static struct or32_consth *or32_consth_list;
+
+bfd_reloc_status_type
+or32_elf_consth_reloc (abfd, reloc_entry, symbol, data, input_section,
+		       output_bfd, error_message)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry;
+     asymbol *symbol ATTRIBUTE_UNUSED;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message ATTRIBUTE_UNUSED;
+{
+  struct or32_consth *n;
+
+  if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+    return bfd_reloc_outofrange;
+
+  /* Save the information, and let LO16 do the actual relocation.  */
+  n = (struct or32_consth *) bfd_malloc (sizeof *n);
+  if (n == NULL)
+    return bfd_reloc_outofrange;
+
+  /* Push this reloc on the list of pending relocations */
+  n->next = or32_consth_list;
+  n->data = data;
+  n->input_section = input_section;
+  n->rel = *reloc_entry;
+  or32_consth_list = n;
+
+  if (output_bfd != NULL)
+    reloc_entry->address += input_section->output_offset;
+
+  return bfd_reloc_ok;
+}
+
+/* Do a R_OR32_CONST relocation.  This is a straightforward 16 bit
+   inplace relocation; this function exists in order to do the
+   R_OR32_CONSTH relocation described above.  */
+
+bfd_reloc_status_type
+or32_elf_const_reloc (abfd, reloc_entry, symbol, data, input_section,
+		      output_bfd, error_message)
+     bfd *abfd;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message;
+{
+  bfd_vma vallo;
+
+  if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
+    return bfd_reloc_outofrange;
+
+  vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address) & 0xffff;
+
+  while (or32_consth_list != NULL)
+    {
+      bfd_reloc_status_type ret;
+      struct or32_consth *hi;
+
+      hi = or32_consth_list;
+
+      /* VALLO is a signed 16-bit number.  Bias it by 0x8000 so that any
+	 carry or borrow will induce a change of +1 or -1 in the high part.  */
+      hi->rel.addend += vallo;
+
+      ret = _bfd_or32_elf_generic_reloc (abfd, &hi->rel, symbol, hi->data,
+					 hi->input_section, output_bfd,
+					 error_message);
+      if (ret != bfd_reloc_ok)
+	return ret;
+
+      or32_consth_list = hi->next;
+      free (hi);
+    }
+
+  return _bfd_or32_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+				      input_section, output_bfd,
+				      error_message);
 }
 
 #define TARGET_LITTLE_SYM	bfd_elf32_or32_little_vec
@@ -485,11 +461,15 @@
 #define TARGET_BIG_SYM		bfd_elf32_or32_big_vec
 #define TARGET_BIG_NAME		"elf32-or32"
 #define ELF_ARCH		bfd_arch_or32
-#define ELF_MACHINE_CODE	EM_OR32
-#define ELF_MAXPAGESIZE		0x1000
+#define ELF_MACHINE_CODE	EM_OPENRISC
+#define ELF_MACHINE_ALT1	EM_OR32
+#define ELF_MAXPAGESIZE		0x2000
 
 #define elf_info_to_howto	0
 #define elf_info_to_howto_rel	or32_info_to_howto_rel
+//#define bfd_elf32_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
+//#define elf_backend_can_gc_sections 1
+//#define elf_backend_check_relocs or32_elf_check_relocs
 #define elf_backend_object_p	or32_elf_object_p
 #define elf_backend_final_write_processing \
 				or32_elf_final_write_processing

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