[PATCH] ld: pe: Improve performance of object file exclude symbol directives

Martin Storsjö martin@martin.st
Tue Sep 6 11:59:39 GMT 2022


On Tue, 6 Sep 2022, Jan Beulich wrote:

> On 06.09.2022 13:42, Nick Clifton wrote:
>>> On 05.09.2022 14:54, Nick Clifton via Binutils wrote:
>>>>> +      max_exclude_symbols = ROUND_UP(fdef->num_exclude_symbols + 1, 32);
>>>>
>>>> Given that the point of this patch is to improve performance when there
>>>> are a large number of excluded symbols, incrementing the array by 32 slots
>>>> at a time seems counter intuitive.  I would suggest a bigger number, eg 1024
>>>> or 10240.
>>>
>>> Perhaps double the value, thus not overly much impacting the case of there
>>> being a moderate number of excludes?
>>
>> To be honest I have no idea what a "large number of excludes" might look like.
>> So maybe 32 is actually a sensible increment.  Doubling the increment every
>> time the limit is reached could lead to resource exhaustion issues in extreme
>> cases, but I doubt if that will ever happen in real life, so that works for me
>> too.
>
> Well, first I was thinking of a hybrid approach - double until reaching 1024,
> then increment further by 1024. But then this seemed to be going a little too
> far, so I suggested the simpler alternative. Thoughts?

FWIW, for the case I'm looking at, the build runs through 52k embedded 
-exclude-symbols: directives, and out of those, there are 29k unique 
symbols excluded.

// Martin



More information about the Binutils mailing list