From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16790 invoked by alias); 12 May 2004 01:35:06 -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 16780 invoked from network); 12 May 2004 01:35:05 -0000 Received: from unknown (HELO modra.org) (144.136.180.129) by sourceware.org with SMTP; 12 May 2004 01:35:05 -0000 Received: by bubble.modra.org (Postfix, from userid 500) id EF29429B5D; Wed, 12 May 2004 11:05:03 +0930 (CST) Date: Wed, 12 May 2004 01:35:00 -0000 From: Alan Modra To: Alexandre Oliva Cc: DJ Delorie , binutils@sources.redhat.com Subject: Re: mn10300: relaxing vs section merging Message-ID: <20040512013503.GA3055@bubble.modra.org> Mail-Followup-To: Alexandre Oliva , DJ Delorie , binutils@sources.redhat.com References: <200405051818.i45IIicE005437@greed.delorie.com> <200405062032.i46KWb8g023860@greed.delorie.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-SW-Source: 2004-05/txt/msg00238.txt.bz2 On Tue, May 11, 2004 at 07:35:59PM -0300, Alexandre Oliva wrote: > On May 6, 2004, DJ Delorie wrote: > >> > You have to use section-relative relocs with section merging > > >> Why? > > > Because _bfd_elf_rela_local_sym() only adjusts STT_SECTION symbols. > > If you have other types of symbols, it doesn't seem to adjust the > > values properly. > > Hmm... Maybe it should be improved/fixed, then? I suppose whenever > we get called with a symbol, we should figure out in which section it > is, find the relocation for the section, and then apply the symbol > offset into the section again. Local symbols in SEC_MERGE sections are adjusted, but too late for you when doing relaxing. See elf_link_input_bfd. You can't do the adjustment until you know final section layout, because some symbols might end up pointing outside their section, or even outside their bfd. Of course, you can't make the final section layout until relaxing is complete.. I suppose it would be possible to move all the local sym adjustments into _bfd_elf_rel{,a}_local_sym. Note that _bfd_elf_rel_local_sym looks like it handles any local sym. Beware! _bfd_elf_rel_local_sym should be (and is currently) only called on section syms. -- Alan Modra IBM OzLabs - Linux Technology Centre