<div dir="ltr"><div dir="ltr">Yea, definitely clang shouldn't error out on correct usage (which taking a parameter is on some platforms).</div><div dir="ltr"><br></div><div dir="ltr">What the type should be depends on the dynamic loader implementation being used. Glibc variously passes uint64_t, unsigned long, int, or nothing. (from a grep for "elf_irel"). Other linux libc implementations could well do other things. Certainly other OS's libc do. It doesn't really seem worthwhile to try to encode all the possible function signatures required here for the different targets...I'd suggest that simply removing the error message would be best.</div><div dir="ltr"><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 1, 2018 at 11:32 AM Peter Smith via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've raised <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87482" rel="noreferrer" target="_blank">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87482</a> to see<br>
if I can get some clarification about the intent of the documentation.<br>
<br>
On some targets like Arm and AArch64 the glibc dynamic loader will<br>
pass a parameter HWCAPS to the ifunc resolver function that the<br>
resolver can use choose the function, whereas I believe it does not on<br>
x86_64 where it is common for the ifunc resolver to check the cpu id<br>
directly to get the same information.<br>
<br>
In the Arm and AArch64 ports of glibc ifunc resolvers with parameters<br>
are used but __attribute__((ifunc("resolver"))) isn't used. A somewhat<br>
lower level method using inline assembly is used instead: asm (".type<br>
func1, %gnu_indirect_function");<br>
<br>
My personal view is that the error would be useful in the context of<br>
(X86_64, glibc) but not in the case of (AArch64, glibc) or (Arm,<br>
glibc), it is also possible that FreeBSD have chosen to pass a<br>
parameter even in X86_64. So I think that the error message, if it is<br>
there at all, should be conditional on a Target.<br>
<br>
Peter<br>
On Mon, 1 Oct 2018 at 14:42, David Blaikie via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> (+echristo in case he has some thoughts here)<br>
><br>
> On Sun., 30 Sep. 2018, 6:57 am Dmitry Polukhin via cfe-dev, <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> When I implemented ifunc I followed GCC documentation and was not aware of ifunc resolvers parameter. But if it is so much platform dependent and undocumented in GCC, I'm doubt if it should be supported in clang.<br>
>><br>
>> On Sat, Sep 29, 2018 at 11:38 PM Ed Maste <<a href="mailto:emaste@freebsd.org" target="_blank">emaste@freebsd.org</a>> wrote:<br>
>>><br>
>>> When ifunc support was added to Clang with r265917<br>
>>> <a href="http://llvm.org/viewvc/llvm-project?rev=265917&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=265917&view=rev</a> it did not<br>
>>> allow resolvers to take parameters. It appears GCC documents ifunc<br>
>>> resolvers as taking no parameters, but GCC in fact allows it.<br>
>>><br>
>>> In FreeBSD our rtld passes machine-dependent CPU ID information to<br>
>>> ifunc resolvers, and we had to remove the prohibition:<br>
>>> <a href="https://svnweb.freebsd.org/changeset/base/339019" rel="noreferrer" target="_blank">https://svnweb.freebsd.org/changeset/base/339019</a>.<br>
>>><br>
>>> In the glibc world, as far as I can tell it in fact passes dl_hwcap on<br>
>>> several architectures (but not on x86 or x86_64).<br>
>>><br>
>>> I believe GCC's documentation is simply incorrect. Is there any reason<br>
>>> not to just remove this check and error case from Clang?<br>
>><br>
>> _______________________________________________<br>
>> cfe-dev mailing list<br>
>> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>