[PATCH] D27406: [LLD][ELF] Ifunc implementation using synthetic sections

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 08:16:02 PST 2016


peter.smith added a comment.

Thank you for the comments.

If I've understood you correctly, I would keep

  if (Body.isGnuIFunc() && !Preemptible)
    Rel = Target->IRelativeRel;
  else
    Rel = Target->PltRel;
  
  In<ELFT>::GotPlt->addEntry(Body);
  In<ELFT>::RelaPlt->addReloc({Rel, In<ELFT>::GotPlt,
                               Body.getGotPltOffset<ELFT>(), !Preemptible,
                               &Body, 0});

The overloads in ARMGotPlt and ARMRelaPlt would redirect (possibly to ARMGot and ARMRelaDyn) if Body.isGNUIFunc(). If that is the case I think that could help solve the difference with ARM and the other Targets, without adding too many explicit if Target is ARM.

I don't think it would help with the ordering of relocations in RelaPlt (RelaDyn for ARM) as this affects all Targets. The IRelative relocations need to be last in the table so that the dynamic loader can initialise the entries for functions that the ifunc resolver might call. It could be possible to sort the relocations, but just doing that would invalidate the RelocOffsets that the x86 and x86_64 uses.

I think that there is some scope for using inheritance, for example the IPltSection could be a specialisation of PltSection.

Apologies if I've misunderstood.


https://reviews.llvm.org/D27406





More information about the llvm-commits mailing list