[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reducing code size of Position Independent Executables (PIE) by shrinking the size of dynamic relocations section
- To: David Edelsohn <dje.gcc@gmail.com>, Rafael Avila de Espindola <rafael.espindola@gmail.com>
- Subject: Re: Reducing code size of Position Independent Executables (PIE) by shrinking the size of dynamic relocations section
- From: Suprateeka R Hegde <hegdesmailbox@gmail.com>
- Date: Mon, 1 May 2017 23:58:04 +0530
- Authentication-results: sourceware.org; auth=none
- Cc: Binutils Development <binutils@sourceware.org>, Alan Modra <amodra@gmail.com>, Florian Weimer <fweimer@redhat.com>, Cary Coutant <ccoutant@gmail.com>, Sriraman Tallam <tmsriram@google.com>, gnu-gabi@sourceware.org, Xinliang David Li <davidxl@google.com>, Sterling Augustine <saugustine@google.com>, Paul Pluzhnikov <ppluzhnikov@google.com>, Ian Lance Taylor <iant@google.com>, "H.J. Lu" <hjl.tools@gmail.com>, Rahul Chaudhry <rahulchaudhry@google.com>, Luis Lozano <llozano@google.com>, Peter Collingbourne <pcc@google.com>, Rui Ueyama <ruiu@google.com>
- Delivered-to: listarch-gnu-gabi@sourceware.org
- Delivered-to: mailing list gnu-gabi@sourceware.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=reply-to:subject:references:to:cc:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=0C8RN5OAMRpPFMZFd//dKsraHqjPwa4CBcXYxdwZgMg=; b=Gt79WQthv2OmEI0V6xbMSuHstrYTGOPkA4PY70PplesbhPIckVagytgSV4YkISiUam ffn2E992JP9ZIScaTQTQF7HWCcaUUGGLRBGxqpbcIowXsvVAOaa99jOK6f4bdOfWS8DJ epfxpCPvxGTkdw46I0zvLCedCk8zjXpRNkVvsMhiEZdE41f2FxgME6mQMEDd0hnmisW8 qARhrNuaIMCE75Q6OMz1T7s0POC9nZTbXK23TU/rEYgCuoPNs+00nPpj9dkfCUv8WovS dIxp1TrUHz9eieRU/6yyhmTRPpHWH2VPpVYL3N0YFectu5Dv8DEG5dPqOCb4Zr/pVQgB Al+A==
- In-reply-to: <CAGWvnynEe3QkhDMGc=Tx8Vr44egtv3xLuh1yiVcAhv+e3GLtZg@mail.gmail.com>
- List-help: <mailto:gnu-gabi-help@sourceware.org>
- List-id: <gnu-gabi.sourceware.org>
- List-post: <mailto:gnu-gabi@sourceware.org>
- List-subscribe: <mailto:gnu-gabi-subscribe@sourceware.org>
- Mailing-list: contact gnu-gabi-help@sourceware.org; run by ezmlm
- Organization: HEGDESASPECT
- References: <CAGWvnynFwXFGLj3tAVgDatn0zmuHcWHyRNuDvR+wRZCXLnar_A@mail.gmail.com> <8737cosnym.fsf@localhost.localdomain.i-did-not-set--mail-host-address--so-tickle-me> <CAGWvnynEe3QkhDMGc=Tx8Vr44egtv3xLuh1yiVcAhv+e3GLtZg@mail.gmail.com>
- Reply-to: hegdesmailbox@gmail.com
- Sender: gnu-gabi-owner@sourceware.org
- User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
Is the AIX available on x86-64? Otherwise it may not be much useful to
refer the linker design. And it is just not linker when it comes to
relocs, it indeed involves entire runtime architecture and ISA of the
platform.
HP-UX on Itanium also uses PIC by default and we have never faced any
such exponential difference between relative and non-relative relocs,
and its been almost 2 decades now.
I just did some numbers. On a Ubuntu 16.10, I just took the ratio of
RELATIVE vs non-RELATIVE on x86-64. I apologize if this number is
already discussed.
readelf -Wr /usr/bin/* 2>&1 | grep RELATIVE | wc -l
1238652
readelf -Wr /usr/bin/* 2>&1 | grep -v RELATIVE | wc -l
51551
So the ratio shows ~96% is RELATIVE reloc. And only ~4% others. This is
not the case on HP-UX/Itanium. But as I said, this comparison does not
make sense as the runtime architecture and ISA are totally different.
At this point, I would say the combination of original ideas proposed
and some work already done in this direction is the way to go. On HP-UX,
our tool chain greatly reduces dyn relocs with IPO kind of options too.
--
Supra
On 01-May-2017 07:43 PM, David Edelsohn wrote:
> GNU ld supports earlier versions of AIX XCOFF, so one can look at that code.
>
> The current documentation for XCOFF is
>
> https://www.ibm.com/support/knowledgecenter/ssw_aix_72/com.ibm.aix.files/XCOFF.htm
>
> - David
>
>
> On Mon, May 1, 2017 at 9:31 AM, Rafael Avila de Espindola
> <rafael.espindola@gmail.com> wrote:
>> Where is it documented?
>>
>> Thanks,
>> Rafael
>>
>> David Edelsohn <dje.gcc@gmail.com> writes:
>>
>>> AIX uses relative relocations and generates position independent
>>> executables by default. The design of the AIX linker might provide
>>> some additional inspiration.
>>>
>>> Thanks, David