forked from pool/bulk_extractor
- cpuid-check.patch: robustify cpuid check - Don't disable LTO OBS-URL: https://build.opensuse.org/request/show/1101488 OBS-URL: https://build.opensuse.org/package/show/security:forensics/bulk_extractor?expand=0&rev=9
38 lines
1.4 KiB
Diff
38 lines
1.4 KiB
Diff
From 054ff3b4c82c028446839660335df44cd6c9ab0b Mon Sep 17 00:00:00 2001
|
|
From: Jason Solomon <jxs@google.com>
|
|
Date: Tue, 24 May 2022 15:43:25 +1000
|
|
Subject: [PATCH] Fix detection of x86 cpuid instruction
|
|
|
|
---
|
|
src/dfxml_configure.m4 | 14 +++++++++++++-
|
|
1 file changed, 13 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/be20_api/dfxml_cpp/src/dfxml_configure.m4 b/src/be20_api/dfxml_cpp/src/dfxml_configure.m4
|
|
index e60b397..f90737f 100644
|
|
--- a/src/be20_api/dfxml_cpp/src/dfxml_configure.m4
|
|
+++ b/src/be20_api/dfxml_cpp/src/dfxml_configure.m4
|
|
@@ -33,7 +33,19 @@ AM_COND_IF([FOUND_GIT],
|
|
[AC_MSG_WARN([git not found])])
|
|
|
|
# Do we have the CPUID instruction?
|
|
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define cpuid(id) __asm__( "cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(id), "b"(0), "c"(0), "d"(0))]], [[unsigned long eax, ebx, ecx, edx;cpuid(0);]])],[have_cpuid=yes],[have_cpuid=no])
|
|
+# Based on https://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html
|
|
+AC_RUN_IFELSE([AC_LANG_PROGRAM([int eax, ebx, ecx, edx;], [
|
|
+ __asm__ __volatile__ ("xchg %%ebx, %1\n"
|
|
+ "cpuid\n"
|
|
+ "xchg %%ebx, %1\n"
|
|
+ : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
|
|
+ : "a" (0), "2" (0));
|
|
+ return 0;
|
|
+])],
|
|
+[have_cpuid=yes],
|
|
+[have_cpuid=no],
|
|
+[have_cpuid=no])
|
|
+AC_MSG_NOTICE([have_cpuid: $have_cpuid])
|
|
if test "$have_cpuid" = yes; then
|
|
AC_DEFINE(HAVE_ASM_CPUID, 1, [define to 1 if __asm__ CPUID is available])
|
|
fi
|
|
--
|
|
2.41.0
|
|
|