[Proposed patch] Huge performance regression in ld -r since binutils >= 2.21

Rich Felker dalias@libc.org
Sun Nov 15 01:01:00 GMT 2015
On Mon, Nov 09, 2015 at 09:11:07PM +1030, Alan Modra wrote:
> - Sections are combined in ways that lose code locality.  eg. with
>   -ffunction-sections, all C static functions called "setup" will be
>   placed together.

I actually wondered/worried what happens when static functions with
the same name from multiple files are used with -ffunction-sections
and --gc-sections, when some are used but others are not. Would it
perhaps make sense for gcc to attach some sort of hash based on things
like the filename and function contents to the section name so that
these section names are unique? That would probably solve a lot of the
problems with ld -r, too, assuming -ffunction-sections is used.

Of course ld -r could also have an option to create _new_ sections
like this rather than merging sections.

Rich



More information about the Binutils mailing list