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]

elf_backend_rela_normal


It seems I missed quite a few candidates for elf_backend_rela_normal
in my 2002-05-07 patch.  Perhaps due to grepping for USE_RELA, which
is quite unreliable because there's no need to ever define it.  I've
also fixed the relocate_section comment in a number of targets that
falsely claim trying to support both REL and RELA relocs.

	* elf-hppa.h (elf_hppa_relocate_section): If relocatable, return
	immediately.  Remove code handling relocatable linking.
	* elf32-avr.c (elf32_avr_relocate_section): Likewise.
	* elf32-cris.c (cris_elf_relocate_section): Likewise.
	* elf32-fr30.c (elf32_frv_relocate_section): Likewise.
	* elf32-h8300.c (elf32_h8_relocate_section): Likewise.
	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
	* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
	* elf32-v850.c (v850_elf_relocate_section): Likewise.
	* elf32-vax.c (elf_vax_relocate_section): Likewise.
	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
	* elf32-avr.c (elf_backend_rela_normal): Define.
	* elf32-cris.c: Likewise.
	* elf32-fr30.c: Likewise.
	* elf32-h8300.c: Likewise.
	* elf32-hppa.c: Likewise.
	* elf32-ip2k.c: Likewise.
	* elf32-sparc.c: Likewise.
	* elf32-v850.c: Likewise.
	* elf32-vax.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-sparc.c: Likewise.
	* elf32-fr30.c (elf32_frv_relocate_section): Edit comment.
	* elf32-i860.c (elf32_i860_relocate_section): Likewise.
	* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
	* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
	* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
	* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
	* elf-m10200.c (USE_RELA): Don't define.
	* elf-m10300.c: Likewise.
	* elf32-i370.c: Likewise.
	* elf32-ip2k.c: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-mcore.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-s390.c: Likewise.
	* elf32-vax.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-s390.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* elf32-avr.c (USE_REL): Don't undef.
	* elf32-ip2k.c: Likewise.

Applying mainline only.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: bfd/elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.58
diff -u -p -r1.58 elf-hppa.h
--- bfd/elf-hppa.h	16 Jul 2002 02:26:30 -0000	1.58
+++ bfd/elf-hppa.h	23 Jul 2002 09:39:10 -0000
@@ -1376,8 +1376,12 @@ elf_hppa_relocate_section (output_bfd, i
   Elf_Internal_Shdr *symtab_hdr;
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
-  struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
+  struct elf64_hppa_link_hash_table *hppa_info;
 
+  if (info->relocateable)
+    return true;
+
+  hppa_info = elf64_hppa_hash_table (info);
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
 
   rel = relocs;
@@ -1405,28 +1409,8 @@ elf_hppa_relocate_section (output_bfd, i
 	  return false;
 	}
 
-      r_symndx = ELF_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)
-		{
-		  sym_sec = local_sections[r_symndx];
-		  rel->r_addend += sym_sec->output_offset;
-		}
-	    }
-
-	  continue;
-	}
-
       /* This is a final link.  */
+      r_symndx = ELF_R_SYM (rel->r_info);
       h = NULL;
       sym = NULL;
       sym_sec = NULL;
Index: bfd/elf-m10200.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10200.c,v
retrieving revision 1.17
diff -u -p -r1.17 elf-m10200.c
--- bfd/elf-m10200.c	7 Jul 2002 09:10:39 -0000	1.17
+++ bfd/elf-m10200.c	23 Jul 2002 09:39:11 -0000
@@ -45,10 +45,6 @@ static bfd_byte * mn10200_elf_get_reloca
   PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
 	   bfd_byte *, boolean, asymbol **));
 
