From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 658 invoked by alias); 18 Feb 2011 08:49:41 -0000 Received: (qmail 536 invoked by uid 22791); 18 Feb 2011 08:49:40 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from vpn.id2.novell.com (HELO vpn.id2.novell.com) (195.33.99.129) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Feb 2011 08:49:38 +0000 Received: from EMEA1-MTA by vpn.id2.novell.com with Novell_GroupWise; Fri, 18 Feb 2011 08:49:24 +0000 Message-Id: <4D5E40D80200007800032A0B@vpn.id2.novell.com> Date: Fri, 18 Feb 2011 08:49:00 -0000 From: "Jan Beulich" To: "Jakub Jelinek" ,"Jan Hubicka" Cc: "GCC Development" , "H.J. Lu" ,, "Binutils" , "GNU C Library" , "H. Peter Anvin" Subject: Re: x32 psABI draft version 0.2 References: <4D5C2DD2.10608@zytor.com> <4D5CEBDE02000078000325A2@vpn.id2.novell.com> <20110217142916.GI13037@sunsite.ms.mff.cuni.cz> <20110217152233.GB11346@atrey.karlin.mff.cuni.cz> <20110217154452.GA18799@kam.mff.cuni.cz> <20110217180646.GB30899@tyan-ft48-01.lab.bos.redhat.com> <20110217224956.GA20055@kam.mff.cuni.cz> <20110217230727.GK30899@tyan-ft48-01.lab.bos.redhat.com> In-Reply-To: <20110217230727.GK30899@tyan-ft48-01.lab.bos.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00240.txt.bz2 >>> On 18.02.11 at 00:07, Jakub Jelinek wrote: > So one way to cut down the size of .rela.dyn section would be a relocation > like > R_X86_64_RELATIVE_BLOCK where applying such a relocation with r_offset O = and > r_addend N would be: > uint64_t *ptr =3D O; > for (i =3D 0; i < N; i++) > ptr[i] +=3D bias; > Then e.g. > 0000003ec6d86008 0000000000000008 R_X86_64_RELATIVE=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000003ec5aef3f3 > 0000003ec6d86010 0000000000000008 R_X86_64_RELATIVE=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000003ec5af92f6 > 0000003ec6d86018 0000000000000008 R_X86_64_RELATIVE=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000003ec5b06d17 > 0000003ec6d86020 0000000000000008 R_X86_64_RELATIVE=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000003ec5b1dc5f > 0000003ec6d86028 0000000000000008 R_X86_64_RELATIVE=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000003ec5b1edaf > 0000003ec6d86030 0000000000000008 R_X86_64_RELATIVE=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000003ec5b27358 > 0000003ec6d86038 0000000000000008 R_X86_64_RELATIVE=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000003ec5b30f9f > 0000003ec6d86040 0000000000000008 R_X86_64_RELATIVE=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000003ec5b3317d > 0000003ec6d86048 0000000000000008 R_X86_64_RELATIVE=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000003ec5b34479 > could be represented as: > 0000003ec6d86008 00000000000000MN R_X86_64_RELATIVE_BLOCK=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 > 0000000000000009 > I see many hundreds of consecutive R_X86_64_RELATIVE relocs in libxul.so,= =20 > though > of course it would need much better analysis over larger body of code. >=20 > In most programs if the library is prelinked all relative relocs are skip= ped > and .rela.dyn for them doesn't need to be even paged in, but Mozilla is=20 > quite > special in that it one of the most common security relevant packages and= =20 > thus > wants randomization, but is linked against huge libraries, so the questio= n=20 > is > if Mozilla is the right candidate to drive our decisions on. >=20 > Another alternative to compress relative relocations would be an indirect > relative relocation, which would give you in r_offset address of a block = of=20 > addresses > and r_addend the size of that block, and the block would just contain=20 > offsets > on which words need to be +=3D bias. Then, instead of changing RELA to R= EL to > save 8 bytes from 24 you'd save 16 bytes from those 24 (well, for x32 hal= f=20 > of that). For relocations where the relocated field is large enough, considering chained relocations (as seen in NetWare NLMs) would also be a possibility, i.e. r_offset specifies just the first relocation that all need the same addend (and eventual other properties), and the relocated field holds the r_offset of the next field to be relocated. Jan