[cfe-dev] ifunc resolver parameters
James Y Knight via cfe-dev
cfe-dev at lists.llvm.org
Mon Oct 1 13:18:45 PDT 2018
Yea, definitely clang shouldn't error out on correct usage (which taking a
parameter is on some platforms).
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.
On Mon, Oct 1, 2018 at 11:32 AM Peter Smith via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> I've raised https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87482 to see
> if I can get some clarification about the intent of the documentation.
> On some targets like Arm and AArch64 the glibc dynamic loader will
> pass a parameter HWCAPS to the ifunc resolver function that the
> resolver can use choose the function, whereas I believe it does not on
> x86_64 where it is common for the ifunc resolver to check the cpu id
> directly to get the same information.
> In the Arm and AArch64 ports of glibc ifunc resolvers with parameters
> are used but __attribute__((ifunc("resolver"))) isn't used. A somewhat
> lower level method using inline assembly is used instead: asm (".type
> func1, %gnu_indirect_function");
> My personal view is that the error would be useful in the context of
> (X86_64, glibc) but not in the case of (AArch64, glibc) or (Arm,
> glibc), it is also possible that FreeBSD have chosen to pass a
> parameter even in X86_64. So I think that the error message, if it is
> there at all, should be conditional on a Target.
> On Mon, 1 Oct 2018 at 14:42, David Blaikie via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
> > (+echristo in case he has some thoughts here)
> > On Sun., 30 Sep. 2018, 6:57 am Dmitry Polukhin via cfe-dev, <
> cfe-dev at lists.llvm.org> wrote:
> >> 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.
> >> On Sat, Sep 29, 2018 at 11:38 PM Ed Maste <emaste at freebsd.org> wrote:
> >>> When ifunc support was added to Clang with r265917
> >>> http://llvm.org/viewvc/llvm-project?rev=265917&view=rev it did not
> >>> allow resolvers to take parameters. It appears GCC documents ifunc
> >>> resolvers as taking no parameters, but GCC in fact allows it.
> >>> In FreeBSD our rtld passes machine-dependent CPU ID information to
> >>> ifunc resolvers, and we had to remove the prohibition:
> >>> https://svnweb.freebsd.org/changeset/base/339019.
> >>> In the glibc world, as far as I can tell it in fact passes dl_hwcap on
> >>> several architectures (but not on x86 or x86_64).
> >>> I believe GCC's documentation is simply incorrect. Is there any reason
> >>> not to just remove this check and error case from Clang?
> >> _______________________________________________
> >> cfe-dev mailing list
> >> cfe-dev at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev