From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23131 invoked by alias); 27 Apr 2005 18:18:49 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 23024 invoked from network); 27 Apr 2005 18:18:42 -0000 Received: from unknown (HELO rwcrmhc13.comcast.net) (204.127.198.39) by sourceware.org with SMTP; 27 Apr 2005 18:18:42 -0000 Received: from lucon.org ([24.6.212.230]) by comcast.net (rwcrmhc13) with ESMTP id <20050427181841015004mjqae>; Wed, 27 Apr 2005 18:18:41 +0000 Received: by lucon.org (Postfix, from userid 1000) id 1675463E85; Wed, 27 Apr 2005 11:18:41 -0700 (PDT) Date: Wed, 27 Apr 2005 19:35:00 -0000 From: "H. J. Lu" To: Michael Matz Cc: binutils@sources.redhat.com Subject: Re: PATCH: Fix alpha relocation overflow (Re: PATCH: Add _bfd_elf_provide_symbol) Message-ID: <20050427181840.GA12815@lucon.org> References: <20050323020457.GM30711@bubble.modra.org> <20050323021109.GA19226@nevyn.them.org> <20050323041924.GA11208@lucon.org> <20050425145458.GA32362@lucon.org> <20050425172736.GA2235@lucon.org> <20050425174359.GA2592@lucon.org> <20050426134659.GB20029@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050426134659.GB20029@lucon.org> User-Agent: Mutt/1.4.1i X-SW-Source: 2005-04/txt/msg00825.txt.bz2 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 * 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);