From nobody@FreeBSD.org  Sun Jul 17 12:03:47 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A441C1065676
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 17 Jul 2011 12:03:47 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 8A7B08FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 17 Jul 2011 12:03:47 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p6HC3lLe010875
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 17 Jul 2011 12:03:47 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p6HC3lmf010869;
	Sun, 17 Jul 2011 12:03:47 GMT
	(envelope-from nobody)
Message-Id: <201107171203.p6HC3lmf010869@red.freebsd.org>
Date: Sun, 17 Jul 2011 12:03:47 GMT
From: Dimitry Andric <dim@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Fix security/libgcrypt 1.5.0 build with clang
X-Send-Pr-Version: www-3.1
X-GNATS-Notify: umq@ueo.co.jp

>Number:         158994
>Category:       ports
>Synopsis:       Fix security/libgcrypt 1.5.0 build with clang
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    dim
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 17 12:10:10 UTC 2011
>Closed-Date:    Fri Jul 22 08:52:28 UTC 2011
>Last-Modified:  Fri Jul 22 08:52:28 UTC 2011
>Originator:     Dimitry Andric
>Release:        9.0-CURRENT
>Organization:
The FreeBSD Project
>Environment:
FreeBSD vm-dvs-dimtest1.home.andric.com 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r224068+3cd8793-dirty: Sat Jul 16 02:01:06 CEST 2011     dim@vm-dvs-dimtest1.home.andric.com:/usr/obj/home/dim/src/freebsd/head/sys/GENERIC  i386
>Description:
Building security/libgcrypt 1.5.0 with clang results in errors similar
to the following:

rijndael.c:846:46: error: ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', 'cmpl', or 'cmpq')
                "movdqa 0xa0(%%esi), %%xmm1\n\t"
                                             ^
<inline asm>:24:2: note: instantiated into assembly here
        cmp $10, -80(%ebp)
        ^

This is because the 'cmp' instruction lacks a type suffix, and is thus
ambiguous.  I will send a fix upstream, but please apply it locally for
now, to let the port build with clang.

>How-To-Repeat:
CC=clang CXX=clang++ make -C /usr/ports/security/libgcrypt install

>Fix:


Patch attached with submission follows:

