[PATCH] D17242: [ELF] - Linkerscript KEEP command.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 07:56:40 PST 2016


On 17 February 2016 at 05:36, George Rimar <grimar at accesssoftek.com> wrote:
> grimar added a comment.
>
> In http://reviews.llvm.org/D17242#353765, @ruiu wrote:
>
>> What's the performance impact of this change? This change made the linker compare all discarded section names against all rules in linker scripts, which can be expensive. Of course that depends on input, but O(n*m) where n is the number of discarded sections and m is the number of section rules is a bit scary.
>
>
> That really depends I guess. Should be tested on real app that uses the features of LS. Currently I think it is not in the state when valid tests can be performed.
> There are lot of possible ways to optimize I believe, but for now I suggest to leave this one implementation.

So, in the context of this change, I think the most important
performance cases are

* Linker script is not used
* Linker script without KEEP
* Linker script with KEEP

If I read it correctly, the first case should not change much since
Sections will be empty.

One interesting case you might want to add a test for and check what
bfd and gold do:

A section name matches two entries in the SECTIONS directive. The
first one doesn't have KEEP, the second one does.

I suggest that because I possible "optimization" that I though was to
check match only on section that have the Keep flag, but that would
change the result in this case.

Cheers,
Rafael


More information about the llvm-commits mailing list