ports/181811: [patch] security/libgcrypt inline assembler error at clang on ARM
Chie Taguchi
taguchi.ch at gmail.com
Wed Sep 4 14:00:02 UTC 2013
>Number: 181811
>Category: ports
>Synopsis: [patch] security/libgcrypt inline assembler error at clang on ARM
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Sep 04 14:00:02 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Chie Taguchi
>Release: FreeBSD 10.0-CURRENT
>Organization:
>Environment:
FreeBSD RPI 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r255179: Wed Sep 4 01:26:29 JST 2013 user at arty:/usr/home/user/crochet-freebsd/work/obj/arm.armv6/usr/src.arm/sys/RPI-B-ELY arm
>Description:
security/libgcrypt have a compiling issue at clang on ARM. it already PRed
ports/181365, and it works around to USE_GCC=4.2+ now.
therefore i make a patch to fix inline assembler error at clang on ARM.
and i test this patch to run tests/benchmark.
error message is following:
===> Building for libgcrypt-1.5.2
make all-recursive
Making all in compat
Making all in mpi
/bin/sh /usr/local/bin/libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I..
-I../src -I../src -I/usr/local/include -O -pipe -std=gnu89 -fvisibility=hidden
-Wall -MT mpih-div.lo -MD -MP -MF .deps/mpih-div.Tpo -c -o mpih-div.lo mpih-div.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I/usr/local/include
-O -pipe -std=gnu89 -fvisibility=hidden -Wall -MT mpih-div.lo -MD -MP -MF
.deps/mpih-div.Tpo -c mpih-div.c -fPIC -DPIC -o .libs/mpih-div.o
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring an
l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:150:13: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_q, _ql, (nh), (di));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
./longlong.h:230:25: note: expanded from macro 'umul_ppmm'
: "=&r" ((USItype)(xh)),
^
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring an
l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:150:17: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_q, _ql, (nh), (di));
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
./longlong.h:231:24: note: expanded from macro 'umul_ppmm'
"=r" ((USItype)(xl))
^
mpih-div.c:98:3: error: invalid % escape in inline assembly string
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:150:2: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_q, _ql, (nh), (di));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./longlong.h:228:14: note: expanded from macro 'umul_ppmm'
__asm__ ("%@ Inlined umul_ppmm\n"
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:152:13: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_xh, _xl, _q, (d));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
./longlong.h:230:25: note: expanded from macro 'umul_ppmm'
: "=&r" ((USItype)(xh)),
^
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:152:18: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_xh, _xl, _q, (d));
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
./longlong.h:231:24: note: expanded from macro 'umul_ppmm'
"=r" ((USItype)(xl))
^
mpih-div.c:98:3: error: invalid % escape in inline assembly string
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:152:2: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_xh, _xl, _q, (d));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./longlong.h:228:14: note: expanded from macro 'umul_ppmm'
__asm__ ("%@ Inlined umul_ppmm\n"
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:153:14: note: expanded from macro 'UDIV_QRNND_PREINV'
sub_ddmmss (_xh, _r, (nh), (nl), _xh, _xl);
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./longlong.h:200:23: note: expanded from macro 'sub_ddmmss'
: "=r" ((USItype)(sh)),
^
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:153:19: note: expanded from macro 'UDIV_QRNND_PREINV'
sub_ddmmss (_xh, _r, (nh), (nl), _xh, _xl);
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
./longlong.h:201:24: note: expanded from macro 'sub_ddmmss'
"=&r" ((USItype)(sl))
^
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:155:18: note: expanded from macro 'UDIV_QRNND_PREINV'
sub_ddmmss (_xh, _r, _xh, _r, 0, (d));
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
./longlong.h:200:23: note: expanded from macro 'sub_ddmmss'
: "=r" ((USItype)(sh)),
^
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:155:23: note: expanded from macro 'UDIV_QRNND_PREINV'
sub_ddmmss (_xh, _r, _xh, _r, 0, (d));
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
./longlong.h:201:24: note: expanded from macro 'sub_ddmmss'
"=&r" ((USItype)(sl))
^
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:158:15: note: expanded from macro 'UDIV_QRNND_PREINV'
sub_ddmmss (_xh, _r, _xh, _r, 0, (d));
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
./longlong.h:200:23: note: expanded from macro 'sub_ddmmss'
: "=r" ((USItype)(sh)),
^
mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:158:20: note: expanded from macro 'UDIV_QRNND_PREINV'
sub_ddmmss (_xh, _r, _xh, _r, 0, (d));
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
./longlong.h:201:24: note: expanded from macro 'sub_ddmmss'
"=&r" ((USItype)(sl))
^
mpih-div.c:104:6: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:150:13: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_q, _ql, (nh), (di));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
./longlong.h:230:25: note: expanded from macro 'umul_ppmm'
: "=&r" ((USItype)(xh)),
^
mpih-div.c:104:6: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:150:17: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_q, _ql, (nh), (di));
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
./longlong.h:231:24: note: expanded from macro 'umul_ppmm'
"=r" ((USItype)(xl))
^
mpih-div.c:104:6: error: invalid % escape in inline assembly string
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:150:2: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_q, _ql, (nh), (di));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./longlong.h:228:14: note: expanded from macro 'umul_ppmm'
__asm__ ("%@ Inlined umul_ppmm\n"
mpih-div.c:104:6: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:152:13: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_xh, _xl, _q, (d));
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
./longlong.h:230:25: note: expanded from macro 'umul_ppmm'
: "=&r" ((USItype)(xh)),
^
mpih-div.c:104:6: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:152:18: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_xh, _xl, _q, (d));
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
./longlong.h:231:24: note: expanded from macro 'umul_ppmm'
"=r" ((USItype)(xl))
^
mpih-div.c:104:6: error: invalid % escape in inline assembly string
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:152:2: note: expanded from macro 'UDIV_QRNND_PREINV'
umul_ppmm (_xh, _xl, _q, (d));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./longlong.h:228:14: note: expanded from macro 'umul_ppmm'
__asm__ ("%@ Inlined umul_ppmm\n"
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mpih-div.c:104:6: error: invalid use of a cast in a inline asm context requiring
an l-value: remove the cast or build with -fheinous-gnu-extensions
UDIV_QRNND_PREINV(dummy, r, r,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mpi-internal.h:153:14: note: expanded from macro 'UDIV_QRNND_PREINV'
sub_ddmmss (_xh, _r, (nh), (nl), _xh, _xl);
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./longlong.h:200:23: note: expanded from macro 'sub_ddmmss'
: "=r" ((USItype)(sh)),
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
*** [mpih-div.lo] Error code 1
make: stopped in /usr/ports/security/libgcrypt/work/libgcrypt-1.5.2/mpi
1 error
make: stopped in /usr/ports/security/libgcrypt/work/libgcrypt-1.5.2/mpi
*** [all-recursive] Error code 1
make: stopped in /usr/ports/security/libgcrypt/work/libgcrypt-1.5.2
1 error
make: stopped in /usr/ports/security/libgcrypt/work/libgcrypt-1.5.2
*** [all] Error code 2
make: stopped in /usr/ports/security/libgcrypt/work/libgcrypt-1.5.2
1 error
make: stopped in /usr/ports/security/libgcrypt/work/libgcrypt-1.5.2
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1
Stop.
make: stopped in /usr/ports/security/libgcrypt
*** Error code 1
>How-To-Repeat:
comment out following lines in libgcrypt/Makefie:
.elif ${ARCH} == "armv6"
USE_GCC=4.2+
and run "make install" on ARM.
>Fix:
Patch attached with submission follows:
diff -urN libgcrypt.orig/Makefile libgcrypt/Makefile
--- libgcrypt.orig/Makefile 2013-09-03 21:38:02.000000000 +0900
+++ libgcrypt/Makefile 2013-09-03 21:39:46.000000000 +0900
@@ -36,9 +36,6 @@
BROKEN= will not compile. See pr ports/166388
.endif
-.elif ${ARCH} == "armv6"
-USE_GCC=4.2+
-
.elif ${ARCH} == "i386"
.if (${OSVERSION} < 900033)
CONFIGURE_ARGS+= --disable-aesni-support
diff -urN libgcrypt.orig/files/patch-mpi-longlong.h libgcrypt/files/patch-mpi-longlong.h
--- libgcrypt.orig/files/patch-mpi-longlong.h 2013-09-03 21:35:50.000000000 +0900
+++ libgcrypt/files/patch-mpi-longlong.h 2013-09-03 20:51:48.000000000 +0900
@@ -1,5 +1,42 @@
---- ./mpi/longlong.h.orig 2010-02-22 19:04:43.000000000 +0900
-+++ ./mpi/longlong.h 2010-11-01 18:25:34.000000000 +0900
+--- ./mpi/longlong.h.orig 2013-09-03 18:52:04.000000000 +0900
++++ ./mpi/longlong.h 2013-09-03 20:46:40.000000000 +0900
+@@ -188,8 +188,8 @@
+ #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("adds %1, %4, %5\n" \
+ "adc %0, %2, %3" \
+- : "=r" ((USItype)(sh)), \
+- "=&r" ((USItype)(sl)) \
++ : "=r" (sh), \
++ "=&r" (sl) \
+ : "%r" ((USItype)(ah)), \
+ "rI" ((USItype)(bh)), \
+ "%r" ((USItype)(al)), \
+@@ -197,8 +197,8 @@
+ #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("subs %1, %4, %5\n" \
+ "sbc %0, %2, %3" \
+- : "=r" ((USItype)(sh)), \
+- "=&r" ((USItype)(sl)) \
++ : "=r" (sh), \
++ "=&r" (sl) \
+ : "r" ((USItype)(ah)), \
+ "rI" ((USItype)(bh)), \
+ "r" ((USItype)(al)), \
+@@ -225,10 +225,10 @@
+ : "r0", "r1", "r2")
+ #else
+ #define umul_ppmm(xh, xl, a, b) \
+- __asm__ ("%@ Inlined umul_ppmm\n" \
+- "umull %r1, %r0, %r2, %r3" \
+- : "=&r" ((USItype)(xh)), \
+- "=r" ((USItype)(xl)) \
++ __asm__ ("@ Inlined umul_ppmm\n" \
++ "umull %1, %0, %2, %3" \
++ : "=&r" (xh), \
++ "=r" (xl) \
+ : "r" ((USItype)(a)), \
+ "r" ((USItype)(b)) \
+ : "r0", "r1")
@@ -437,8 +437,8 @@
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("addl %5,%1\n" \
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list