This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Handle ifuncs trampolines for aarch64
ClosedPublic

Authored by yota9 on Mar 2 2022, 2:34 PM.

Details

Summary

The aarch64 uses the trampolines located in .iplt section, which
contains plt-like trampolines on the value stored in .got. In this case
we don't have JUMP_SLOT relocation, but we have a symbol that belongs to
ifunc trampoline, so use it and set plt symbol for such functions.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Diff Detail

Event Timeline

yota9 created this revision.Mar 2 2022, 2:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 2:34 PM
yota9 requested review of this revision.Mar 2 2022, 2:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 2:34 PM
yota9 edited the summary of this revision. (Show Details)Mar 2 2022, 2:36 PM
rafauler added inline comments.Mar 8 2022, 11:33 AM
bolt/lib/Rewrite/RewriteInstance.cpp
1260

I don't understand why the BinaryFunction is already created for ifuncs? For X86, both ifuncs and regular PLTs are pretty similar, except for the relocation type.

yota9 marked an inline comment as done.Mar 8 2022, 11:35 AM
yota9 added inline comments.
bolt/lib/Rewrite/RewriteInstance.cpp
1260

Because the symtab contains the trampoline IFUNC symbol and it is already disassembled. Currently it does not work because such trampolines are moved to the new text section and since the adrp+add does not have relocations (like in plt) - the "got" address becomes wrong

rafauler accepted this revision.Mar 8 2022, 11:49 AM

LGTM

bolt/lib/Rewrite/RewriteInstance.cpp
1260

Oh, I see. Thanks!

This revision is now accepted and ready to land.Mar 8 2022, 11:49 AM
This revision was automatically updated to reflect the committed changes.
yota9 marked an inline comment as done.