Reducing code size of Position Independent Executables (PIE) by shrinking the size of dynamic relocations section

Florian Weimer fweimer@redhat.com
Fri Apr 28 06:25:00 GMT 2017


On 04/26/2017 06:06 AM, Cary Coutant wrote:
> 4. Evaluate some alternate representations to improve upon the simple
> list of addresses. An idea I've been considering is emitting a bitmap
> -- an alternating series of pairs (starting address, bits), where
> "bits" is just a fixed-size bit vector describing each word starting
> at the given starting address. The "bits" field could be, say, 128 or
> 256 bits in length, or could begin with a byte that defines its
> length. I think this would work well, as the relocations are often
> clustered, but haven't yet done any testing of that hypothesis. A
> simple run-length encoding, as previously suggested, would also work,
> of course. I'm not in favor of using a general-purpose compression
> algorithm on the relocations.

It might also be possible to sort the relocated objects so that they are 
more contiguous.

It could be beneficial to arrange things so that vector instructions can 
be used for the relocation.  I'm not sure if it is worthwhile to design 
a compression scheme based on bit fiddling for this because those who 
want compression can probably use a compressed file system anyway.

Thanks,
Florian



More information about the Binutils mailing list