core-util, cpu-x86: use __get_cpuid() instead of homegrown assembly

The get_cpuid() function in cpu-x86.c was buggy on x86-64. When building
without optimizations, the homegrown assembly code overwrote the
beginning of the function argument list on the stack. That happened to
work fine on regular x86-64, but caused crashing with the x32 ABI.

At least GCC and clang provide cpuid.h, which has the __get_cpuid()
function that can be used instead of the homegrown assembly.

The PA_REG_* constants can be removed as well, because they're not used
any more.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103656
This commit is contained in:
Tanu Kaskinen 2017-11-22 17:14:10 +02:00
parent 2062fc8b0e
commit c8bd93c5a7
4 changed files with 38 additions and 48 deletions

View file

@ -410,7 +410,7 @@ AC_SUBST([LIBLTDL])
AC_HEADER_STDC
# POSIX
AC_CHECK_HEADERS_ONCE([arpa/inet.h glob.h grp.h netdb.h netinet/in.h \
AC_CHECK_HEADERS_ONCE([arpa/inet.h cpuid.h glob.h grp.h netdb.h netinet/in.h \
netinet/in_systm.h netinet/tcp.h poll.h pwd.h sched.h \
sys/mman.h sys/select.h sys/socket.h sys/wait.h \
sys/uio.h syslog.h sys/dl.h dlfcn.h linux/sockios.h])