Question about readelf output from shared library built with lld, gold, and bfd linkers

Nick Clifton nickc@redhat.com
Tue Nov 22 11:20:20 GMT 2022


Hi Tom,

> I do not know
> where to start looking to figure out why lld generates the final ELF file
> that runs quicker than what is generated by the gold linker.

Are we talking about application start-up times or application run-time
performance ?  The two are different and likely to be affected by different
changes in the linker.

[As an aside have you also compared performance when linking with the BFD
based linker, and with mold ?)


> So, I guess the next question is this - what should I look for in the files
> generated by lld and gold, respectively, using  readelf?

You don't.  At least that is not where I would start.  Your best bet is to
use one or more profiling tools and figure out why one version of the
application is faster than the other.  If it is a case that the profiles of
the two versions are basically the same - ie they spend the same percentages
of their time in the same functions - then the cause is likely to be the
layout of the code.  The faster performing code is getting better performance
from the cache.  If they have different profiles, then maybe one linker is
able to discard more unneeded code, or optimize the linked code more effectively.

Another place to look is in the changelogs/reflogs/announcements for the
two linkers.  Likely lld has recently had some new features/improvements added
to it, and these are causing the performance improvements.

Cheers
   Nick

PS.  Waiving my devil's advocate flag here: why bother with this search ?
   Isn't it enough that you have found a linker that provides better performance ?





More information about the Binutils mailing list