This is the mail archive of the
mailing list for the binutils project.
Re: Reducing code size of Position Independent Executables (PIE) by shrinking the size of dynamic relocations section
- From: Suprateeka R Hegde <hegdesmailbox at gmail dot com>
- To: David Edelsohn <dje dot gcc at gmail dot com>, Rafael Avila de Espindola <rafael dot espindola at gmail dot com>
- Cc: Binutils Development <binutils at sourceware dot org>, Alan Modra <amodra at gmail dot com>, Florian Weimer <fweimer at redhat dot com>, Cary Coutant <ccoutant at gmail dot com>, Sriraman Tallam <tmsriram at google dot com>, gnu-gabi at sourceware dot org, Xinliang David Li <davidxl at google dot com>, Sterling Augustine <saugustine at google dot com>, Paul Pluzhnikov <ppluzhnikov at google dot com>, Ian Lance Taylor <iant at google dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, Rahul Chaudhry <rahulchaudhry at google dot com>, Luis Lozano <llozano at google dot com>, Peter Collingbourne <pcc at google dot com>, Rui Ueyama <ruiu at google dot com>
- Date: Mon, 1 May 2017 23:58:04 +0530
- Subject: Re: Reducing code size of Position Independent Executables (PIE) by shrinking the size of dynamic relocations section
- Authentication-results: sourceware.org; auth=none
- References: <CAGWvnynFwXFGLj3tAVgDatn0zmuHcWHyRNuDvR+wRZCXLnar_A@mail.gmail.com> <firstname.lastname@example.org> <CAGWvnynEe3QkhDMGc=Tx8Vr44egtv3xLuh1yiVcAhv+e3GLtZg@mail.gmail.com>
- Reply-to: hegdesmailbox at gmail dot com
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
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
readelf -Wr /usr/bin/* 2>&1 | grep RELATIVE | wc -l
readelf -Wr /usr/bin/* 2>&1 | grep -v RELATIVE | wc -l
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.
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
> - David
> On Mon, May 1, 2017 at 9:31 AM, Rafael Avila de Espindola
> <email@example.com> wrote:
>> Where is it documented?
>> David Edelsohn <firstname.lastname@example.org> 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