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]

[PATCH]


Hi!

The following patch does 2 things:
1) fixes ld segfault if for some reason (such as relocations against
   SHF_MERGE section) as SEC_MERGE section wasn't successfully merged
2) in preparation of .eh_frame optimizations I'm working on, this patch
   replaces all calls to _bfd_stab_section_offset with
   _bfd_elf_section_offset, so that in order to adjust reloc offsets
   for non-.stab sections all elf backends don't have to be changed again
   and again
Bootstrapped with --enable-targets-all --enable-bfd-64-bit, regression
tested. Ok to commit?

2001-12-05  Jakub Jelinek  <jakub@redhat.com>

	* elf.c (_bfd_elf_rela_local_sym): Only call
	_bfd_merged_section_offset if merge_info is non-NULL.
	(_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New.
	* elf-bfd.h (_bfd_elf_rel_local_sym, _bfd_elf_section_offset): New
	prototypes.
	* elf32-arm.h (elf32_arm_final_link_relocate): Use
	_bfd_elf_section_offset.
	(elf32_arm_relocate_section): Use _bfd_elf_rel_local_sym.
	* elf32-i386.c (elf_i386_relocate_section): Use
	_bfd_elf_section_offset and _bfd_elf_rel_local_sym.
	* elf32-sh.c (sh_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_relocate_section): Use
	_bfd_elf_section_offset.
	* elf32-cris.c (cris_elf_relocate_section): Likewise.
	* elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
	* elf32-i370.c (i370_elf_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-mips.c (mips_elf_create_dynamic_relocation): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-s390.c (elf_s390_relocate_section): Likewise.
	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
	* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
	* elf64-s390.c (elf_s390_relocate_section): Likewise.
	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
	* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
	* elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.

--- bfd/elf.c.jj	Wed Dec  5 14:42:28 2001
+++ bfd/elf.c	Wed Dec  5 15:25:55 2001
@@ -6393,7 +6393,8 @@ _bfd_elf_rela_local_sym (abfd, sym, sec,
 		+ sec->output_offset
 		+ sym->st_value);
   if ((sec->flags & SEC_MERGE)
-      && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+      && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+      && elf_section_data (sec)->merge_info)
     {
       asection *msec;
 
@@ -6408,3 +6409,37 @@ _bfd_elf_rela_local_sym (abfd, sym, sec,
     }
   return relocation;
 }
+
+bfd_vma
+_bfd_elf_rel_local_sym (abfd, sym, psec, addend)
+     bfd *abfd;
+     Elf_Internal_Sym *sym;
+     asection **psec;
+     bfd_vma addend;
+{     
+  asection *sec = *psec;
+
+  if (elf_section_data (sec)->merge_info == NULL)
+    return sym->st_value + addend;
+
+  return _bfd_merged_section_offset (abfd, psec,
+				     elf_section_data (sec)->merge_info,
+				     sym->st_value + addend, (bfd_vma) 0);
+}
+
+bfd_vma
+_bfd_elf_section_offset (abfd, info, sec, offset)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     asection *sec;
+     bfd_vma offset;
+{
+  struct bfd_elf_section_data *sec_data;
+
+  sec_data = elf_section_data (sec);
+  if (sec_data->stab_info != NULL)
+    return _bfd_stab_section_offset
+	   (abfd, &elf_hash_table (info)->stab_info,
+	    sec, &sec_data->stab_info, offset);
+  return offset;
+}
--- bfd/elf-bfd.h.jj	Fri Nov 23 14:26:41 2001
+++ bfd/elf-bfd.h	Wed Dec  5 15:01:37 2001
@@ -1142,6 +1142,10 @@ extern enum elf_reloc_type_class _bfd_el
   PARAMS ((const Elf_Internal_Rela *));
 extern bfd_vma _bfd_elf_rela_local_sym
   PARAMS ((bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *));
+extern bfd_vma _bfd_elf_rel_local_sym
+  PARAMS ((bfd *, Elf_Internal_Sym *, asection **, bfd_vma));
+extern bfd_vma _bfd_elf_section_offset
+  PARAMS ((bfd *, struct bfd_link_info *, asection *, bfd_vma));
 
 extern unsigned long bfd_elf_hash
   PARAMS ((const char *));
--- bfd/elf32-arm.h.jj	Fri Nov 23 14:26:42 2001
+++ bfd/elf32-arm.h	Wed Dec  5 15:01:37 2001
@@ -1149,22 +1149,11 @@ elf32_arm_final_link_relocate (howto, in
 
 	  skip = false;
 
-	  if (elf_section_data (input_section)->stab_info == NULL)
-	    outrel.r_offset = rel->r_offset;
-	  else
-	    {
-	      bfd_vma off;
-
-	      off = (_bfd_stab_section_offset
-		     (output_bfd, &elf_hash_table (info)->stab_info,
-		      input_section,
-		      & elf_section_data (input_section)->stab_info,
-		      rel->r_offset));
-	      if (off == (bfd_vma) -1)
-		skip = true;
-	      outrel.r_offset = off;
-	    }
-
+	  outrel.r_offset =
+	    _bfd_elf_section_offset (output_bfd, info, input_section,
+				     rel->r_offset);
+	  if (outrel.r_offset == (bfd_vma) -1)
+	    skip = true;
 	  outrel.r_offset += (input_section->output_section->vma
 			      + input_section->output_offset);
 
@@ -1892,9 +1881,7 @@ elf32_arm_relocate_section (output_bfd, 
 		}
 	      msec = sec;
 	      addend =
-		_bfd_merged_section_offset (output_bfd, &msec,
-					    elf_section_data (sec)->merge_info,
-					    sym->st_value + addend, (bfd_vma) 0)
+		_bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend)
 		- relocation;
 	      addend += msec->output_section->vma + msec->output_offset;
 	      value = (value & ~ howto->dst_mask) | (addend & howto->dst_mask);
--- bfd/elf32-i386.c.jj	Fri Nov 23 14:26:41 2001
+++ bfd/elf32-i386.c	Wed Dec  5 15:01:37 2001
@@ -1789,9 +1789,7 @@ elf_i386_relocate_section (output_bfd, i
 	      addend = bfd_get_32 (input_bfd, contents + rel->r_offset);
 	      msec = sec;
 	      addend =
-		_bfd_merged_section_offset (output_bfd, &msec,
-					    elf_section_data (sec)->merge_info,
-					    sym->st_value + addend, (bfd_vma) 0)
+		_bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend)
 		- relocation;
 	      addend += msec->output_section->vma + msec->output_offset;
 	      bfd_put_32 (input_bfd, addend, contents + rel->r_offset);
@@ -2009,19 +2007,11 @@ elf_i386_relocate_section (output_bfd, i
 
 	      skip = false;
 
-	      if (elf_section_data (input_section)->stab_info == NULL)
-		outrel.r_offset = rel->r_offset;
-	      else
-		{
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, htab->elf.stab_info, input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  rel->r_offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
-
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
 
--- bfd/elf32-sh.c.jj	Fri Nov 23 14:26:41 2001
+++ bfd/elf32-sh.c	Wed Dec  5 15:01:37 2001
@@ -3101,9 +3101,7 @@ sh_elf_relocate_section (output_bfd, inf
               addend = bfd_get_32 (input_bfd, contents + rel->r_offset);
               msec = sec;
               addend =
-		_bfd_merged_section_offset (output_bfd, &msec,
-					    elf_section_data (sec)->merge_info,
-					    sym->st_value + addend, (bfd_vma) 0)
+		_bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend)
 		- relocation;
 	      addend += msec->output_section->vma + msec->output_offset;
 	      bfd_put_32 (input_bfd, addend, contents + rel->r_offset);
@@ -3284,22 +3282,11 @@ sh_elf_relocate_section (output_bfd, inf
 
 	      skip = false;
 
-	      if (elf_section_data (input_section)->stab_info == NULL)
-		outrel.r_offset = rel->r_offset;
-	      else
-		{
-		  bfd_vma off;
-
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, &elf_hash_table (info)->stab_info,
-			  input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  rel->r_offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
-
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
 
--- bfd/elf32-sparc.c.jj	Fri Nov 23 15:02:37 2001
+++ bfd/elf32-sparc.c	Wed Dec  5 15:01:37 2001
@@ -1448,22 +1448,11 @@ elf32_sparc_relocate_section (output_bfd
 
 	      skip = false;
 
-	      if (elf_section_data (input_section)->stab_info == NULL)
-		outrel.r_offset = rel->r_offset;
-	      else
-		{
-		  bfd_vma off;
-
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, &elf_hash_table (info)->stab_info,
-			  input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  rel->r_offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
-
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
 
--- bfd/elf32-cris.c.jj	Fri Nov 23 14:26:41 2001
+++ bfd/elf32-cris.c	Wed Dec  5 15:01:37 2001
@@ -1283,22 +1283,11 @@ cris_elf_relocate_section (output_bfd, i
 
 	      skip = false;
 
-	      if (elf_section_data (input_section)->stab_info == NULL)
-		outrel.r_offset = rel->r_offset;
-	      else
-		{
-		  bfd_vma off;
-
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, &elf_hash_table (info)->stab_info,
-			  input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  rel->r_offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
-
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
 
--- bfd/elf32-hppa.c.jj	Wed Dec  5 14:42:28 2001
+++ bfd/elf32-hppa.c	Wed Dec  5 15:01:37 2001
@@ -3949,23 +3949,11 @@ elf32_hppa_relocate_section (output_bfd,
 		 are copied into the output file to be resolved at run
 		 time.  */
 
-	      outrel.r_offset = rel->r_offset;
 	      outrel.r_addend = rel->r_addend;
-	      skip = false;
-	      if (elf_section_data (input_section)->stab_info != NULL)
-		{
-		  bfd_vma off;
-
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, &htab->elf.stab_info,
-			  input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  rel->r_offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
-
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      skip = (outrel.r_offset == (bfd_vma) -1);
 	      outrel.r_offset += (input_section->output_offset
 				  + input_section->output_section->vma);
 
--- bfd/elf32-i370.c.jj	Fri Nov 23 14:26:41 2001
+++ bfd/elf32-i370.c	Wed Dec  5 15:01:37 2001
@@ -1486,22 +1486,11 @@ i370_elf_relocate_section (output_bfd, i
 
 	      skip = false;
 
-	      if (elf_section_data (input_section)->stab_info == NULL)
-		outrel.r_offset = rel->r_offset;
-	      else
-		{
-		  bfd_vma off;
-
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, &elf_hash_table (info)->stab_info,
-			  input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  rel->r_offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
-
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
 
--- bfd/elf32-m68k.c.jj	Fri Nov 23 14:26:41 2001
+++ bfd/elf32-m68k.c	Wed Dec  5 15:01:37 2001
@@ -1680,22 +1680,11 @@ elf_m68k_relocate_section (output_bfd, i
 
 	      skip = false;
 
-	      if (elf_section_data (input_section)->stab_info == NULL)
-		outrel.r_offset = rel->r_offset;
-	      else
-		{
-		  bfd_vma off;
-
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, &elf_hash_table (info)->stab_info,
-			  input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  rel->r_offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
-
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
 
--- bfd/elf32-mips.c.jj	Wed Dec  5 14:42:28 2001
+++ bfd/elf32-mips.c	Wed Dec  5 15:01:37 2001
@@ -6358,29 +6358,10 @@ mips_elf_create_dynamic_relocation (outp
 	      < sreloc->_raw_size);
 
   skip = false;
-
-  /* We begin by assuming that the offset for the dynamic relocation
-     is the same as for the original relocation.  We'll adjust this
-     later to reflect the correct output offsets.  */
-  if (elf_section_data (input_section)->stab_info == NULL)
-    outrel.r_offset = rel->r_offset;
-  else
-    {
-      /* Except that in a stab section things are more complex.
-	 Because we compress stab information, the offset given in the
-	 relocation may not be the one we want; we must let the stabs
-	 machinery tell us the offset.  */
-      outrel.r_offset
-	= (_bfd_stab_section_offset
-	   (output_bfd, &elf_hash_table (info)->stab_info,
-	    input_section,
-	    &elf_section_data (input_section)->stab_info,
-	    rel->r_offset));
-      /* If we didn't need the relocation at all, this value will be
-	 -1.  */
-      if (outrel.r_offset == (bfd_vma) -1)
-	skip = true;
-    }
+  outrel.r_offset =
+    _bfd_elf_section_offset (output_bfd, info, input_section, rel->r_offset);
+  if (outrel.r_offset == (bfd_vma) -1)
+    skip = true;
 
   /* If we've decided to skip this relocation, just output an empty
      record.  Note that R_MIPS_NONE == 0, so that this call to memset
--- bfd/elf32-ppc.c.jj	Fri Nov 23 14:26:41 2001
+++ bfd/elf32-ppc.c	Wed Dec  5 15:01:37 2001
@@ -3210,22 +3210,11 @@ ppc_elf_relocate_section (output_bfd, in
 
 	      skip = false;
 
-	      if (elf_section_data (input_section)->stab_info == NULL)
-		outrel.r_offset = rel->r_offset;
-	      else
-		{
-		  bfd_vma off;
-
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, &elf_hash_table (info)->stab_info,
-			  input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  rel->r_offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
-
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
 
--- bfd/elf32-s390.c.jj	Fri Nov 23 14:26:41 2001
+++ bfd/elf32-s390.c	Wed Dec  5 15:01:37 2001
@@ -1891,19 +1891,11 @@ elf_s390_relocate_section (output_bfd, i
 
               skip = false;
 
-              if (elf_section_data (input_section)->stab_info == NULL)
-                outrel.r_offset = rel->r_offset;
-              else
-                {
-                  off = (_bfd_stab_section_offset
-                         (output_bfd, htab->elf.stab_info, input_section,
-                          &elf_section_data (input_section)->stab_info,
-                          rel->r_offset));
-                  if (off == (bfd_vma) -1)
-                    skip = true;
-                  outrel.r_offset = off;
-                }
-
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
               outrel.r_offset += (input_section->output_section->vma
                                   + input_section->output_offset);
 
--- bfd/elf64-alpha.c.jj	Wed Nov 28 21:24:58 2001
+++ bfd/elf64-alpha.c	Wed Dec  5 15:01:37 2001
@@ -3534,7 +3534,6 @@ elf64_alpha_relocate_section (output_bfd
 	case R_ALPHA_REFQUAD:
 	  {
 	    Elf_Internal_Rela outrel;
-	    boolean skip;
 
 	    /* Careful here to remember RELATIVE relocations for global
 	       variables for symbolic shared objects.  */
@@ -3569,25 +3568,10 @@ elf64_alpha_relocate_section (output_bfd
 		BFD_ASSERT(srel != NULL);
 	      }
 
-	    skip = false;
-
-	    if (elf_section_data (input_section)->stab_info == NULL)
-	      outrel.r_offset = rel->r_offset;
-	    else
-	      {
-		bfd_vma off;
-
-		off = (_bfd_stab_section_offset
-		       (output_bfd, &elf_hash_table (info)->stab_info,
-			input_section,
-			&elf_section_data (input_section)->stab_info,
-			rel->r_offset));
-		if (off == (bfd_vma) -1)
-		  skip = true;
-		outrel.r_offset = off;
-	      }
-
-	    if (! skip)
+	    outrel.r_offset =
+	      _bfd_elf_section_offset (output_bfd, info, input_section,
+				       rel->r_offset);
+	    if (outrel.r_offset != (bfd_vma) -1)
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
 	    else
--- bfd/elf64-ppc.c.jj	Fri Nov 23 14:26:42 2001
+++ bfd/elf64-ppc.c	Wed Dec  5 15:01:37 2001
@@ -3494,20 +3494,11 @@ ppc64_elf_relocate_section (output_bfd, 
 
 	      skip = false;
 
-	      if (elf_section_data (input_section)->stab_info == NULL)
-		outrel.r_offset = offset;
-	      else
-		{
-		  bfd_vma off;
-
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, htab->elf.stab_info, input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
--- bfd/elf64-s390.c.jj	Fri Nov 23 14:26:42 2001
+++ bfd/elf64-s390.c	Wed Dec  5 15:01:37 2001
@@ -1891,18 +1891,11 @@ elf_s390_relocate_section (output_bfd, i
 
               skip = false;
 
-              if (elf_section_data (input_section)->stab_info == NULL)
-                outrel.r_offset = rel->r_offset;
-              else
-                {
-                  off = (_bfd_stab_section_offset
-                         (output_bfd, htab->elf.stab_info, input_section,
-                          &elf_section_data (input_section)->stab_info,
-                          rel->r_offset));
-                  if (off == (bfd_vma) -1)
-                    skip = true;
-                  outrel.r_offset = off;
-                }
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rel->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 
               outrel.r_offset += (input_section->output_section->vma
                                   + input_section->output_offset);
--- bfd/elf64-sparc.c.jj	Fri Nov 23 15:06:45 2001
+++ bfd/elf64-sparc.c	Wed Dec  5 15:01:37 2001
@@ -2184,21 +2184,11 @@ sparc64_elf_relocate_section (output_bfd
 
 		skip = false;
 
-		if (elf_section_data (input_section)->stab_info == NULL)
-		  outrel.r_offset = rel->r_offset;
-		else
-		  {
-		    bfd_vma off;
-
-		    off = (_bfd_stab_section_offset
-			   (output_bfd, &elf_hash_table (info)->stab_info,
-			    input_section,
-			    &elf_section_data (input_section)->stab_info,
-			    rel->r_offset));
-		    if (off == MINUS_ONE)
-		      skip = true;
-		    outrel.r_offset = off;
-		  }
+		outrel.r_offset =
+		  _bfd_elf_section_offset (output_bfd, info, input_section,
+					   rel->r_offset);
+		if (outrel.r_offset == (bfd_vma) -1)
+		  skip = true;
 
 		outrel.r_offset += (input_section->output_section->vma
 				    + input_section->output_offset);
--- bfd/elf64-x86-64.c.jj	Fri Nov 23 14:26:42 2001
+++ bfd/elf64-x86-64.c	Wed Dec  5 15:01:37 2001
@@ -1473,21 +1473,11 @@ elf64_x86_64_relocate_section (output_bf
 
 	      skip = false;
 
-	      if (elf_section_data (input_section)->stab_info == NULL)
-		outrel.r_offset = rela->r_offset;
-	      else
-		{
-		  bfd_vma off;
-
-		  off = (_bfd_stab_section_offset
-			 (output_bfd, &elf_hash_table (info)->stab_info,
-			  input_section,
-			  &elf_section_data (input_section)->stab_info,
-			  rela->r_offset));
-		  if (off == (bfd_vma) -1)
-		    skip = true;
-		  outrel.r_offset = off;
-		}
+	      outrel.r_offset =
+		_bfd_elf_section_offset (output_bfd, info, input_section,
+					 rela->r_offset);
+	      if (outrel.r_offset == (bfd_vma) -1)
+		skip = true;
 
 	      outrel.r_offset += (input_section->output_section->vma
 				  + input_section->output_offset);
--- bfd/elfxx-ia64.c.jj	Wed Nov 28 21:24:59 2001
+++ bfd/elfxx-ia64.c	Wed Dec  5 15:01:38 2001
@@ -3014,33 +3014,19 @@ elfNN_ia64_install_dyn_reloc (abfd, info
 {
   Elf_Internal_Rela outrel;
 
-  outrel.r_offset = (sec->output_section->vma
-		     + sec->output_offset
-		     + offset);
+  offset += sec->output_section->vma + sec->output_offset;
 
   BFD_ASSERT (dynindx != -1);
   outrel.r_info = ELFNN_R_INFO (dynindx, type);
   outrel.r_addend = addend;
-
-  if (elf_section_data (sec)->stab_info != NULL)
+  outrel.r_offset = _bfd_elf_section_offset (abfd, info, sec, offset);
+  if (outrel.r_offset == (bfd_vma) -1)
     {
-      /* This may be NULL for linker-generated relocations, as it is
-	 inconvenient to pass all the bits around.  And this shouldn't
-	 happen.  */
-      BFD_ASSERT (info != NULL);
-
-      offset = (_bfd_stab_section_offset
-		(abfd, &elf_hash_table (info)->stab_info, sec,
-		 &elf_section_data (sec)->stab_info, offset));
-      if (offset == (bfd_vma) -1)
-	{
-	  /* Run for the hills.  We shouldn't be outputting a relocation
-	     for this.  So do what everyone else does and output a no-op.  */
-	  outrel.r_info = ELFNN_R_INFO (0, R_IA64_NONE);
-	  outrel.r_addend = 0;
-	  offset = 0;
-	}
-      outrel.r_offset = offset;
+      /* Run for the hills.  We shouldn't be outputting a relocation
+	 for this.  So do what everyone else does and output a no-op.  */
+      outrel.r_info = ELFNN_R_INFO (0, R_IA64_NONE);
+      outrel.r_addend = 0;
+      outrel.r_offset = 0;
     }
 
   bfd_elfNN_swap_reloca_out (abfd, &outrel,

	Jakub


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