This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Fix alpha relocation overflow (Re: PATCH: Add _bfd_elf_provide_symbol)
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: Michael Matz <matz at suse dot de>, binutils at sources dot redhat dot com
- Date: Tue, 3 May 2005 10:57:16 +0930
- Subject: Re: PATCH: Fix alpha relocation overflow (Re: PATCH: Add _bfd_elf_provide_symbol)
- References: <20050323021109.GA19226@nevyn.them.org> <20050323041924.GA11208@lucon.org> <Pine.LNX.4.58.0504250625140.20714@wotan.suse.de> <20050425145458.GA32362@lucon.org> <Pine.LNX.4.58.0504251703020.20714@wotan.suse.de> <20050425172736.GA2235@lucon.org> <20050425174359.GA2592@lucon.org> <Pine.LNX.4.58.0504261359040.20714@wotan.suse.de> <20050426134659.GB20029@lucon.org> <20050427181840.GA12815@lucon.org>
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