[PATCH] D158194: [lld/ELF] Add flag to print relocation stats

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 11:14:07 PDT 2023


MaskRay added a comment.

In D158194#4595920 <https://reviews.llvm.org/D158194#4595920>, @aeubanks wrote:

> In D158194#4595844 <https://reviews.llvm.org/D158194#4595844>, @MaskRay wrote:
>
>> This adds overhead to most relocations. The maximum offset doesn't necessarily reflect the pressure. We need to look at the distribution.
>> I am therefore object to such an approach. 
>> As an alternative, we can relink with `--emit-relocs` and use another program to analyze the relocations.
>
> I measured this (probably should have gotten numbers before sending this out) and yeah this does noticeably increase link times even when it's turned off so this current approach won't work.
>
> But for continual monitoring of relocation pressure across binaries in a large build system, it's quite convenient to do this in the linker rather than as a separate step. Are you against all approaches of doing this in lld during the link (under a flag that won't impact link times at all), or just approaches in lld that affect lld link times?

I am concerned with any changes that affect the performance. Some really high-profile features can outweigh the cost, e.g. relocation overflow checking (the code your patch is changing), RISC-V linker relaxation.
For relocation monitoring, let me just be clearer. I think doing it in lld is almost always unacceptable. This is a data analysis task that should be done by another program.
Just use `--emit-relocs`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158194/new/

https://reviews.llvm.org/D158194



More information about the llvm-commits mailing list