illegal instruction - create compile variants ?
Jan Kratochvil
jan.kratochvil at redhat.com
Mon May 2 09:06:03 UTC 2011
On Sun, 01 May 2011 22:31:42 +0200, Kevin Kofler wrote:
> Yes, all the packages which have WORKING support for SSE etc. in Fedora do
> that. See e.g.
> https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/solid/solid/backends/shared/cpufeatures.cpp
> https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/solid/solid/backends/udev/cpuinfo.cpp
> https://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/solid/solid/backends/udev/udevprocessor.cpp
> for the implementation Solid (in kdelibs) uses.
There is the STT_GNU_IFUNC feature implemented for it - the indirect is handled
by linker without an additional indirect overhead if applied for a shared
library function. For apps it works in a similar way as normal indirect.
In use by glibc:
include/libc-symbols.h:
/* Marker used for indirection function symbols. */
#define libc_ifunc(name, expr) \
extern void *name##_ifunc (void) __asm__ (#name); \
void *name##_ifunc (void) \
{ \
INIT_ARCH (); \
__typeof (name) *res = expr; \
return res; \
} \
__asm__ (".type " #name ", %gnu_indirect_function");
sysdeps/x86_64/multiarch/memmove.c:
libc_ifunc (memmove,
HAS_SSSE3
? (HAS_FAST_COPY_BACKWARD
? __memmove_ssse3_back : __memmove_ssse3)
: __memmove_sse2);
etc.
Or a simpler testcase:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/gnu-ifunc-lib.c?rev=1.1&cvsroot=src
Regards,
Jan
More information about the devel
mailing list