From: "Rahul Chaudhry via gnu-gabi" <gnu-gabi@sourceware.org>
To: Cary Coutant <ccoutant@gmail.com>
Cc: Sriraman Tallam <tmsriram@google.com>,
Suprateeka R Hegde <hegdesmailbox@gmail.com>,
Florian Weimer <fweimer@redhat.com>,
David Edelsohn <dje.gcc@gmail.com>,
Rafael Avila de Espindola <rafael.espindola@gmail.com>,
Binutils Development <binutils@sourceware.org>,
Alan Modra <amodra@gmail.com>,
Rahul Chaudhry via gnu-gabi <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>,
Luis Lozano <llozano@google.com>,
Peter Collingbourne <pcc@google.com>,
Rui Ueyama <ruiu@google.com>,
llvm-dev@lists.llvm.org
Subject: Re: Reducing code size of Position Independent Executables (PIE) by shrinking the size of dynamic relocations section
Date: Sun, 01 Jan 2017 00:00:00 -0000 [thread overview]
Message-ID: <CAJRD=orcNZDXJiuQmWqNQw41F7biy4FUVdm-57i6K+rw9gu2-Q@mail.gmail.com> (raw)
In-Reply-To: <CAJRD=or-vgE4B-E2jF8ztTJfu+ise6T2iBanRfbZKNivOoNJUg@mail.gmail.com>
We sent a proposal to generic-abi last week.
Here's the link for cross-reference, as promised:
https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg
Rahul
On Mon, Dec 11, 2017 at 4:05 PM, Rahul Chaudhry
<rahulchaudhry@google.com> wrote:
> Thanks for your encouraging words, Ian and Cary.
>
> We're drafting a more detailed proposal and would post it on the generic-abi
> list this week. I'll also post a link here for cross-reference.
>
> Based on Cary's suggestion here, we're renaming '.relrz.dyn' to
> '.relr.dyn' in the
> proposal.
>
> Rahul
>
>
> On Fri, Dec 8, 2017 at 10:36 PM, Cary Coutant <ccoutant@gmail.com> wrote:
>>> We've taken the '.relr.dyn' section from Cary's prototype, and implemented a
>>> custom encoding to compactly represent the list of offsets. We're calling the
>>> new compressed section '.relrz.dyn' (for relocations-relative-compressed).
>>
>> I'd suggest just using .relr.dyn -- your encoding is straightforward
>> enough that I'd just make that the standard representation for this
>> section type.
>>
>>> The encoding used is a simple combination of delta-encoding and a bitmap of
>>> offsets. The section consists of 64-bit entries: higher 8-bits contain delta
>>> since last offset, and lower 56-bits contain a bitmap for which words to apply
>>> the relocation to. This is best described by showing the code for decoding the
>>> section:
>>>
>>> ...
>>>
>>> The above code is the entirety of the implementation for decoding and
>>> processing '.relrz.dyn' sections in glibc dynamic loader.
>>>
>>> This encoding can represent up to 56 relocation offsets in a single 64-bit
>>> word. For many of the binaries we tested, this encoding provides >40x
>>> compression for storing offsets over the original `.relr.dyn` section.
>>>
>>> For 32-bit targets, we use 32-bit entries: 8-bits for 'jump' and 24-bits for
>>> the bitmap.
>>
>> Very nice! Simple and effective.
>>
>>> Here are three real world examples that demonstrate the savings:
>>
>> Impressive numbers. I've gotta admit, the savings are better than I expected.
>>
>>> However, before that can happen, we need agreement on the ABI side for the new
>>> section type and the encoding. We haven't worked on a change of this magnitude
>>> before that touches so many different pieces from the linker, elf tools, and
>>> the dynamic loader. Specifically, we need agreement and/or guidance on where
>>> and how should the new section type and its encoding be documented. We're
>>> proposing adding new defines for SHT_RELRZ, DT_RELRZ, DT_RELRZSZ, DT_RELRZENT,
>>> and DT_RELRZCOUNT that all the different parts of the toolchains can agree on.
>>
>> Yes, as Ian mentioned, the generic ABI discussion is at
>> generic-abi@googlegroups.com. Most people who would be interested are
>> already on the gnu-gabi@sourceware.org list, but there are a few who
>> are not, and who may not yet have seen this discussion. I'll support
>> the proposal.
>>
>> Thanks for taking this idea the extra mile!
>>
>> -cary
next prev parent reply other threads:[~2017-12-19 19:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAGWvnynFwXFGLj3tAVgDatn0zmuHcWHyRNuDvR+wRZCXLnar_A@mail.gmail.com>
2017-01-01 0:00 ` Rafael Avila de Espindola
2017-01-01 0:00 ` David Edelsohn
2017-01-01 0:00 ` Suprateeka R Hegde
2017-01-01 0:00 ` Florian Weimer
2017-01-01 0:00 ` Suprateeka R Hegde
2017-01-01 0:00 ` Sriraman Tallam via gnu-gabi
2017-01-01 0:00 ` Rahul Chaudhry via gnu-gabi
2017-01-01 0:00 ` Cary Coutant
2017-01-01 0:00 ` Rahul Chaudhry via gnu-gabi
2017-01-01 0:00 ` Rahul Chaudhry via gnu-gabi [this message]
2017-01-01 0:00 ` Florian Weimer
2017-01-01 0:00 ` Sriraman Tallam via gnu-gabi
2017-01-01 0:00 ` Rahul Chaudhry via gnu-gabi
[not found] ` <CAORpzuMftCGpXUObOyoFY0=jorMBDWEDbQJ23DifTNW3v-WA6Q@mail.gmail.com>
2017-01-01 0:00 ` Rahul Chaudhry via gnu-gabi
2017-01-01 0:00 ` Cary Coutant
2017-01-01 0:00 ` Rahul Chaudhry via gnu-gabi
[not found] ` <CAORpzuPYsSBJtypm3NDcfcgRzos3WO4JjkvgiqpyBYBhoqLVFA@mail.gmail.com>
2018-01-01 0:00 ` Florian Weimer
2017-01-01 0:00 ` Ian Lance Taylor via gnu-gabi
2017-01-01 0:00 Sriraman Tallam
2017-01-01 0:00 ` Cary Coutant
2017-01-01 0:00 ` Florian Weimer
2017-01-01 0:00 ` Alan Modra
2017-01-01 0:00 ` Markus Trippelsdorf
2017-01-01 0:00 ` Sriraman Tallam
2017-01-01 0:00 ` H.J. Lu
2017-01-01 0:00 ` Rafael Espíndola
2017-01-01 0:00 ` Sriraman Tallam
2017-01-01 0:00 ` H.J. Lu
2017-01-01 0:00 ` Sriraman Tallam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJRD=orcNZDXJiuQmWqNQw41F7biy4FUVdm-57i6K+rw9gu2-Q@mail.gmail.com' \
--to=gnu-gabi@sourceware.org \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=ccoutant@gmail.com \
--cc=davidxl@google.com \
--cc=dje.gcc@gmail.com \
--cc=fweimer@redhat.com \
--cc=hegdesmailbox@gmail.com \
--cc=hjl.tools@gmail.com \
--cc=iant@google.com \
--cc=llozano@google.com \
--cc=llvm-dev@lists.llvm.org \
--cc=pcc@google.com \
--cc=ppluzhnikov@google.com \
--cc=rafael.espindola@gmail.com \
--cc=rahulchaudhry@google.com \
--cc=ruiu@google.com \
--cc=saugustine@google.com \
--cc=tmsriram@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).