Error compiling with cross-compiler

119 views
Skip to first unread message

ronwa...@gmail.com

unread,
Jun 13, 2014, 11:01:19 AM6/13/14
to lib...@googlegroups.com
Hi all -

I'm attempting to compile for 64-bit windows from my linux, and am getting this:

x86_64-w64-mingw32-gcc -D FP_64BIT -D TFM_X86_64 -Wall -W -Wshadow -Isrc/headers -O3 -funroll-loops -fomit-frame-pointer   -c -o src/mont/fp_montgomery_reduce.o src/mont/fp_montgomery_reduce.c
/tmp/ccF312V4.s: Assembler messages:
/tmp/ccF312V4.s:95: Error: incorrect register `%r9d' used with `q' suffix
/tmp/ccF312V4.s:99: Error: operand type mismatch for `add'
/tmp/ccF312V4.s:102: Error: operand type mismatch for `movq'
/tmp/ccF312V4.s:105: Error: incorrect register `%r9d' used with `q' suffix
/tmp/ccF312V4.s:109: Error: operand type mismatch for `add'
(etc)

The other code up to there is fine.

I also ahve this problem compiling on Mac OS/X trying to do 32bit compile:

gcc-4.8 -m32 -DTFM_X86 -Wall -W -Wshadow -Isrc/headers -O3 -funroll-loops -fomit-frame-pointer   -c -o src/mul/fp_mul_comba.o src/mul/fp_mul_comba.c
src/mul/fp_mul_comba.c: In function 'fp_mul_comba':
src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
 asm(                                                      \
 ^
src/mul/fp_mul_comba.c:349:11: note: in expansion of macro 'MULADD'
           MULADD(*tmpx++, *tmpy--);
           ^
src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints

Any suggestions?

Best regards,
Ron

libtom

unread,
Jun 14, 2014, 11:53:19 AM6/14/14
to lib...@googlegroups.com, ronwa...@gmail.com
Hi,

please try out the updated version from github and tell me if that fixes your problem

Steffen

ronwa...@gmail.com

unread,
Jun 14, 2014, 2:04:26 PM6/14/14
to lib...@googlegroups.com, ronwa...@gmail.com
It works great for the mingw, both 64 and 32 bit, thanks.

However, on OS/X I still get this problem when I do "CC='gcc-4.8 -m32' make -B"

src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
 asm(                                                      \
 ^
src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
           MULADD(*tmpx++, *tmpy--);
           ^
src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
 asm(                                                      \
 ^
src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
           MULADD(*tmpx++, *tmpy--);
           ^
src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints

Ron Aaron

unread,
Jun 14, 2014, 11:33:55 PM6/14/14
to lib...@googlegroups.com
Right; 64 bit is fine; my attempt with "-m32" is what failed.

On 06/15/2014 12:19 AM, Steffen Jaeckel wrote:
> On 14.06.2014 20:04, ronwa...@gmail.com wrote:
>> It works great for the mingw, both 64 and 32 bit, thanks.
>>
>> However, on OS/X I still get this problem when I do "CC='gcc-4.8 -m32'
>> make -B"
>>
>> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
>> asm( \
>> ^
>> src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
>> MULADD(*tmpx++, *tmpy--);
>> ^
>> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
>> asm( \
>> ^
>> src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
>> MULADD(*tmpx++, *tmpy--);
>> ^
>> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
>>
> Mh, I can't reproduce
>
>> $ gcc-4.8 -v
>> Using built-in specs.
>> COLLECT_GCC=gcc-4.8
>> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
>> Target: x86_64-linux-gnu
>> Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.1-2ubuntu1~13.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-a
> bi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>> Thread model: posix
>> gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~13.04)
> Steffen


Ron Aaron

unread,
Jun 15, 2014, 9:56:47 AM6/15/14
to Steffen Jaeckel, lib...@googlegroups.com
And with tomcrypt and window 64:

x86_64-w64-mingw32-gcc -D FP_64BIT -D TFM_X86_64 -DUSE_TFM -c
-I./testprof/ -I./src/headers/ -Wall -Wsign-compare -W -Wshadow
-Wno-unused-parameter -DLTC_SOURCE -DTFM_DESC -I
../tomsfastmath/src/headers -O3 -funroll-loops -fomit-frame-pointer -c
-o src/hashes/sha2/sha512.o src/hashes/sha2/sha512.c
/tmp/ccyWkL96.s: Assembler messages:
/tmp/ccyWkL96.s:204: Error: incorrect register `%ecx' used with `q' suffix
/tmp/ccyWkL96.s:207: Error: incorrect register `%ebx' used with `q' suffix


(the tomsfastmath is the latest git, so is tomcrypt)

