PATCH: BZ/175: Fix dynamic string offset

H. J. Lu hjl@lucon.org
Fri May 28 17:48:00 GMT 2004


On Tue, May 25, 2004 at 06:09:38PM -0700, H. J. Lu wrote:
> On Sat, May 22, 2004 at 11:27:22AM +0930, Alan Modra wrote:
> > 
> > I doubt this patch is complete.  If you need to special case certain
> > accesses in relax_section, how is it that relocate_section escapes a
> > need for the same special case code?  This might prove more difficult,
> > as you might need to pull apart _bfd_elf_rela_local_sym.  I'm also still
> > concerned that other ia64 code sequences might use R_IA64_LTOFF22X in a
> > way that requires you include the addend.  Please discuss this with Jim,
> > I'm not familiar enough with ia64 to know.
> > 
> 
> elfNN_ia64_relax_section shouldn't calls _bfd_merged_section_offset just
> because tsec->sec_info_type == ELF_INFO_TYPE_MERGE. For local symbols,
> it should also check
> 
> (tsec->flags & SEC_MERGE) && ELF_ST_TYPE (isym->st_info) == STT_SECTION
> 
> 

Here is the updated one.


H.J.
-------------- next part --------------
2004-05-25  H.J. Lu  <hongjiu.lu@intel.com>

	* elfxx-ia64.c (elfNN_ia64_relax_section): Properly call
	_bfd_merged_section_offset for local symbols.

--- bfd/elfxx-ia64.c.merge	2004-05-25 22:48:33.723688700 -0700
+++ bfd/elfxx-ia64.c	2004-05-25 22:49:50.039794972 -0700
@@ -874,6 +874,15 @@ elfNN_ia64_relax_section (abfd, sec, lin
 
 	  toff = isym->st_value;
 	  dyn_i = get_dyn_sym_info (ia64_info, NULL, abfd, irel, FALSE);
+	  
+	  if ((tsec->flags & SEC_MERGE)
+	      && ELF_ST_TYPE (isym->st_info) == STT_SECTION
+	      && tsec->sec_info_type == ELF_INFO_TYPE_MERGE)
+	    toff = _bfd_merged_section_offset (abfd, &tsec,
+					       elf_section_data (tsec)->sec_info,
+					       toff + irel->r_addend);
+	  else
+	    toff += irel->r_addend;
 	}
       else
 	{
@@ -918,14 +927,14 @@ elfNN_ia64_relax_section (abfd, sec, lin
 	      tsec = h->root.u.def.section;
 	      toff = h->root.u.def.value;
 	    }
-	}
 
-      if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE)
-	toff = _bfd_merged_section_offset (abfd, &tsec,
-					   elf_section_data (tsec)->sec_info,
-					   toff + irel->r_addend);
-      else
-	toff += irel->r_addend;
+	  if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE)
+	    toff = _bfd_merged_section_offset (abfd, &tsec,
+					       elf_section_data (tsec)->sec_info,
+					       toff + irel->r_addend);
+	  else
+	    toff += irel->r_addend;
+	}
 
       symaddr = tsec->output_section->vma + tsec->output_offset + toff;
 


More information about the Binutils mailing list