Index: security/libgcrypt/files/patch-cipher-rijndael.c
===================================================================
RCS file: security/libgcrypt/files/patch-cipher-rijndael.c
diff -N security/libgcrypt/files/patch-cipher-rijndael.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ security/libgcrypt/files/patch-cipher-rijndael.c	16 Jul 2011 20:31:25 -0000
@@ -0,0 +1,61 @@
+--- cipher/rijndael.c.orig	2011-02-22 15:57:59.000000000 +0100
++++ cipher/rijndael.c	2011-07-16 22:26:35.000000000 +0200
+@@ -844,13 +844,13 @@ do_aesni_cfb (const RIJNDAEL_context *ct
+                 "movdqa 0x90(%%esi), %%xmm1\n\t"
+                 aesenc_xmm1_xmm0
+                 "movdqa 0xa0(%%esi), %%xmm1\n\t"
+-                "cmp $10, %[rounds]\n\t"
++                "cmpq $10, %[rounds]\n\t"
+                 "jz .Lenclast%=\n\t"
+                 aesenc_xmm1_xmm0
+                 "movdqa 0xb0(%%esi), %%xmm1\n\t"
+                 aesenc_xmm1_xmm0
+                 "movdqa 0xc0(%%esi), %%xmm1\n\t"
+-                "cmp $12, %[rounds]\n\t"
++                "cmpq $12, %[rounds]\n\t"
+                 "jz .Lenclast%=\n\t"
+                 aesenc_xmm1_xmm0
+                 "movdqa 0xd0(%%esi), %%xmm1\n\t"
+@@ -862,7 +862,7 @@ do_aesni_cfb (const RIJNDAEL_context *ct
+                 "movdqu %[src], %%xmm1\n\t"      /* Save input.  */
+                 "pxor %%xmm1, %%xmm0\n\t"        /* xmm0 = input ^ IV  */
+ 
+-                "cmp $1, %[decrypt]\n\t"
++                "cmpq $1, %[decrypt]\n\t"
+                 "jz .Ldecrypt_%=\n\t"
+                 "movdqa %%xmm0, %[iv]\n\t"       /* [encrypt] Store IV.  */
+                 "jmp .Lleave_%=\n"
+@@ -923,13 +923,13 @@ do_aesni_ctr (const RIJNDAEL_context *ct
+                 "movdqa 0x90(%%esi), %%xmm1\n\t"
+                 aesenc_xmm1_xmm0
+                 "movdqa 0xa0(%%esi), %%xmm1\n\t"
+-                "cmp $10, %[rounds]\n\t"
++                "cmpq $10, %[rounds]\n\t"
+                 "jz .Lenclast%=\n\t"
+                 aesenc_xmm1_xmm0
+                 "movdqa 0xb0(%%esi), %%xmm1\n\t"
+                 aesenc_xmm1_xmm0
+                 "movdqa 0xc0(%%esi), %%xmm1\n\t"
+-                "cmp $12, %[rounds]\n\t"
++                "cmpq $12, %[rounds]\n\t"
+                 "jz .Lenclast%=\n\t"
+                 aesenc_xmm1_xmm0
+                 "movdqa 0xd0(%%esi), %%xmm1\n\t"
+@@ -1050,7 +1050,7 @@ do_aesni_ctr_4 (const RIJNDAEL_context *
+                 aesenc_xmm1_xmm3
+                 aesenc_xmm1_xmm4
+                 "movdqa 0xa0(%%esi), %%xmm1\n\t"
+-                "cmp $10, %[rounds]\n\t"
++                "cmpq $10, %[rounds]\n\t"
+                 "jz .Lenclast%=\n\t"
+                 aesenc_xmm1_xmm0
+                 aesenc_xmm1_xmm2
+@@ -1062,7 +1062,7 @@ do_aesni_ctr_4 (const RIJNDAEL_context *
+                 aesenc_xmm1_xmm3
+                 aesenc_xmm1_xmm4
+                 "movdqa 0xc0(%%esi), %%xmm1\n\t"
+-                "cmp $12, %[rounds]\n\t"
++                "cmpq $12, %[rounds]\n\t"
+                 "jz .Lenclast%=\n\t"
+                 aesenc_xmm1_xmm0
+                 aesenc_xmm1_xmm2


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->dim 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Jul 17 12:10:21 UTC 2011 
Responsible-Changed-Why:  
Submitter has GNATS access (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158994 
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Sun Jul 17 12:10:26 UTC 2011 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158994 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: umq@ueo.co.jp
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/158994: Fix security/libgcrypt 1.5.0 build with clang
Date: Sun, 17 Jul 2011 12:10:24 UT

 Maintainer of security/libgcrypt,
 
 Please note that PR ports/158994 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/158994
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Hirohisa Yamaguchi <umq@ueo.co.jp>
To: dim@FreeBSD.ORG
Cc: bug-followup@FreeBSD.ORG
Subject: Re: ports/158994: Fix security/libgcrypt 1.5.0 build with clang
Date: Thu, 21 Jul 2011 01:48:07 +0900

 --pgp-sign-Multipart_Thu_Jul_21_01:48:06_2011-1
 Content-Type: text/plain; charset=US-ASCII
 
 Hi,
 
 At Sun, 17 Jul 2011 12:10:24 UT,
 Edwin Groothuis wrote:
 
 > Please note that PR ports/158994 has just been submitted.
 
 > The full text of the PR can be found at:
 >     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/158994
 
 I set up an i386 9-CURRENT box, and saw the problem.
 The submitted patch looks okay.
 
 I approve it, thanks.
 
 Regards,
 --
 
 	Hirohisa Yamaguchi
 	  umq@ueo.co.jp
 
 --pgp-sign-Multipart_Thu_Jul_21_01:48:06_2011-1
 Content-Type: application/pgp-signature
 Content-Transfer-Encoding: 7bit
 Content-Description: OpenPGP Digital Signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.17 (FreeBSD)
 
 iQEcBAABAgAGBQJOJwbGAAoJEML/cja+Xi6+TI0H/2oIl/vdRYxCSiXMYH/hlIiF
 XNex+xXvQOkiJ5+AaVTO0CIPxfo56y4n3eGxMZ/MtgmQ7MCLTo2BOoBxwa2GNglK
 2rmNgKxhhnhzZyKlsG+8cgBZ/BXvAe98DY8prDonQDTE/+T+dTwUT7t1Ixs7KYrk
 LlqABtFHLaQwjR6T5GYpWBoALHV5VRzfaNTVopuuvzIa7ZV/cDaaFPGkjF08ubmZ
 8q1poiadKG8XcIpltIPLk5ett3r9pC2h0Ic4twjGhy+J9SFEN5xFmdROp+oQyd7V
 7pxQtvtWC1droTctuKgf9N/jQGZcQsMYgCRgrJjw38G6pku8Jm4XDDQ3L/53EFE=
 =6UWZ
 -----END PGP SIGNATURE-----
 
 --pgp-sign-Multipart_Thu_Jul_21_01:48:06_2011-1--

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/158994: commit references a PR
Date: Thu, 21 Jul 2011 20:18:59 +0000 (UTC)

 dim         2011-07-21 20:18:45 UTC
 
   FreeBSD ports repository (src committer)
 
   Added files:
     security/libgcrypt/files patch-cipher-rijndael.c 
   Log:
   Building security/libgcrypt 1.5.0 with clang results in errors similar
   to the following:
   
   rijndael.c:846:46: error: ambiguous instructions require an explicit suffix (could be 'cmpb', 'cmpw', 'cmpl', or 'cmpq')
   "movdqa 0xa0(%%esi), %%xmm1\n\t"
   ^
   <inline asm>:24:2: note: instantiated into assembly here
   cmp $10, -80(%ebp)
   ^
   
   This is because the 'cmp' instruction lacks a type suffix, and is thus
   ambiguous.  Fix this by changing these to 'cmpq'.
   
   PR:     ports/158994
   Approved by:    Hirohisa Yamaguchi <umq@ueo.co.jp> (maintainer)
   
   Revision  Changes    Path
   1.1       +61 -0     ports/security/libgcrypt/files/patch-cipher-rijndael.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: feedback->closed 
State-Changed-By: dim 
State-Changed-When: Fri Jul 22 08:51:31 UTC 2011 
State-Changed-Why:  
Patch has been applied. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=158994 
>Unformatted:
