From patchwork Tue Jan 10 17:38:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 135267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E4CBDB6FC9 for ; Wed, 11 Jan 2012 04:38:36 +1100 (EST) Received: from localhost ([::1]:57303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkfeY-0008VH-Lq for incoming@patchwork.ozlabs.org; Tue, 10 Jan 2012 12:38:30 -0500 Received: from eggs.gnu.org ([140.186.70.92]:57681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkfeS-0008V7-PB for qemu-devel@nongnu.org; Tue, 10 Jan 2012 12:38:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkfeM-00048c-TS for qemu-devel@nongnu.org; Tue, 10 Jan 2012 12:38:24 -0500 Received: from hall.aurel32.net ([88.191.126.93]:41768) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkfeM-00048R-Na for qemu-devel@nongnu.org; Tue, 10 Jan 2012 12:38:18 -0500 Received: from [2001:470:d4ed:0:5e26:aff:fe2b:6f5b] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1RkfeL-0004O4-K2; Tue, 10 Jan 2012 18:38:17 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.77) (envelope-from ) id 1RkfeK-0006Gg-Jr; Tue, 10 Jan 2012 18:38:16 +0100 Date: Tue, 10 Jan 2012 18:38:16 +0100 From: Aurelien Jarno To: Blue Swirl Message-ID: <20120110173816.GB6244@volta.aurel32.net> References: <1325967416-1760-1-git-send-email-aurelien@aurel32.net> <20120107210108.GC20942@hall.aurel32.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120107210108.GC20942@hall.aurel32.net> X-Mailer: Mutt 1.5.21 (2010-09-15) User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 88.191.126.93 Cc: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH] sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Sat, Jan 07, 2012 at 10:01:09PM +0100, Aurelien Jarno wrote: > On Sat, Jan 07, 2012 at 08:36:12PM +0000, Blue Swirl wrote: > > On Sat, Jan 7, 2012 at 20:16, Aurelien Jarno wrote: > > > Fix .rel.plt sections in the output to not only include .rel.plt > > > sections from the input but also the .rel.iplt sections and to define > > > the hidden symbols __rel_iplt_start and __rel_iplt_end around > > > .rel.iplt as otherwise we get undefined references to these when > > > linking statically to a multiarch enabled libc (using STT_GNU_IFUNC). > > > > > > Blue Swirl > > > Signed-off-by: Aurelien Jarno > > > --- > > >  sparc.ld |   16 ++++++++++++++-- > > >  1 files changed, 14 insertions(+), 2 deletions(-) > > > > > > diff --git a/sparc.ld b/sparc.ld > > > index 56efe34..e52c3d2 100644 > > > --- a/sparc.ld > > > +++ b/sparc.ld > > > @@ -37,8 +37,20 @@ SECTIONS > > >   .rela.fini     : { *(.rela.fini)      } > > >   .rel.bss       : { *(.rel.bss)                } > > >   .rela.bss      : { *(.rela.bss)               } > > > -  .rel.plt       : { *(.rel.plt)                } > > > -  .rela.plt      : { *(.rela.plt)               } > > > +  .rel.plt      : > > > +  { > > > +    *(.rel.plt) > > > +    PROVIDE_HIDDEN (__rel_iplt_start = .); > > > +    *(.rel.iplt) > > > +    PROVIDE_HIDDEN (__rel_iplt_end = .); > > > +  } > > > +  .rela.plt       : > > > +  { > > > +    *(.rela.plt) > > > +    PROVIDE_HIDDEN (__rela_iplt_start = .); > > > +    *(.rela.iplt) > > > +    PROVIDE_HIDDEN (__rela_iplt_end = .); > > > +  } > > > > PROVIDE_HIDDEN etc. were removed by > > 8733f6093c2b77502e7228503fc22024e51599b8 in order to support BSDs with > > older binutils (2.15). Maybe the ld scripts should be generated from a > > source file for example with CPP, so these lines could be tweaked. > > > > It seems this patch was in my local tree for too long, and it seems I > should have updated it before sending it... > > Other architectures are now using PROVIDE instead of PROVIDE_HIDDEN for > __rel{a,}_iplt_{start,end}, so I guess the same can be done for sparc and > ppc. I am going to do a test build to check that, and I'll come with a > new patch if it works. The new patch below also fixes the issue, and uses PROVIDE instead of PROVIDE_HIDDEN. sparc-linux-user: Fix missing symbols in .rel/.rela.plt sections Fix .rel.plt sections in the output to not only include .rel.plt sections from the input but also the .rel.iplt sections and to define the hidden symbols __rel_iplt_start and __rel_iplt_end around .rel.iplt as otherwise we get undefined references to these when linking statically to a multiarch enabled libc (using STT_GNU_IFUNC). Cc: Blue Swirl Signed-off-by: Aurelien Jarno --- sparc.ld | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sparc.ld b/sparc.ld index 56efe34..cec17c9 100644 --- a/sparc.ld +++ b/sparc.ld @@ -37,8 +37,20 @@ SECTIONS .rela.fini : { *(.rela.fini) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } + .rel.plt : + { + *(.rel.plt) + PROVIDE (__rel_iplt_start = .); + *(.rel.iplt) + PROVIDE (__rel_iplt_end = .); + } + .rela.plt : + { + *(.rela.plt) + PROVIDE (__rela_iplt_start = .); + *(.rela.iplt) + PROVIDE (__rela_iplt_end = .); + } .init : { *(.init) } =0x47ff041f .text : {