reduce mangled name sizes via link-time symbol renaming

timotheecour timothee.cour2 at gmail.com
Sat Jan 27 00:22:48 UTC 2018


On Friday, 26 January 2018 at 08:44:26 UTC, Seb wrote:
>> What is the benefit of using link-time renaming (a linker 
>> specific feature) instead of directly renaming the symbol in 
>> the compiler? We could be quite radical and hash all symbols > 
>> a certain threshold. As long as we have a hash function with 
>> strong enough collision resistance there shouldn't be any 
>> problem.
>> -- Johannes
>
> I thought LDC is already doing this with -hashtres?
>
> https://github.com/ldc-developers/ldc/pull/1445

* What i suggested doesn't require any hashing, so it can produce 
minimal symbol size with 0 risk of collision, in fact optimally 
minimum symbol size if we wanted to (using an incremented counter 
i to remap the i'th symbol)

* -hashtres is still experimental, and doesn't work with phobos, 
and has a lower bound on symbol size since it's using a hash; it 
has other limitations as you can see in 
https://github.com/ldc-developers/ldc/pull/1445#issue-149189001

* a potential extension of this proposal is to do it not at link 
time but at compile time, where we'd maintain (in memory) the 
mapping long_mangle=>short_mangle and serialize it to a file in 
case we'd like to support separate compilation.


More information about the Digitalmars-d mailing list