[llvm-dev] [LLD] Linker Relaxation

Rafael Avila de Espindola via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 11 10:57:29 PDT 2017


Rafael Avila de Espindola <rafael.espindola at gmail.com> writes:

> This is fascinating.
>
> The code has a fallthrough after the printf call, so .L2 is not an
> independent section. But the relocation is still present in the .o:
>
> 00000014  00000810 R_RISCV_BRANCH    0000002c   .L2 + 0
>
> At -O0 lld can just create InputSections and everything should work.
>
> But when optimizing lld should create a RelaxableSection as peter
> suggested. It can probably piggy back on the thunk creation, but this
> goes the other way (things get smaller).

Assuming that

* The contents are still read lazily.
* The offset mapping is really fast in the case of a section with no
  relaxations.
* We don't go looking for relaxations in sections that don't need it.

We could probably just add the feature to InputSection, but some
benchmarking is required.

Cheers,
Rafael


More information about the llvm-dev mailing list