[PATCH] D139163: Utils: Add utility pass to lower ifuncs

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 22:38:39 PST 2022


MaskRay added a comment.

In D139163#4012366 <https://reviews.llvm.org/D139163#4012366>, @MaskRay wrote:

> What's the motivation for piggybacking the functionality on top of ifunc? Does AMDGPU want to use ifunc to do something special?
>
> A dynamic loader knows some properties like HWCAP. Except legacy x86 ifunc implementation, almost all glibc ports pass `dl_hwcap` to the ifunc resolver and some newer ports (aarch64,loongarch, well riscv is unfortunate) even make the struct extensible.
> Lowering ifunc in IR makes such information unavailable.
>
> Note that an ifunc can be emulated by a global function pointer which causes no difference at a call site.
> There is more flexibility: the program can initialize at any time which is appropriate and provide arbitrary arguments.
> It seems that no project uses `__attribute__((ifunc))`. The reason is in some part related to the inflexibility.
> Because of initialization order fiasco, it's infeasible to initialize an ifunc with information from another module linked into the same executable/DSO.

(Edited the previous comment a bit.)


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

https://reviews.llvm.org/D139163



More information about the llvm-commits mailing list