Asm portability problems on OS X and Solaris

Jussi Kivilinna jussi.kivilinna at iki.fi
Tue Jul 19 12:48:57 CEST 2016


On 19.07.2016 11:43, Jussi Kivilinna wrote:
> On 18.07.2016 21:43, Werner Koch wrote:
>> Hi,
>>
>> I got reports about two portability bug reports for 1.7.2.
>>
>> The first is on an OS X 10.7.5:
>>
>>   CFLAGS=-m32 ./configure --disable-asm && make all check
>>   ...
>>   libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src
>>   -I/usr/local/include -m32 -Wall -MT rijndael-aesni.lo -MD -MP -MF
>>   .deps/rijndael-aesni.Tpo -c rijndael-aesni.c  -fno-common -DPIC -o
>>   .libs/rijndael-aesni.o
>>   rijndael-aesni.c: In function 'do_aesni_ctr_4':
>>   rijndael-aesni.c:817:3: error: 'asm' operand has impossible constraints
>>      asm volatile (/* detect if 8-bit carry handling is needed */
>>      ^
>>
>> So, --disable-asm is not honored in this case.
> 
> Currently --disable-asm only disables MPI assembly modules.
> 
> Configure options --disable-aesni-support and --disable-pclmul-support can
> be used to disable AESNI and PCLMUL assembly parts.
> 
>> A similar problem exists
>> on OpenIndiana with gcc 4.9:
>>
>>   crc-intel-pclmul.c: In function 'crc32_less_than_16':
>>   crc-intel-pclmul.c:747:7: error: 'asm' operand has impossible constraints
>>          asm volatile ("movd %[crc], %%xmm0\n\t"
> 
> GCC is failing to allocate register constraints for inline assembly blocks in
> these cases. In these two asm blocks, quite many memory operands are used and
> with PIC enabled, these might be requiring extra registers. So, these
> blocks need be split to ease register pressure.
> 

I managed to reproduce rijndael-aesni.c case on linux/gcc/i386 with GCC 4.7 and
4.8. GCC 4.9 and later are not affected. I'll post fix soon. Bug tracker had
issue for this on gentoo:
 https://bugs.gnupg.org/gnupg/issue2325

I also made similar change for crc-intel-pclmul.c but was unable to reproduce
the issue (on linux).

-Jussi



More information about the Gcrypt-devel mailing list