-/* We have to use RELA instructions since md_apply_fix3 in the assembler
-   does absolutely nothing.  */
-#define USE_RELA
-
 enum reloc_type {
   R_MN10200_NONE = 0,
   R_MN10200_32,
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.28
diff -u -p -r1.28 elf-m10300.c
--- bfd/elf-m10300.c	7 Jul 2002 09:10:39 -0000	1.28
+++ bfd/elf-m10300.c	23 Jul 2002 09:39:13 -0000
@@ -134,10 +134,6 @@ static void compute_function_info
   PARAMS ((bfd *, struct elf32_mn10300_link_hash_entry *,
 	   bfd_vma, unsigned char *));
 
-/* We have to use RELA instructions since md_apply_fix3 in the assembler
-   does absolutely nothing.  */
-#define USE_RELA
-
 static reloc_howto_type elf_mn10300_howto_table[] = {
   /* Dummy relocation.  Does nothing.  */
   HOWTO (R_MN10300_NONE,
Index: bfd/elf32-avr.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-avr.c,v
retrieving revision 1.10
diff -u -p -r1.10 elf32-avr.c
--- bfd/elf32-avr.c	1 Jul 2002 08:06:42 -0000	1.10
+++ bfd/elf32-avr.c	23 Jul 2002 10:42:52 -0000
@@ -46,9 +46,6 @@ static boolean elf32_avr_relocate_sectio
 static void bfd_elf_avr_final_write_processing PARAMS ((bfd *, boolean));
 static boolean elf32_avr_object_p PARAMS ((bfd *));
 
-/* Use RELA instead of REL */
-#undef USE_REL
-
 static reloc_howto_type elf_avr_howto_table[] =
 {
   HOWTO (R_AVR_NONE,		/* type */
@@ -722,6 +719,9 @@ elf32_avr_relocate_section (output_bfd, 
   Elf_Internal_Rela *           rel;
   Elf_Internal_Rela *           relend;
 
+  if (info->relocateable)
+    return true;
+
   symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
   relend     = relocs + input_section->reloc_count;
@@ -738,30 +738,9 @@ elf32_avr_relocate_section (output_bfd, 
       const char *                 name = NULL;
       int                          r_type;
 
+      /* This is a final link.  */
       r_type = ELF32_R_TYPE (rel->r_info);
       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  = elf_avr_howto_table + ELF32_R_TYPE (rel->r_info);
       h      = NULL;
       sym    = NULL;
@@ -952,6 +931,7 @@ elf32_avr_object_p (abfd)
 #define elf_backend_gc_sweep_hook            elf32_avr_gc_sweep_hook
 #define elf_backend_check_relocs             elf32_avr_check_relocs
 #define elf_backend_can_gc_sections          1
+#define elf_backend_rela_normal		     1
 #define elf_backend_final_write_processing \
 					bfd_elf_avr_final_write_processing
 #define elf_backend_object_p		elf32_avr_object_p
Index: bfd/elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.34
diff -u -p -r1.34 elf32-cris.c
--- bfd/elf32-cris.c	12 Jul 2002 15:54:57 -0000	1.34
+++ bfd/elf32-cris.c	23 Jul 2002 09:39:15 -0000
@@ -799,6 +799,9 @@ cris_elf_relocate_section (output_bfd, i
   Elf_Internal_Rela *           rel;
   Elf_Internal_Rela *           relend;
 
+  if (info->relocateable)
+    return true;
+
   dynobj = elf_hash_table (info)->dynobj;
   local_got_offsets = elf_local_got_offsets (input_bfd);
   symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
@@ -833,29 +836,8 @@ cris_elf_relocate_section (output_bfd, i
 	  || r_type == R_CRIS_GNU_VTENTRY)
 	continue;
 
-      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.  */
+      r_symndx = ELF32_R_SYM (rel->r_info);
       howto  = cris_elf_howto_table + r_type;
       h      = NULL;
       sym    = NULL;
@@ -3113,6 +3095,7 @@ elf_cris_reloc_type_class (rela)
    take the easy route.  */
 #define elf_backend_may_use_rel_p 0
 #define elf_backend_may_use_rela_p 1
+#define elf_backend_rela_normal		1
 
 #include "elf32-target.h"
 
Index: bfd/elf32-fr30.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-fr30.c,v
retrieving revision 1.16
diff -u -p -r1.16 elf32-fr30.c
--- bfd/elf32-fr30.c	1 Jul 2002 08:06:43 -0000	1.16
+++ bfd/elf32-fr30.c	23 Jul 2002 09:39:16 -0000
@@ -468,9 +468,6 @@ fr30_final_link_relocate (howto, input_b
 }
 
 /* Relocate an FR30 ELF section.
-   There is some attempt to make this function usable for many architectures,
-   both USE_REL and USE_RELA ['twould be nice if such a critter existed],
-   if only to serve as a learning tool.
 
    The RELOCATE_SECTION function is called by the new ELF backend linker
    to handle the relocations for a section.
Index: bfd/elf32-frv.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-frv.c,v
retrieving revision 1.2
diff -u -p -r1.2 elf32-frv.c
--- bfd/elf32-frv.c	1 Jul 2002 08:06:43 -0000	1.2
+++ bfd/elf32-frv.c	23 Jul 2002 09:39:16 -0000
@@ -621,9 +621,6 @@ frv_final_link_relocate (howto, input_bf
 
 
 /* Relocate an FRV ELF section.
-   There is some attempt to make this function usable for many architectures,
-   both USE_REL and USE_RELA ['twould be nice if such a critter existed],
-   if only to serve as a learning tool.
 
    The RELOCATE_SECTION function is called by the new ELF backend linker
    to handle the relocations for a section.
@@ -655,7 +652,7 @@ frv_final_link_relocate (howto, input_bf
 
 static boolean
 elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
-			   contents, relocs, local_syms, local_sections)
+			    contents, relocs, local_syms, local_sections)
      bfd *                   output_bfd ATTRIBUTE_UNUSED;
      struct bfd_link_info *  info;
      bfd *                   input_bfd;
@@ -670,6 +667,9 @@ elf32_frv_relocate_section (output_bfd, 
   Elf_Internal_Rela *           rel;
   Elf_Internal_Rela *           relend;
 
+  if (info->relocateable)
+    return true;
+
   symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
   relend     = relocs + input_section->reloc_count;
@@ -692,29 +692,8 @@ elf32_frv_relocate_section (output_bfd, 
 	  || r_type == R_FRV_GNU_VTENTRY)
 	continue;
       
-      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.  */
+      r_symndx = ELF32_R_SYM (rel->r_info);
       howto  = elf32_frv_howto_table + ELF32_R_TYPE (rel->r_info);
       h      = NULL;
       sym    = NULL;
@@ -1389,6 +1368,7 @@ frv_elf_print_private_bfd_data (abfd, pt
 #define elf_backend_add_symbol_hook             elf32_frv_add_symbol_hook
 
 #define elf_backend_can_gc_sections		1
+#define elf_backend_rela_normal			1
 
 #define bfd_elf32_bfd_reloc_type_lookup		frv_reloc_type_lookup
 #define bfd_elf32_bfd_set_private_flags		frv_elf_set_private_flags
Index: bfd/elf32-h8300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-h8300.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf32-h8300.c
--- bfd/elf32-h8300.c	7 Jul 2002 09:10:39 -0000	1.14
+++ bfd/elf32-h8300.c	23 Jul 2002 09:39:18 -0000
@@ -429,6 +429,9 @@ elf32_h8_relocate_section (output_bfd, i
   struct elf_link_hash_entry **sym_hashes;
   Elf_Internal_Rela *rel, *relend;
 
+  if (info->relocateable)
+    return true;
+
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
 
@@ -444,29 +447,9 @@ elf32_h8_relocate_section (output_bfd, i
       bfd_vma relocation;
       bfd_reloc_status_type r;
 
+      /* This is a final link.  */
       r_symndx = ELF32_R_SYM (rel->r_info);
       r_type = ELF32_R_TYPE (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.  */
       h = NULL;
       sym = NULL;
       sec = NULL;
@@ -1465,6 +1448,7 @@ elf32_h8_get_relocated_section_contents 
 
 /* Use an H8 specific linker, not the ELF generic linker.  */
 #define elf_backend_relocate_section elf32_h8_relocate_section
+#define elf_backend_rela_normal		1
 
 /* And relaxing stuff.  */
 #define bfd_elf32_bfd_relax_section     elf32_h8_relax_section
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.87
diff -u -p -r1.87 elf32-hppa.c
--- bfd/elf32-hppa.c	7 Jul 2002 09:10:40 -0000	1.87
+++ bfd/elf32-hppa.c	23 Jul 2002 09:39:22 -0000
@@ -3610,6 +3610,9 @@ elf32_hppa_relocate_section (output_bfd,
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
 
+  if (info->relocateable)
+    return true;
+
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
 
   htab = hppa_link_hash_table (info);
@@ -3641,27 +3644,8 @@ elf32_hppa_relocate_section (output_bfd,
 	  || r_type == (unsigned int) R_PARISC_GNU_VTINHERIT)
 	continue;
 
-      r_symndx = ELF32_R_SYM (rel->r_info);
-
-      if (info->relocateable)
-	{
-	  /* This is a relocatable 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)
-		{
-		  sym_sec = local_sections[r_symndx];
-		  rel->r_addend += sym_sec->output_offset;
-		}
-	    }
-	  continue;
-	}
-
       /* This is a final link.  */
+      r_symndx = ELF32_R_SYM (rel->r_info);
       h = NULL;
       sym = NULL;
       sym_sec = NULL;
@@ -4469,6 +4453,7 @@ elf32_hppa_elf_get_symbol_type (elf_sym,
 #define elf_backend_plt_readonly	     0
 #define elf_backend_want_plt_sym	     0
 #define elf_backend_got_header_size	     8
+#define elf_backend_rela_normal		     1
 
 #define TARGET_BIG_SYM		bfd_elf32_hppa_vec
 #define TARGET_BIG_NAME		"elf32-hppa"
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.22
diff -u -p -r1.22 elf32-i370.c
--- bfd/elf32-i370.c	4 Jun 2002 00:51:07 -0000	1.22
+++ bfd/elf32-i370.c	23 Jul 2002 09:39:23 -0000
@@ -34,8 +34,6 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "elf-bfd.h"
 #include "elf/i370.h"
 
-#define USE_RELA		/* we want RELA relocations, not REL */
-
 /* i370 relocations */
 /* Note that there is really just one relocation that we currently
  * support (and only one that we seem to need, at the moment), and
Index: bfd/elf32-i860.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i860.c,v
retrieving revision 1.16
diff -u -p -r1.16 elf32-i860.c
--- bfd/elf32-i860.c	7 May 2002 00:16:51 -0000	1.16
+++ bfd/elf32-i860.c	23 Jul 2002 09:39:23 -0000
@@ -831,9 +831,6 @@ i860_final_link_relocate (howto, input_b
 /* Relocate an i860 ELF section.
 
    This is boiler-plate code copied from fr30.
-   There is some attempt to make this function usable for many architectures,
-   both USE_REL and USE_RELA ['twould be nice if such a critter existed],
-   if only to serve as a learning tool.
 
    The RELOCATE_SECTION function is called by the new ELF backend linker
    to handle the relocations for a section.
Index: bfd/elf32-ip2k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ip2k.c,v
retrieving revision 1.1
diff -u -p -r1.1 elf32-ip2k.c
--- bfd/elf32-ip2k.c	17 Jul 2002 14:15:49 -0000	1.1
+++ bfd/elf32-ip2k.c	23 Jul 2002 09:39:24 -0000
@@ -1711,9 +1711,6 @@ ip2k_final_link_relocate (howto, input_b
 }
 
 /* Relocate a IP2K ELF section.
-   There is some attempt to make this function usable for many architectures,
-   both USE_REL and USE_RELA ['twould be nice if such a critter existed],
-   if only to serve as a learning tool.
 
    The RELOCATE_SECTION function is called by the new ELF backend linker
    to handle the relocations for a section.
@@ -1760,6 +1757,9 @@ ip2k_elf_relocate_section (output_bfd, i
   Elf_Internal_Rela *           rel;
   Elf_Internal_Rela *           relend;
 
+  if (info->relocateable)
+    return true;
+
   symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
   relend     = relocs + input_section->reloc_count;
@@ -1776,31 +1776,9 @@ ip2k_elf_relocate_section (output_bfd, i
       const char *                 name = NULL;
       int                          r_type;
       
+      /* This is a final link.  */
       r_type = ELF32_R_TYPE (rel->r_info);
-
       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  = ip2k_elf_howto_table + ELF32_R_TYPE (rel->r_info);
       h      = NULL;
       sym    = NULL;
@@ -1968,13 +1946,11 @@ ip2k_elf_gc_sweep_hook (abfd, info, sec,
 #define ELF_MACHINE_CODE EM_IP2K
 #define ELF_MAXPAGESIZE  1 /* No pages on the IP2K */
 
-#undef USE_REL
-#define USE_RELA
-
 #define elf_info_to_howto_rel			NULL
 #define elf_info_to_howto			ip2k_info_to_howto_rela
 
 #define elf_backend_can_gc_sections     	1
+#define elf_backend_rela_normal			1
 #define elf_backend_gc_mark_hook                ip2k_elf_gc_mark_hook
 #define elf_backend_gc_sweep_hook               ip2k_elf_gc_sweep_hook
 
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.25
diff -u -p -r1.25 elf32-m32r.c
--- bfd/elf32-m32r.c	7 Jul 2002 09:10:39 -0000	1.25
+++ bfd/elf32-m32r.c	23 Jul 2002 09:39:26 -0000
@@ -931,8 +931,7 @@ m32r_elf_final_sda_base (output_bfd, inf
 
 /* Relocate an M32R/D ELF section.
    There is some attempt to make this function usable for many architectures,
-   both USE_REL and USE_RELA ['twould be nice if such a critter existed],
-   if only to serve as a learning tool.
+   both for RELA and REL type relocs, if only to serve as a learning tool.
 
    The RELOCATE_SECTION function is called by the new ELF backend linker
    to handle the relocations for a section.
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.45
diff -u -p -r1.45 elf32-m68k.c
--- bfd/elf32-m68k.c	7 Jul 2002 09:10:40 -0000	1.45
+++ bfd/elf32-m68k.c	23 Jul 2002 09:39:29 -0000
@@ -180,8 +180,6 @@ reloc_type_lookup (abfd, code)
 #define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup
 #define ELF_ARCH bfd_arch_m68k
 /* end code generated by elf.el */
-
-#define USE_RELA
 
 /* Functions for the m68k ELF linker.  */
 
Index: bfd/elf32-mcore.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mcore.c,v
retrieving revision 1.23
diff -u -p -r1.23 elf32-mcore.c
--- bfd/elf32-mcore.c	1 Jul 2002 08:06:44 -0000	1.23
+++ bfd/elf32-mcore.c	23 Jul 2002 09:39:29 -0000
@@ -29,8 +29,7 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "elf/mcore.h"
 #include <assert.h>
 
-#define	USE_RELA	/* Only USE_REL is actually significant, but this is
-			   here are a reminder...  */
+/* RELA relocs are used here...  */
 
 static void mcore_elf_howto_init
   PARAMS ((void));
Index: bfd/elf32-openrisc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-openrisc.c,v
retrieving revision 1.10
diff -u -p -r1.10 elf32-openrisc.c
--- bfd/elf32-openrisc.c	1 Jul 2002 08:06:44 -0000	1.10
+++ bfd/elf32-openrisc.c	23 Jul 2002 09:39:30 -0000
@@ -289,9 +289,6 @@ openrisc_final_link_relocate (howto, inp
 }
 
 /* Relocate an OpenRISC ELF section.
-   There is some attempt to make this function usable for many architectures,
-   both USE_REL and USE_RELA ['twould be nice if such a critter existed],
-   if only to serve as a learning tool.
 
    The RELOCATE_SECTION function is called by the new ELF backend linker
    to handle the relocations for a section.
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.48
diff -u -p -r1.48 elf32-ppc.c
--- bfd/elf32-ppc.c	1 Jul 2002 08:06:44 -0000	1.48
+++ bfd/elf32-ppc.c	23 Jul 2002 09:39:32 -0000
@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "elf-bfd.h"
 #include "elf/ppc.h"
 
-#define USE_RELA		/* we want RELA relocations, not REL */
+/* RELA relocations are used here.  */
 
 static reloc_howto_type *ppc_elf_reloc_type_lookup
   PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-s390.c,v
retrieving revision 1.28
diff -u -p -r1.28 elf32-s390.c
--- bfd/elf32-s390.c	11 Jul 2002 05:33:28 -0000	1.28
+++ bfd/elf32-s390.c	23 Jul 2002 09:39:34 -0000
@@ -71,8 +71,6 @@ static boolean elf_s390_finish_dynamic_s
 static boolean elf_s390_object_p PARAMS ((bfd *));
 static boolean elf_s390_grok_prstatus PARAMS ((bfd *, Elf_Internal_Note *));
 
-#define USE_RELA 1		/* We want RELA relocations, not REL.  */
-
 #include "elf/s390.h"
 
 /* The relocation "howto" table.  */
Index: bfd/elf32-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sparc.c,v
retrieving revision 1.40
diff -u -p -r1.40 elf32-sparc.c
--- bfd/elf32-sparc.c	11 Jul 2002 05:33:28 -0000	1.40
+++ bfd/elf32-sparc.c	23 Jul 2002 09:39:36 -0000
@@ -1117,6 +1117,9 @@ elf32_sparc_relocate_section (output_bfd
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
 
+  if (info->relocateable)
+    return true;
+
   dynobj = elf_hash_table (info)->dynobj;
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
@@ -1159,28 +1162,8 @@ elf32_sparc_relocate_section (output_bfd
 	}
       howto = _bfd_sparc_elf_howto_table + r_type;
 
-      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.  */
+      r_symndx = ELF32_R_SYM (rel->r_info);
       h = NULL;
       sym = NULL;
       sec = NULL;
@@ -2147,5 +2130,6 @@ elf32_sparc_reloc_type_class (rela)
 #define elf_backend_want_plt_sym 1
 #define elf_backend_got_header_size 4
 #define elf_backend_plt_header_size (4*PLT_ENTRY_SIZE)
+#define elf_backend_rela_normal 1
 
 #include "elf32-target.h"
Index: bfd/elf32-v850.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-v850.c,v
retrieving revision 1.23
diff -u -p -r1.23 elf32-v850.c
--- bfd/elf32-v850.c	1 Jul 2002 08:06:44 -0000	1.23
+++ bfd/elf32-v850.c	23 Jul 2002 09:39:38 -0000
@@ -1529,6 +1529,9 @@ v850_elf_relocate_section (output_bfd, i
   Elf_Internal_Rela *           rel;
   Elf_Internal_Rela *           relend;
 
+  if (info->relocateable)
+    return true;
+
   symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
 
@@ -1566,28 +1569,8 @@ v850_elf_relocate_section (output_bfd, i
           || r_type == R_V850_GNU_VTINHERIT)
         continue;
 
-      howto = v850_elf_howto_table + r_type;
-
-      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 = v850_elf_howto_table + r_type;
       h = NULL;
       sym = NULL;
       sec = NULL;
@@ -2208,6 +2191,7 @@ v850_elf_fake_sections (abfd, hdr, sec)
 #define elf_backend_gc_sweep_hook               v850_elf_gc_sweep_hook
 
 #define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
 
 #define bfd_elf32_bfd_is_local_label_name	v850_elf_is_local_label_name
 #define bfd_elf32_bfd_reloc_type_lookup		v850_elf_reloc_type_lookup
Index: bfd/elf32-vax.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-vax.c,v
retrieving revision 1.5
diff -u -p -r1.5 elf32-vax.c
--- bfd/elf32-vax.c	1 Jul 2002 16:43:36 -0000	1.5
+++ bfd/elf32-vax.c	23 Jul 2002 09:39:39 -0000
@@ -341,8 +341,6 @@ reloc_type_lookup (abfd, code)
 #define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup
 #define ELF_ARCH bfd_arch_vax
 /* end code generated by elf.el */
-
-#define USE_RELA
 
 /* Functions for the VAX ELF linker.  */
 
@@ -1419,6 +1417,9 @@ elf_vax_relocate_section (output_bfd, in
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
 
+  if (info->relocateable)
+    return true;
+
   dynobj = elf_hash_table (info)->dynobj;
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
@@ -1450,28 +1451,8 @@ elf_vax_relocate_section (output_bfd, in
 	}
       howto = howto_table + r_type;
 
-      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.  */
+      r_symndx = ELF32_R_SYM (rel->r_info);
       h = NULL;
       sym = NULL;
       sec = NULL;
@@ -2208,5 +2189,6 @@ elf_vax_finish_dynamic_sections (output_
 #define elf_backend_plt_readonly	1
 #define elf_backend_want_plt_sym	0
 #define elf_backend_got_header_size	16
+#define elf_backend_rela_normal		1
 
 #include "elf32-target.h"
Index: bfd/elf32-xstormy16.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xstormy16.c,v
retrieving revision 1.10
diff -u -p -r1.10 elf32-xstormy16.c
--- bfd/elf32-xstormy16.c	7 Jul 2002 09:10:40 -0000	1.10
+++ bfd/elf32-xstormy16.c	23 Jul 2002 09:39:40 -0000
@@ -709,9 +709,6 @@ xstormy16_elf_always_size_sections (outp
 }
 
 /* Relocate an XSTORMY16 ELF section.
-   There is some attempt to make this function usable for many architectures,
-   both USE_REL and USE_RELA ['twould be nice if such a critter existed],
-   if only to serve as a learning tool.
 
    The RELOCATE_SECTION function is called by the new ELF backend linker
    to handle the relocations for a section.
Index: bfd/elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.26
diff -u -p -r1.26 elf64-hppa.c
--- bfd/elf64-hppa.c	7 Jul 2002 09:10:40 -0000	1.26
+++ bfd/elf64-hppa.c	23 Jul 2002 09:39:42 -0000
@@ -2724,7 +2724,7 @@ const struct elf_size_info hppa64_elf_si
 #define elf_backend_fake_sections	elf_hppa_fake_sections
 #define elf_backend_add_symbol_hook	elf_hppa_add_symbol_hook
 
-#define elf_backend_relocate_section	    elf_hppa_relocate_section
+#define elf_backend_relocate_section	elf_hppa_relocate_section
 
 #define bfd_elf64_bfd_final_link	elf_hppa_final_link
 
@@ -2770,6 +2770,7 @@ const struct elf_size_info hppa64_elf_si
 #define elf_backend_type_change_ok true
 #define elf_backend_get_symbol_type	     elf64_hppa_elf_get_symbol_type
 #define elf_backend_reloc_type_class	     elf64_hppa_reloc_type_class
+#define elf_backend_rela_normal		     1
 
 #include "elf64-target.h"
 
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.59
diff -u -p -r1.59 elf64-ppc.c
--- bfd/elf64-ppc.c	11 Jul 2002 05:33:28 -0000	1.59
+++ bfd/elf64-ppc.c	23 Jul 2002 09:39:46 -0000
@@ -30,9 +30,6 @@ Foundation, Inc., 59 Temple Place - Suit
 #include "elf/ppc.h"
 #include "elf64-ppc.h"
 
-#define USE_RELA		/* we want RELA relocations, not REL.  */
-
-
 static void ppc_howto_init
   PARAMS ((void));
 static reloc_howto_type *ppc64_elf_reloc_type_lookup
Index: bfd/elf64-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-s390.c,v
retrieving revision 1.29
diff -u -p -r1.29 elf64-s390.c
--- bfd/elf64-s390.c	11 Jul 2002 05:33:28 -0000	1.29
+++ bfd/elf64-s390.c	23 Jul 2002 09:39:49 -0000
@@ -70,8 +70,6 @@ static boolean elf_s390_finish_dynamic_s
   PARAMS ((bfd *, struct bfd_link_info *));
 static boolean elf_s390_object_p PARAMS ((bfd *));
 
-#define USE_RELA 1		/* We want RELA relocations, not REL.  */
-
 #include "elf/s390.h"
 
 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
Index: bfd/elf64-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sparc.c,v
retrieving revision 1.58
diff -u -p -r1.58 elf64-sparc.c
--- bfd/elf64-sparc.c	11 Jul 2002 05:33:28 -0000	1.58
+++ bfd/elf64-sparc.c	23 Jul 2002 09:39:52 -0000
@@ -1919,6 +1919,9 @@ sparc64_elf_relocate_section (output_bfd
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
 
+  if (info->relocateable)
+    return true;
+
   dynobj = elf_hash_table (info)->dynobj;
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (input_bfd);
@@ -1954,28 +1957,8 @@ sparc64_elf_relocate_section (output_bfd
 	}
       howto = sparc64_elf_howto_table + r_type;
 
-      r_symndx = ELF64_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.  */
+      r_symndx = ELF64_R_SYM (rel->r_info);
       h = NULL;
       sym = NULL;
       sec = NULL;
@@ -3171,6 +3154,7 @@ const struct elf_size_info sparc64_elf_s
 #define elf_backend_want_got_plt 0
 #define elf_backend_plt_readonly 0
 #define elf_backend_want_plt_sym 1
+#define elf_backend_rela_normal 1
 
 /* Section 5.2.4 of the ABI specifies a 256-byte boundary for the table.  */
 #define elf_backend_plt_alignment 8
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.47
diff -u -p -r1.47 elf64-x86-64.c
--- bfd/elf64-x86-64.c	11 Jul 2002 05:33:28 -0000	1.47
+++ bfd/elf64-x86-64.c	23 Jul 2002 09:39:54 -0000
@@ -26,9 +26,6 @@ Foundation, Inc., 59 Temple Place - Suit
 
 #include "elf/x86-64.h"
 
-/* We use only the RELA entries.  */
-#define USE_RELA 1
-
 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value.  */
 #define MINUS_ONE (~ (bfd_vma) 0)
 
Index: bfd/elfarm-oabi.c
===================================================================
RCS file: /cvs/src/src/bfd/elfarm-oabi.c,v
retrieving revision 1.9
diff -u -p -r1.9 elfarm-oabi.c
--- bfd/elfarm-oabi.c	31 May 2002 02:28:53 -0000	1.9
+++ bfd/elfarm-oabi.c	23 Jul 2002 09:39:55 -0000
@@ -37,8 +37,6 @@
 #define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
 #endif
 
-#define USE_RELA
-
 #define TARGET_LITTLE_SYM               bfd_elf32_littlearm_oabi_vec
 #define TARGET_LITTLE_NAME              "elf32-littlearm-oabi"
 #define TARGET_BIG_SYM                  bfd_elf32_bigarm_oabi_vec
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.53
diff -u -p -r1.53 elfxx-ia64.c
--- bfd/elfxx-ia64.c	19 Jul 2002 01:10:28 -0000	1.53
+++ bfd/elfxx-ia64.c	23 Jul 2002 09:39:59 -0000
@@ -55,8 +55,6 @@ Foundation, Inc., 59 Temple Place - Suit
  *		does not reqire dynamic relocations.
  */
 
-#define USE_RELA		/* we want RELA relocs, not REL */
-
 #define NELEMS(a)	((int) (sizeof (a) / sizeof ((a)[0])))
 
 typedef struct bfd_hash_entry *(*new_hash_entry_func)


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