lua-bit32: new package
[buildroot-gz.git] / package / libfreeimage / 0002-fix-cpuid-x86.patch
blob98b0e9c6e34a08714fad0b8d549020c6b201f7a2
1 Fix build issue caused by invalid register usage on x86
3 Patch taken from https://github.com/openexr/openexr/issues/128.
5 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
7 Index: b/Source/OpenEXR/IlmImf/ImfSystemSpecific.cpp
8 ===================================================================
9 --- a/Source/OpenEXR/IlmImf/ImfSystemSpecific.cpp
10 +++ b/Source/OpenEXR/IlmImf/ImfSystemSpecific.cpp
11 @@ -40,21 +40,19 @@
13 namespace {
14 #if defined(IMF_HAVE_SSE2) && defined(__GNUC__)
16 +#include <cpuid.h>
17 // Helper functions for gcc + SSE enabled
18 - void cpuid(int n, int &eax, int &ebx, int &ecx, int &edx)
19 + void cpuid(unsigned int n, unsigned int &eax, unsigned int &ebx,
20 + unsigned int &ecx, unsigned int &edx)
22 - __asm__ __volatile__ (
23 - "cpuid"
24 - : /* Output */ "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
25 - : /* Input */ "a"(n)
26 - : /* Clobber */);
27 + __get_cpuid(n, &eax, &ebx, &ecx, &edx);
30 #else // IMF_HAVE_SSE2 && __GNUC__
32 // Helper functions for generic compiler - all disabled
33 - void cpuid(int n, int &eax, int &ebx, int &ecx, int &edx)
34 + void cpuid(unsigned int n, unsigned int &eax, unsigned int &ebx,
35 + unsigned int &ecx, unsigned int &edx)
37 eax = ebx = ecx = edx = 0;
39 @@ -64,7 +62,7 @@
41 #ifdef OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX
43 - void xgetbv(int n, int &eax, int &edx)
44 + void xgetbv(unsigned int n, unsigned int &eax, unsigned int &edx)
46 __asm__ __volatile__ (
47 "xgetbv"
48 @@ -75,7 +73,7 @@
50 #else // OPENEXR_IMF_HAVE_GCC_INLINE_ASM_AVX
52 - void xgetbv(int n, int &eax, int &edx)
53 + void xgetbv(unsigned int n, unsigned int &eax, unsigned int &edx)
55 eax = edx = 0;
57 @@ -94,8 +92,8 @@
58 f16c(false)
60 bool osxsave = false;
61 - int max = 0;
62 - int eax, ebx, ecx, edx;
63 + unsigned int max = 0;
64 + unsigned int eax, ebx, ecx, edx;
66 cpuid(0, max, ebx, ecx, edx);
67 if (max > 0)