32 bit cross build fails on asm code in gcrypt 1.9.0
Closed, ResolvedPublic

Description

A user reported this on gnupg-users:

just tried to cross-build 32 bit libgcrypt-1.9.0 on a 64 bit machine
and getting:

----8<----
libtool: compile:  gcc -m32 -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I../mpi -I../mpi -I/usr/include -I/usr/Xorg/include -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -c rijndael-aesni.c  -fPIC -DPIC -o .libs/rijndael-aesni.o
rijndael-aesni.c: In function 'aesni_ocb_enc':
rijndael-aesni.c:2815:7: error: 'asm' operand has impossible constraints
 2815 |       asm volatile ("pxor   %[tmpbuf0],%%xmm1\n\t"
      |       ^~~
make[3]: *** [Makefile:1355: rijndael-aesni.lo] Error 1
make[3]: Leaving directory '/home/balducci/tmp/install-us-d/libgcrypt-1.9.0.d/libgcrypt-1.9.0/cipher'
---->8----

No problem whatsoever building for native 64 bit.

I get the same error (always for the 32 bit cross build) on two
machines with different cpu's (both AMD, though)

32 bit build succeeds if I run with --disable-asm, but since it has worked
flawlessly for ages (without --disable-asm), I'm just wondering if asm is
not supported any longer for this cross build, or if 1.9.0 needs some
fix (or if I am missing something obvious, of course)

I haven't changed anything in my installation script (since 1.4.6).

Configuring with:

--build=x86_64-unknown-linux-gnu
--host=i686-pc-linux-gnu

werner created this task.Jan 20 2021, 1:30 PM

Thanks for report. I reproduced this by building i386 with optimizations disabled "-O0" (gcc 10). With normal optimization level such as "-O2", the issue does not appear.

You probably define CFLAGS=-m32 in your installation script for 32-bit build. I'd try with CFLAGS="-O2 -m32".

You probably define CFLAGS=-m32 in your installation script for 32-bit build. I'd try with CFLAGS="-O2 -m32".

yes, I run with -m32

and I can now confirm that the ABI32 build is fixed:

  1. either by adding -O2 optimization
  2. or by applying the patch you attached above

thanks a lot for spending time on this

werner triaged this task as Normal priority.Jan 21 2021, 10:32 AM
werner changed the task status from Open to Testing.
gniibe moved this task from Backlog to For 1.9 on the libgcrypt board.Jan 26 2021, 4:46 AM
werner changed the status of subtask T5259: Release Libgcrypt 1.9.1 from Open to Testing.
werner closed this task as Resolved.Wed, Feb 17, 8:26 AM
werner claimed this task.