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 Wed, Apr 27, 2005 at 11:18:40AM -0700, H. J. Lu wrote:
> --- 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;

I think this is a rather horrible hack.  Can't you do this some way that
avoids the potentially slow section list traversal?  How about defining
__init_fini_array in the linker script, and using its value instead?
(Default to zero if __init_fini_array isn't defined.)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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