thepaul/crcutil

FTBFS@i686 (1/2): "PIC register clobbered by '%ebx' in 'asm'" :: please use <cpuid.h>

GoogleCodeExporter opened this issue · 2 comments

On i686 compilation fails as follows:

libtool: compile: g++ -DHAVE_CONFIG_H -I. -D_FORTIFY_SOURCE=2 -mcrc32 -msse2 -DCRCUTIL_USE_ASM=0 -DCRCUTIL_USE_MM_CRC32=1 -Wall -msse2 -Icode -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -c code/multiword_128_64_gcc_amd64_sse2.cc -fPIE -o code/multiword_128_64_gcc_amd64_sse2.o >/dev/null 2>&1
code/crc32c_sse4.cc: In static member function 'static bool crcutil::Crc32cSSE4::IsSSE42Available()':
code/crc32c_sse4.cc:331:4: error: PIC register clobbered by '%ebx' in 'asm'
);
^
Makefile:685: recipe for target 'code/crc32c_sse4.lo' failed


It seems to be because someone neglected to use "#include <cpuid.h>" as 
commented in "code/crc32c_sse4.cc":

> // Not using "cpuid.h" intentionally: it is missing from too many 
installations.

However "cpuid.h" is part of GCC since 4.4 (or earlier) hence it should be 
universally available. Please consider using "cpuid.h" instead of custom 
workaround(s) to avoid that kind of problems.
I prepared the attached patch that seems to fix the problem (tests are passing) 
but I'm far from being confident in inline asm so my patch needs review from 
someone who really understands how it should work.

Original issue reported on code.google.com by only...@gmail.com on 8 Dec 2014 at 4:24

Original comment by only...@gmail.com on 8 Dec 2014 at 4:31

Original comment by only...@gmail.com on 27 Feb 2015 at 7:17

Attachments: