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

[patch] Output section checks for PPC SDAREL relocs (was: Re: Patch for ppc _SDA_BASE_ value)


Hi,

I have separated the recently discussed PPC relocations patch 
into independent portions. This is the first of the series.
It removes the bfd errors if the output section of the target
of R_PPC_SDAREL16 and R_PPC_EMB_SDA2REL relocations is not
one of .sdata, .sbss, .sdata2 or .sbss2. 

Regards,
-velco
2000-04-01  Momchil Velikov  <velco@fadata.bg>

	* elf32-ppc.c (ppc_elf_relocate_section): Do not fail with
	an error if the output section of the target of R_PPC_SDAREL16
	and R_PPC_EMB_SDA2REL relocations is not one of .sdata, .sbss,
	.sdata2 or .sbss2.  
--- elf32-ppc.c.orig.0	Sat Apr  1 14:33:00 2000
+++ elf32-ppc.c	Sat Apr  1 14:33:08 2000
@@ -3480,52 +3480,17 @@
 
 	/* relocate against _SDA_BASE_ */
 	case (int)R_PPC_SDAREL16:
-	  {
-	    const char *name;
-
-	    BFD_ASSERT (sec != (asection *)0);
-	    name = bfd_get_section_name (abfd, sec->output_section);
-	    if (strcmp (name, ".sdata") != 0
-		&& strcmp (name, ".sbss") != 0)
-	      {
-		(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
-				       bfd_get_filename (input_bfd),
-				       sym_name,
-				       ppc_elf_howto_table[ (int)r_type ]->name,
-				       name);
-	      }
-	    addend -= (sdata->sym_hash->root.u.def.value
-		       + sdata->sym_hash->root.u.def.section->output_section->vma
-		       + sdata->sym_hash->root.u.def.section->output_offset);
-	  }
+	  addend -= (sdata->sym_hash->root.u.def.value
+		     + sdata->sym_hash->root.u.def.section->output_section->vma
+		     + sdata->sym_hash->root.u.def.section->output_offset);
 	  break;
 
-
 	/* relocate against _SDA2_BASE_ */
 	case (int)R_PPC_EMB_SDA2REL:
-	  {
-	    const char *name;
-
-	    BFD_ASSERT (sec != (asection *)0);
-	    name = bfd_get_section_name (abfd, sec->output_section);
-	    if (strcmp (name, ".sdata2") != 0 && strcmp (name, ".sbss2") != 0)
-	      {
-		(*_bfd_error_handler) (_("%s: The target (%s) of a %s relocation is in the wrong output section (%s)"),
-				       bfd_get_filename (input_bfd),
-				       sym_name,
-				       ppc_elf_howto_table[ (int)r_type ]->name,
-				       name);
-		
-		bfd_set_error (bfd_error_bad_value);
-		ret = false;
-		continue;
-	      }
-	    addend -= (sdata2->sym_hash->root.u.def.value
-		       + sdata2->sym_hash->root.u.def.section->output_section->vma
-		       + sdata2->sym_hash->root.u.def.section->output_offset);
-	  }
+	  addend -= (sdata2->sym_hash->root.u.def.value
+		     + sdata2->sym_hash->root.u.def.section->output_section->vma
+		     + sdata2->sym_hash->root.u.def.section->output_offset);
 	  break;
-
 
 	/* relocate against either _SDA_BASE_, _SDA2_BASE_, or 0 */
 	case (int)R_PPC_EMB_SDA21:

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