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]

Re: PATCH: Fix alpha relocation overflow (Re: PATCH: Add _bfd_elf_provide_symbol)


On Tue, Apr 26, 2005 at 06:46:59AM -0700, H. J. Lu wrote:
> On Tue, Apr 26, 2005 at 02:01:43PM +0200, Michael Matz wrote:
> > Hi,
> > 
> > On Mon, 25 Apr 2005, H. J. Lu wrote:
> > 
> > > > How about this patch?
> > > 
> > > Wrong patch. This is the updated one.
> > 
> > Fixes the problem for me.  Btw. why did you chose the first non-code alloc 
> > section for this (I'm just curious)?  This will be .interp in practice 
> > most often.
> > 
> 
> I just happen to pick it. I have no preference.
> 
> 

I am going to check in this patch to fix alpha as an obvious fix by
the end of the day.


H.J.
----
2005-04-27  H.J. Lu  <hongjiu.lu@intel.com>

	* emultempl/elf32.em (gld${EMULATION_NAME}_provide_bound_symbols):
	Use the first SEC_ALLOC section which isn't SEC_READONLY or the
	last SEC_ALLOC section if such a section doesn't exist.

--- ld/emultempl/elf32.em.provide	2005-04-11 09:10:51.000000000 -0700
+++ ld/emultempl/elf32.em	2005-04-27 11:15:15.000000000 -0700
@@ -1457,8 +1457,21 @@ gld${EMULATION_NAME}_provide_bound_symbo
     }
   else
     {
+      /* We have to choose those values very carefully.  Some targets,
+	 like alpha, may have relocation overflow with 0.  We use the
+	 first SEC_ALLOC section which isn't SEC_READONLY or the last
+	 SEC_ALLOC section.   */
       start_val = 0;
-      end_val = 0;
+      for (s = output_bfd->sections; s != NULL; s = s->next)
+	{
+	  if ((s->flags & SEC_ALLOC) != 0)
+	    {
+	      start_val = s->vma;
+	      if ((s->flags & SEC_READONLY) == 0)
+		break;
+	    }
+	}
+      end_val = start_val;
     }
   _bfd_elf_provide_symbol (&link_info, start, start_val);
   _bfd_elf_provide_symbol (&link_info, end, end_val);


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