Skip to content
Snippets Groups Projects
Commit 382dd125 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

contrib: remove gcrypt, gpg-error

Change-Id: Ib565af26f01d08e994451a5bfb6413791e8037b3
parent 17e6e14b
Branches
No related tags found
No related merge requests found
From ef3e66e168c4b9b86bfc4903001631e53a7125d8 Mon Sep 17 00:00:00 2001
From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Date: Sun, 12 Jan 2014 22:01:28 +0200
Subject: [PATCH] Fix assembly division check
* configure.ac (gcry_cv_gcc_as_const_division_ok): Correct variable
name mismatch at '--Wa,--divide' workaround check.
--
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index fac5f7a..7d37f94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1101,7 +1101,7 @@ if test $amd64_as_feature_detection = yes; then
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[__asm__("xorl \$(123456789/12345678), %ebp;\n\t");]])],
[gcry_cv_gcc_as_const_division_with_wadivide_ok=yes])])
- if test "$gcry_cv_gcc_as_const_division_ok_with_wadivide_ok" = "no" ; then
+ if test "$gcry_cv_gcc_as_const_division_with_wadivide_ok" = "no" ; then
# '-Wa,--divide' did not work, restore old flags.
CPPFLAGS="$_gcc_cppflags_save"
fi
--
1.9.1
86003bb61c1fd37d0e54f9b1f48a9d89adb5f623818f67392f19d0de9b28ccb911a728238f8a8d23b875afb3bf7698bbea4da7b3b3a10e049311b9b45fabe472 libgcrypt-1.6.2.tar.bz2
From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Date: Sun, 12 Jan 2014 08:53:47 +0000 (+0200)
Subject: Fix constant division for AMD64 assembly on Solaris/x86
X-Git-Url: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff_plain;h=43376891c01f4aff1fbfb23beafebb5adfd0868c
Fix constant division for AMD64 assembly on Solaris/x86
* configure.ac (gcry_cv_gcc_as_const_division_ok): Add new check for
constant division in assembly and test for "-Wa,--divide" workaround.
(gcry_cv_gcc_amd64_platform_as_ok): Check for also constant division.
--
Appearantly on Solaris/x86 '/' character is treated as begining of line
comment by GNU as. This causes problems when compiling SHA-1 SSSE3
implementation:
On 02.01.2014 16:26, Richard PALO wrote:
>> COLLECT_GCC_OPTIONS='-D' 'HAVE_CONFIG_H' '-I' '.' '-I' '..' '-I' '../src' '-I' '/var/tmp/pkgsrc/security/libgcrypt/work/.buildlink/include' '-I' '/var/tmp/pkgsrc/security/libgcrypt/work/.buildlink/include/gettext' '-D' '_REENTRANT' '-O2' '-MT' 'sha1-ssse3-amd64.lo' '-MD' '-MP' '-MF' '.deps/sha1-ssse3-amd64.Tpo' '-c' '-fPIC' '-D' 'PIC' '-o' '.libs/sha1-ssse3-amd64.o' '-v' '-mtune=generic' '-march=x86-64'
>> /usr/gnu/bin/as -v -I . -I .. -I ../src -I /var/tmp/pkgsrc/security/libgcrypt/work/.buildlink/include -I /var/tmp/pkgsrc/security/libgcrypt/work/.buildlink/include/gettext -V -Qy -s --64 -o .libs/sha1-ssse3-amd64.o /var/tmp//ccAxWPXX.s
>> GNU assembler version 2.23.1 (i386-pc-solaris2.11) using BFD version (GNU Binutils) 2.23.1
>> /var/tmp//ccAxWPXX.s: Assembler messages:
>> /var/tmp//ccAxWPXX.s:34: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:38: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:42: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:46: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:54: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:58: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:62: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:66: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:70: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:74: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:78: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:82: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:86: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:90: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:94: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:98: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:102: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:106: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:110: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:114: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:119: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:123: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:127: Error: unbalanced parenthesis in operand 1.
>> /var/tmp//ccAxWPXX.s:132: Error: unbalanced parenthesis in operand 1.
>
>
> apparently the paddd code, such as
> `paddd (.LK_XMM + ((i)/20)*16) RIP, tmp0;`
> isn't digested well, appended is the generated assembler code.
On 02.01.2014 17:41, Richard PALO wrote:
> Hi again, after finding the following:
> https://sourceware.org/bugzilla/show_bug.cgi?id=4572
>
> I tried using '-Wa,--divide' and that seemed to workaround the problem...
>
> perhaps the code, or at least the Makefile could be adapted accordingly?
Patch adds detection of this feature and attempts to workaround issue with by
adding "-Wa,--divide" to CPPFLAGS. If workaround does not work (old GAS on
Solaris/x86), we'll disable AMD64 assembly.
[v3]:
- Update CPPFLAGS after testing instead of CFLAGS.
Reported-and-tested-by: Richard PALO <richard.palo@free.fr>
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
---
diff --git a/configure.ac b/configure.ac
index 05cdaf8..fac5f7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1079,11 +1079,42 @@ fi
#
+# Check whether GCC assembler needs "-Wa,--divide" to correctly handle
+# constant division
+#
+if test $amd64_as_feature_detection = yes; then
+ AC_CACHE_CHECK([whether GCC assembler handles division correctly],
+ [gcry_cv_gcc_as_const_division_ok],
+ [gcry_cv_gcc_as_const_division_ok=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [[__asm__("xorl \$(123456789/12345678), %ebp;\n\t");]])],
+ [gcry_cv_gcc_as_const_division_ok=yes])])
+ if test "$gcry_cv_gcc_as_const_division_ok" = "no" ; then
+ #
+ # Add '-Wa,--divide' to CPPFLAGS and try check again.
+ #
+ _gcc_cppflags_save="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -Wa,--divide"
+ AC_CACHE_CHECK([whether GCC assembler handles division correctly with "-Wa,--divide"],
+ [gcry_cv_gcc_as_const_division_with_wadivide_ok],
+ [gcry_cv_gcc_as_const_division_with_wadivide_ok=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [[__asm__("xorl \$(123456789/12345678), %ebp;\n\t");]])],
+ [gcry_cv_gcc_as_const_division_with_wadivide_ok=yes])])
+ if test "$gcry_cv_gcc_as_const_division_ok_with_wadivide_ok" = "no" ; then
+ # '-Wa,--divide' did not work, restore old flags.
+ CPPFLAGS="$_gcc_cppflags_save"
+ fi
+ fi
+fi
+
+
+#
# Check whether GCC assembler supports features needed for our amd64
# implementations
#
if test $amd64_as_feature_detection = yes; then
- AC_CACHE_CHECK([whether GCC assembler is compatible for amd64 assembly implementations],
+ AC_CACHE_CHECK([whether GCC assembler is compatible for amd64 assembly implementations],
[gcry_cv_gcc_amd64_platform_as_ok],
[gcry_cv_gcc_amd64_platform_as_ok=no
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
@@ -1096,6 +1127,11 @@ if test $amd64_as_feature_detection = yes; then
"asmfunc:\n\t"
".size asmfunc,.-asmfunc;\n\t"
".type asmfunc,@function;\n\t"
+ /* Test if assembler allows use of '/' for constant division
+ * (Solaris/x86 issue). If previous constant division check
+ * and "-Wa,--divide" workaround failed, this causes assembly
+ * to be disable on this machine. */
+ "xorl \$(123456789/12345678), %ebp;\n\t"
);]])],
[gcry_cv_gcc_amd64_platform_as_ok=yes])])
if test "$gcry_cv_gcc_amd64_platform_as_ok" = "yes" ; then
# GCRYPT
GCRYPT_VERSION := 1.6.2
GCRYPT_URL := https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-$(GCRYPT_VERSION).tar.bz2
$(TARBALLS)/libgcrypt-$(GCRYPT_VERSION).tar.bz2:
$(call download,$(GCRYPT_URL))
.sum-gcrypt: libgcrypt-$(GCRYPT_VERSION).tar.bz2
libgcrypt: libgcrypt-$(GCRYPT_VERSION).tar.bz2 .sum-gcrypt
$(UNPACK)
$(APPLY) $(SRC)/gcrypt/fix-amd64-assembly-on-solaris.patch
$(APPLY) $(SRC)/gcrypt/0001-Fix-assembly-division-check.patch
$(MOVE)
DEPS_gcrypt = gpg-error
GCRYPT_CONF = \
--enable-ciphers=aes,des,rfc2268,arcfour \
--enable-digests=sha1,md5,rmd160,sha256,sha512 \
--enable-pubkey-ciphers=dsa,rsa,ecc
ifdef HAVE_WIN64
GCRYPT_CONF += --disable-asm
endif
ifdef HAVE_IOS
GCRYPT_EXTRA_CFLAGS = -fheinous-gnu-extensions
else
GCRYPT_EXTRA_CFLAGS =
endif
ifdef HAVE_MACOSX
GCRYPT_CONF += --disable-aesni-support
else
ifdef HAVE_BSD
GCRYPT_CONF += --disable-asm --disable-aesni-support
endif
endif
ifdef HAVE_ANDROID
ifeq ($(ANDROID_ABI), x86)
GCRYPT_CONF += ac_cv_sys_symbol_underscore=no
endif
endif
.gcrypt: libgcrypt
$(RECONF)
cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) $(GCRYPT_EXTRA_CFLAGS)" ./configure $(HOSTCONF) $(GCRYPT_CONF)
cd $< && $(MAKE) install
touch $@
7ceb654b9690b27ea904861a47eb2da16d68da11f69e150cb413970b3dd756093d1fcf1fabeabb7aadc888bfa03edc64115dbc572a97428ddcf9f0af0c1b210b libgpg-error-1.15.tar.bz2
--- libgpg-error/src/gpgrt-int.h.orig 2014-09-17 15:23:22.992333706 +0200
+++ libgpg-error/src/gpgrt-int.h 2014-09-17 15:23:52.772783925 +0200
@@ -105,9 +105,9 @@
int _gpgrt_fflush (gpgrt_stream_t stream);
int _gpgrt_fseek (gpgrt_stream_t stream, long int offset, int whence);
-int _gpgrt_fseeko (gpgrt_stream_t stream, off_t offset, int whence);
+int _gpgrt_fseeko (gpgrt_stream_t stream, gpgrt_off_t offset, int whence);
long int _gpgrt_ftell (gpgrt_stream_t stream);
-off_t _gpgrt_ftello (gpgrt_stream_t stream);
+gpgrt_off_t _gpgrt_ftello (gpgrt_stream_t stream);
void _gpgrt_rewind (gpgrt_stream_t stream);
int _gpgrt_fgetc (gpgrt_stream_t stream);
diff -ru libgpg-error/tests/t-lock.c libgpg-error-fixed/tests/t-lock.c
--- libgpg-error/tests/t-lock.c 2014-01-24 21:50:09.000000000 +0100
+++ libgpg-error-fixed/tests/t-lock.c 2014-08-17 22:10:24.000000000 +0200
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <assert.h>
#ifdef _WIN32
# include <windows.h>
# GPGERROR
GPGERROR_VERSION := 1.15
GPGERROR_URL := https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-$(GPGERROR_VERSION).tar.bz2
$(TARBALLS)/libgpg-error-$(GPGERROR_VERSION).tar.bz2:
$(call download,$(GPGERROR_URL))
.sum-gpg-error: libgpg-error-$(GPGERROR_VERSION).tar.bz2
libgpg-error: libgpg-error-$(GPGERROR_VERSION).tar.bz2 .sum-gpg-error
$(UNPACK)
ifdef HAVE_WIN32
$(APPLY) $(SRC)/gpg-error/windres-make.patch
endif
$(APPLY) $(SRC)/gpg-error/missing-unistd-include.patch
$(APPLY) $(SRC)/gpg-error/gpgerror-android.patch
$(MOVE)
cp $@/src/syscfg/lock-obj-pub.arm-unknown-linux-androideabi.h $@/src/syscfg/lock-obj-pub.linux-android.h
ifdef HAVE_IOS
cp $@/src/syscfg/lock-obj-pub.arm-unknown-linux-androideabi.h $@/src/syscfg/lock-obj-pub.$(HOST).h
endif
.gpg-error: libgpg-error
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) --disable-nls --disable-shared --disable-languages
cd $< && $(MAKE) install
touch $@
--- libgpg-error/src/Makefile.am 2010-04-14 11:16:44.000000000 +0200
+++ libgpg-error.new/src/Makefile.am 2010-08-09 11:21:56.000000000 +0200
@@ -60,7 +60,7 @@
arch_sources = w32-gettext.c
RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- -DLOCALEDIR=\"$(localedir)\" $(AM_CPPFLAGS) $(CPPFLAGS)
+ -DLOCALEDIR=\"$(localedir)\" $(AM_CPPFLAGS)
LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
SUFFIXES = .rc .lo
--- libgpg-error/src/Makefile.in.orig 2011-11-22 23:23:14.450340031 -0500
+++ libgpg-error/src/Makefile.in 2011-11-22 23:23:20.650370779 -0500
@@ -306,7 +306,7 @@
@HAVE_W32_SYSTEM_FALSE@arch_sources =
@HAVE_W32_SYSTEM_TRUE@arch_sources = w32-gettext.c
@HAVE_W32_SYSTEM_TRUE@RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-@HAVE_W32_SYSTEM_TRUE@ -DLOCALEDIR=\"$(localedir)\" $(AM_CPPFLAGS) $(CPPFLAGS)
+@HAVE_W32_SYSTEM_TRUE@ -DLOCALEDIR=\"$(localedir)\" $(AM_CPPFLAGS)
@HAVE_W32_SYSTEM_TRUE@LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
@HAVE_W32_SYSTEM_TRUE@SUFFIXES = .rc .lo
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment