ports/158994: Fix security/libgcrypt 1.5.0 build with clang

Dimitry Andric dim at FreeBSD.org
Sun Jul 17 12:10:11 UTC 2011


>Number:         158994
>Category:       ports
>Synopsis:       Fix security/libgcrypt 1.5.0 build with clang
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 17 12:10:10 UTC 2011
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:



More information about the freebsd-ports-bugs mailing list