On 06/15/2014 12:19 AM, Steffen Jaeckel wrote:
> On 14.06.2014 20:04, ronwa...@gmail.com wrote:
>> It works great for the mingw, both 64 and 32 bit, thanks.
>>
>> However, on OS/X I still get this problem when I do "CC='gcc-4.8 -m32'
>> make -B"
>>
>> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
>> asm( \
>> ^
>> src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
>> MULADD(*tmpx++, *tmpy--);
>> ^
>> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
>> asm( \
>> ^
>> src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
>> MULADD(*tmpx++, *tmpy--);
>> ^
>> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
>>

Ron Aaron

unread,
Jun 15, 2014, 12:39:37 PM6/15/14
to Steffen Jaeckel, lib...@googlegroups.com
Yep; switching to develop seems to fix the problem, thanks!

On 06/15/2014 06:22 PM, Steffen Jaeckel wrote:
>
> which branch of tomcrypt do you use?
> if you're using master - please try out develop
>
> it seems to be the same issue as tfm had, but that has already been fixed
>
> also you don't need the "-D FP_64BIT -D TFM_X86_64", that must be
> automatically generated but that's less important
>
>
> Steffen

Steffen Jaeckel

unread,
Jun 20, 2014, 12:52:31 PM6/20/14
to Ron Aaron, lib...@googlegroups.com
On 15.06.2014 15:56, Ron Aaron wrote:
> And with tomcrypt and window 64:
>
> x86_64-w64-mingw32-gcc -D FP_64BIT -D TFM_X86_64 -DUSE_TFM -c
> -I./testprof/ -I./src/headers/ -Wall -Wsign-compare -W -Wshadow
> -Wno-unused-parameter -DLTC_SOURCE -DTFM_DESC -I
> ../tomsfastmath/src/headers -O3 -funroll-loops -fomit-frame-pointer -c
> -o src/hashes/sha2/sha512.o src/hashes/sha2/sha512.c
> /tmp/ccyWkL96.s: Assembler messages:
> /tmp/ccyWkL96.s:204: Error: incorrect register `%ecx' used with `q' suffix
> /tmp/ccyWkL96.s:207: Error: incorrect register `%ebx' used with `q' suffix
>
>
> (the tomsfastmath is the latest git, so is tomcrypt)

which branch of tomcrypt do you use?
if you're using master - please try out develop

it seems to be the same issue as tfm had, but that has already been fixed

also you don't need the "-D FP_64BIT -D TFM_X86_64", that must be
automatically generated but that's less important


Steffen
--
Steffen Jaeckel - s_ja...@gmx.de
GnuPG fingerprint: C438 6A23 7ED4 3A47 5541 B942 7B2C D0DD 4BCF F59B
jabber: jae...@jabber.ccc.de 76FA2050 DC582095 FC530BFE 25EE4698 455650F6

Steffen Jaeckel

unread,
Jun 20, 2014, 12:52:31 PM6/20/14
to lib...@googlegroups.com
1. please read the rules and avoid top-posting
2. "-m32" is what I tested

> $ CC="gcc-4.8 -m32" make -j3 -B 1>gcc1.txt 2>gcc2.txt
> $ cat gcc2.txt | grep -i error | wc -l
> 0

Steffen Jaeckel

unread,
Jun 20, 2014, 12:52:31 PM6/20/14
to lib...@googlegroups.com, ronwa...@gmail.com
On 14.06.2014 20:04, ronwa...@gmail.com wrote:
> It works great for the mingw, both 64 and 32 bit, thanks.
>
> However, on OS/X I still get this problem when I do "CC='gcc-4.8 -m32'
> make -B"
>
> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
> asm( \
> ^
> src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
> MULADD(*tmpx++, *tmpy--);
> ^
> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
> asm( \
> ^
> src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
> MULADD(*tmpx++, *tmpy--);
> ^
> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
>

Mh, I can't reproduce

> $ gcc-4.8 -v
> Using built-in specs.
> COLLECT_GCC=gcc-4.8
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.1-2ubuntu1~13.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-a
bi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~13.04)

Steffen

ronwa...@gmail.com

unread,
Jul 20, 2014, 8:17:34 AM7/20/14
to lib...@googlegroups.com, ronwa...@gmail.com
Still the same, using the development code:

gcc-4.8 -Wall -W -Wshadow -Isrc/headers -m32 -O3 -funroll-loops -fomit-frame-pointer   -c -o src/mul/fp_mul_comba.o src/mul/fp_mul_comba.c
src/mul/fp_mul_comba.c: In function 'fp_mul_comba':
src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
 asm(                                                      \
 ^
src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
           MULADD(*tmpx++, *tmpy--);
           ^
src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
 asm(                                                      \
 ^
src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
           MULADD(*tmpx++, *tmpy--);

Steffen Jaeckel

unread,
Jul 20, 2014, 10:10:47 AM7/20/14
to lib...@googlegroups.com, ronwa...@gmail.com
On 20.07.2014 14:17, ronwa...@gmail.com wrote:
> Still the same, using the development code:
>
> gcc-4.8 -Wall -W -Wshadow -Isrc/headers *-m32 *-O3 -funroll-loops
> -fomit-frame-pointer -c -o src/mul/fp_mul_comba.o src/mul/fp_mul_comba.c
> src/mul/fp_mul_comba.c: In function 'fp_mul_comba':
> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
> asm( \
> ^
> src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
> MULADD(*tmpx++, *tmpy--);
> ^
> src/mul/fp_mul_comba.c:50:1: error: 'asm' operand has impossible constraints
> asm( \
> ^
> src/mul/fp_mul_comba.c:352:11: note: in expansion of macro 'MULADD'
> MULADD(*tmpx++, *tmpy--);
>

Please try again, I've pushed some changes I had locally and forgot to
publish.

But please be aware of https://github.com/libtom/tomsfastmath/issues/5
which affects the montgomery reduction...

Larry built a tool to verify that issue at
https://github.com/buggywhip/LibTom-TFM-scratch

ronwa...@gmail.com

unread,
Jul 20, 2014, 2:06:21 PM7/20/14
to lib...@googlegroups.com, ronwa...@gmail.com, s_ja...@gmx.de
On Sunday, July 20, 2014 5:10:47 PM UTC+3, Steffen Jaeckel wrote:

Please try again, I've pushed some changes I had locally and forgot to
publish.

But please be aware of https://github.com/libtom/tomsfastmath/issues/5
which affects the montgomery reduction...

Thanks.  My latest effort (after updating from git):

gcc-4.9 -Wall -W -Wshadow -Isrc/headers -m32 -O3 -funroll-loops -fomit-frame-pointer   -c -o src/mul/fp_mul_comba.o src/mul/fp_mul_comba.c
Reply all
Reply to author
Forward
0 new messages