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

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 18:32:29 PST 2022


rjmccall added a comment.

In D139163#3992391 <https://reviews.llvm.org/D139163#3992391>, @rjmccall wrote:

> In D139163#3992262 <https://reviews.llvm.org/D139163#3992262>, @dexonsmith wrote:
>
>> In D139163#3991248 <https://reviews.llvm.org/D139163#3991248>, @MoritzS wrote:
>>
>>> To answer your questions in the comments about what to do about resolvers with arguments: At least glibc always calls ifunc resolvers without any arguments. It just reads the address of the resolver function from the ELF file, casts it to a pointer to a void-returning function with no arguments and calls it.
>>>
>>> So, I agree: Resolvers with arguments should not be allowed.
>>
>> @rjmccall, I'm trying to remember whether Mach-O has an ifunc-like thing that takes an argument.
>
> I don't know that we support ifuncs of any kind, but I'll ask.

Okay, the official word is that Mach-O has a `.symbol_resolver` feature which we regret adding because it adds per-call overheads that make it slower than just switching yourself in typical code patterns.  As far as I know, that feature has never been hooked up to `__attribute__((ifunc))`, which is marked in Clang as a target-specific attribute for ELF targets, and so there is no need to consider Mach-O when changing the LLVM ifunc support.


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

https://reviews.llvm.org/D139163



More information about the llvm-commits mailing list