[lld] r292359 - [ELF] Move createThunks() after scanRelocations()

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 14:09:25 PST 2017


Peter Smith via llvm-commits <llvm-commits at lists.llvm.org> writes:
> +template <class ELFT>
> +void createThunks(ArrayRef<OutputSectionBase *> OutputSections) {
> +  for (OutputSectionBase *Base : OutputSections) {
> +    if (auto *OS = dyn_cast<OutputSection<ELFT>>(Base)) {

Invert the if and early return maybe?

> +      for (InputSection<ELFT> *IS : OS->Sections) {
> +        for (const Relocation &Rel : IS->Relocations) {
> +          if (Rel.Sym == nullptr) {
> +            continue;
> +          }

You don't need the {}.

> +          if (!isPreemptible(Body, Type) && needsPlt(Expr))
> +            Expr = fromPlt(Expr);
> +          Expr = Target->getThunkExpr(Expr, Type, IS->getFile(), Body);

Are these lines still needed now that the code was moved? All tests pass
if I delete them.


Cheers,
Rafael


More information about the llvm-commits mailing list