PATCH: Fix alpha relocation overflow (Re: PATCH: Add _bfd_elf_provide_symbol)
H. J. Lu
hjl@lucon.org
Tue May 3 01:35:00 GMT 2005
On Tue, May 03, 2005 at 10:57:16AM +0930, Alan Modra wrote:
> 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.)
That function is used to avoid __init_fini_array in the linker script.
I think alpha may even work with the first SEC_ALLOC section, which
will be very likely among the first few sections.
H.J.
More information about the Binutils
mailing list