unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: "maskray@gcc.gnu.org" <maskray@gcc.gnu.org>
Cc: 'GNU C Library' <libc-alpha@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>
Subject: CREL dynamic relocations
Date: Tue, 9 Apr 2024 15:32:49 +0000	[thread overview]
Message-ID: <PAWPR08MB89828687CE183D4EC04DAAF483072@PAWPR08MB8982.eurprd08.prod.outlook.com> (raw)

Hi,

I like the general idea of more compact relocations, however what I don't get is
what the overall goal is. If the goal is more compact object files, why don't we just
add a (de)compress pass using a fast compression algorithm? CPU time is cheap
today, and real compression easily gives 2-4x reduction of object file size, far more
than you could achieve by just compressing relocations.

Alternatively, if we wanted to access and process ELF files without any decompression,
we could define compact relocations as fixed-size entries. Using 64 bits for a compact
RELA relocation gives a straightforward 4x compression. Out of range values could
use the next entry to extend the ranges.

So my main issue with the proposal is that it tries too hard to compress relocations.
For example using offset compression for relocations, symbol indices and even addends
seems to have little value: the signed offset means you lose one bit, and if out of range
values are rare or not grouped together, offset encodings are actually less efficient.

I don't get the discussion about relocation numbers on AArch64 - 4 or 5 bits would
handle all frequently used relocations, so we'd just remap them to fit in the short
encoding. Hence I don't see a need at all for a signed offset encoding.

So my suggestion is to either go for compression of the whole object file or use a
simpler approach that isn't almost a compression algorithm.

Cheers,
Wilco



             reply	other threads:[~2024-04-09 15:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 15:32 Wilco Dijkstra [this message]
2024-04-11  2:41 ` CREL dynamic relocations Fangrui Song
2024-04-12 16:18   ` enh
2024-04-18  4:31     ` Fangrui Song
  -- strict thread matches above, loose matches on Subject: below --
2024-03-24  5:50 Fangrui Song
2024-03-25 11:52 ` Florian Weimer
2024-03-25 18:51   ` Fangrui Song

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PAWPR08MB89828687CE183D4EC04DAAF483072@PAWPR08MB8982.eurprd08.prod.outlook.com \
    --to=wilco.dijkstra@arm.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@gcc.gnu.org \
    /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).