From b461000795f3c52beed13f90498c2cf80d1a839e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 13 Aug 2014 22:46:08 +0300 Subject: [PATCH] Fixed crash on opening 7z/LZMA archives, x64 only With Position Independent Code (PIC) enabled on x64, non-MSVC compilers use wrong inline assembly for cpuid --- lzma/C/CpuArch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lzma/C/CpuArch.c b/lzma/C/CpuArch.c index 425d18923..d6ab3f7f8 100644 --- a/lzma/C/CpuArch.c +++ b/lzma/C/CpuArch.c @@ -70,9 +70,9 @@ static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d) *c = c2; *d = d2; - #elif __PIC__ + #elif defined __PIC__ && defined __i386__ - /* GCC or Clang WITH position-independent code generation */ + /* GCC or Clang WITH position-independent code generation, i386 only */ __asm__ __volatile__ ( "xchgl %%ebx, %1\n" @@ -86,7 +86,7 @@ static void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d) #else - /* GCC or Clang WITHOUT position-independent code generation */ + /* GCC or Clang WITHOUT position-independent code generation, or x86_64 */ __asm__ __volatile__ ( "cpuid"