From 972dcfcdbfe75dcfeb777150c136576cf1a71e99 Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Fri, 9 Oct 2015 22:59:03 +0200 Subject: initial commit for Enea Linux 5.0 arm Signed-off-by: Tudor Florea --- .../libgcrypt/files/add-pkgconfig-support.patch | 151 ++++++++++++++++++ ...x-ICE-failure-on-mips-with-option-O-and-g.patch | 71 +++++++++ ...ibgcrypt-1.6.1-make-arm-asm-fPIC-friendly.patch | 169 +++++++++++++++++++++ ...ix-building-error-with-O2-in-sysroot-path.patch | 32 ++++ meta/recipes-support/libgcrypt/libgcrypt.inc | 40 +++++ meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb | 6 + 6 files changed, 469 insertions(+) create mode 100644 meta/recipes-support/libgcrypt/files/add-pkgconfig-support.patch create mode 100644 meta/recipes-support/libgcrypt/files/fix-ICE-failure-on-mips-with-option-O-and-g.patch create mode 100644 meta/recipes-support/libgcrypt/files/libgcrypt-1.6.1-make-arm-asm-fPIC-friendly.patch create mode 100644 meta/recipes-support/libgcrypt/files/libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch create mode 100644 meta/recipes-support/libgcrypt/libgcrypt.inc create mode 100644 meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb (limited to 'meta/recipes-support/libgcrypt') diff --git a/meta/recipes-support/libgcrypt/files/add-pkgconfig-support.patch b/meta/recipes-support/libgcrypt/files/add-pkgconfig-support.patch new file mode 100644 index 0000000000..82c93bd44d --- /dev/null +++ b/meta/recipes-support/libgcrypt/files/add-pkgconfig-support.patch @@ -0,0 +1,151 @@ +Add and use pkg-config for libgcrypt instead of -config scripts. + +Upstream-Status: Rejected [upstream have indicated they don't want a pkg-config dependency] + +RP 2014/5/22 + +Index: libgcrypt-1.2.4/configure.ac +=================================================================== +--- libgcrypt-1.2.4.orig/configure.ac 2008-03-19 22:14:50.000000000 +0000 ++++ libgcrypt-1.2.4/configure.ac 2008-03-19 22:14:58.000000000 +0000 +@@ -807,6 +807,7 @@ + doc/Makefile + src/Makefile + src/gcrypt.h ++src/libgcrypt.pc + src/libgcrypt-config + tests/Makefile + w32-dll/Makefile +Index: libgcrypt-1.2.4/src/libgcrypt.pc.in +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ libgcrypt-1.2.4/src/libgcrypt.pc.in 2008-03-19 22:14:58.000000000 +0000 +@@ -0,0 +1,33 @@ ++# Process this file with autoconf to produce a pkg-config metadata file. ++# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation ++# Author: Simon Josefsson ++# ++# This file is free software; as a special exception the author gives ++# unlimited permission to copy and/or distribute it, with or without ++# modifications, as long as this notice is preserved. ++# ++# This file is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the ++# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@ ++ ++# API info ++api_version=@LIBGCRYPT_CONFIG_API_VERSION@ ++host=@LIBGCRYPT_CONFIG_HOST@ ++ ++# Misc information. ++symmetric_ciphers=@LIBGCRYPT_CIPHERS@ ++asymmetric_ciphers=@LIBGCRYPT_PUBKEY_CIPHERS@ ++digests=@LIBGCRYPT_DIGESTS@ ++ ++Name: libgcrypt ++Description: GNU crypto library ++URL: http://www.gnupg.org ++Version: @VERSION@ ++Libs: -L${libdir} -lgcrypt ++Libs.private: -L${libdir} -lgpg-error ++Cflags: -I${includedir} +Index: libgcrypt-1.6.1/src/libgcrypt.m4 +=================================================================== +--- libgcrypt-1.6.1.orig/src/libgcrypt.m4 2013-12-16 17:44:32.000000000 +0000 ++++ libgcrypt-1.6.1/src/libgcrypt.m4 2014-05-13 21:25:37.478389833 +0000 +@@ -22,17 +22,7 @@ + dnl + AC_DEFUN([AM_PATH_LIBGCRYPT], + [ AC_REQUIRE([AC_CANONICAL_HOST]) +- AC_ARG_WITH(libgcrypt-prefix, +- AC_HELP_STRING([--with-libgcrypt-prefix=PFX], +- [prefix where LIBGCRYPT is installed (optional)]), +- libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") +- if test x$libgcrypt_config_prefix != x ; then +- if test x${LIBGCRYPT_CONFIG+set} != xset ; then +- LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config +- fi +- fi + +- AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no) + tmp=ifelse([$1], ,1:1.2.0,$1) + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` +@@ -42,48 +32,13 @@ + min_libgcrypt_version="$tmp" + fi + +- AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version) +- ok=no +- if test "$LIBGCRYPT_CONFIG" != "no" ; then +- req_major=`echo $min_libgcrypt_version | \ +- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` +- req_minor=`echo $min_libgcrypt_version | \ +- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` +- req_micro=`echo $min_libgcrypt_version | \ +- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` +- libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` +- major=`echo $libgcrypt_config_version | \ +- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` +- minor=`echo $libgcrypt_config_version | \ +- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` +- micro=`echo $libgcrypt_config_version | \ +- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` +- if test "$major" -gt "$req_major"; then +- ok=yes +- else +- if test "$major" -eq "$req_major"; then +- if test "$minor" -gt "$req_minor"; then +- ok=yes +- else +- if test "$minor" -eq "$req_minor"; then +- if test "$micro" -ge "$req_micro"; then +- ok=yes +- fi +- fi +- fi +- fi +- fi +- fi +- if test $ok = yes; then +- AC_MSG_RESULT([yes ($libgcrypt_config_version)]) +- else +- AC_MSG_RESULT(no) +- fi ++ PKG_CHECK_MODULES(LIBGCRYPT, [libgcrypt >= $min_libgcrypt_version], [ok=yes], [ok=no]) ++ + if test $ok = yes; then + # If we have a recent libgcrypt, we should also check that the + # API is compatible + if test "$req_libgcrypt_api" -gt 0 ; then +- tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` ++ tmp=`$PKG_CONFIG --variable=api_version libgcrypt` + if test "$tmp" -gt 0 ; then + AC_MSG_CHECKING([LIBGCRYPT API version]) + if test "$req_libgcrypt_api" -eq "$tmp" ; then +@@ -96,10 +51,8 @@ + fi + fi + if test $ok = yes; then +- LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` +- LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` + ifelse([$2], , :, [$2]) +- libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none` ++ libgcrypt_config_host=`$PKG_CONFIG --variable=host libgcrypt` + if test x"$libgcrypt_config_host" != xnone ; then + if test x"$libgcrypt_config_host" != x"$host" ; then + AC_MSG_WARN([[ +@@ -113,8 +66,6 @@ + fi + fi + else +- LIBGCRYPT_CFLAGS="" +- LIBGCRYPT_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(LIBGCRYPT_CFLAGS) diff --git a/meta/recipes-support/libgcrypt/files/fix-ICE-failure-on-mips-with-option-O-and-g.patch b/meta/recipes-support/libgcrypt/files/fix-ICE-failure-on-mips-with-option-O-and-g.patch new file mode 100644 index 0000000000..56c591f06e --- /dev/null +++ b/meta/recipes-support/libgcrypt/files/fix-ICE-failure-on-mips-with-option-O-and-g.patch @@ -0,0 +1,71 @@ +tests/bench-slope.c: workaround ICE failure on mips with '-O -g' + +Hit a ICE and could reduce it to the following minimal example: + +1. Only the size of array assigned with 2 caused the issue: +$ cat > mipgcc-test.c << END + +int main (int argc, char **argv) +{ + char *pStrArry[ARRAY_SIZE_MAX] = {"hello"}; + int i = 0; + + while(pStrArry[i] && i for instructions + +3. The quick workround is trying to enlarge the size of array with larger +than 2. + +4. File a bug to GNU, but it could not be reproduced on there environment. +http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60643 + +Upstream-Status: [oe specific] + +Signed-off-by: Hongxu Jia +--- + tests/bench-slope.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/bench-slope.c b/tests/bench-slope.c +index bd05064..28c2438 100644 +--- a/tests/bench-slope.c ++++ b/tests/bench-slope.c +@@ -1197,7 +1197,7 @@ static struct bench_ops hash_ops = { + }; + + +-static struct bench_hash_mode hash_modes[] = { ++static struct bench_hash_mode hash_modes[3] = { + {"", &hash_ops}, + {0}, + }; +@@ -1349,7 +1349,7 @@ static struct bench_ops mac_ops = { + }; + + +-static struct bench_mac_mode mac_modes[] = { ++static struct bench_mac_mode mac_modes[3] = { + {"", &mac_ops}, + {0}, + }; +-- +1.8.1.2 + diff --git a/meta/recipes-support/libgcrypt/files/libgcrypt-1.6.1-make-arm-asm-fPIC-friendly.patch b/meta/recipes-support/libgcrypt/files/libgcrypt-1.6.1-make-arm-asm-fPIC-friendly.patch new file mode 100644 index 0000000000..340087279d --- /dev/null +++ b/meta/recipes-support/libgcrypt/files/libgcrypt-1.6.1-make-arm-asm-fPIC-friendly.patch @@ -0,0 +1,169 @@ +Fix ARM assembly when building __PIC__ + +* cipher/camellia-arm.S (GET_DATA_POINTER): New. +(_gcry_camellia_arm_encrypt_block): Use GET_DATA_POINTER. +(_gcry_camellia_arm_decrypt_block): Ditto. +* cipher/cast5-arm.S (GET_DATA_POINTER): New. +(_gcry_cast5_arm_encrypt_block, _gcry_cast5_arm_decrypt_block) +(_gcry_cast5_arm_enc_blk2, _gcry_cast5_arm_dec_blk2): Use +GET_DATA_POINTER. +* cipher/rijndael-arm.S (GET_DATA_POINTER): New. +(_gcry_aes_arm_encrypt_block, _gcry_aes_arm_decrypt_block): Use +GET_DATA_POINTER. +-- + +Signed-off-by: Jussi Kivilinna + +Upstream-Status: Backport + +Signed-off-by: Jackie Huang +--- + cipher/camellia-arm.S | 17 +++++++++++++++-- + cipher/cast5-arm.S | 21 +++++++++++++++++---- + cipher/rijndael-arm.S | 17 +++++++++++++++-- + 3 files changed, 47 insertions(+), 8 deletions(-) + +diff --git a/cipher/camellia-arm.S b/cipher/camellia-arm.S +index c30d194..cdeaf8b 100644 +--- a/cipher/camellia-arm.S ++++ b/cipher/camellia-arm.S +@@ -28,6 +28,19 @@ + .syntax unified + .arm + ++#ifdef __PIC__ ++# define GET_DATA_POINTER(reg, name, rtmp) \ ++ ldr reg, 1f; \ ++ ldr rtmp, 2f; \ ++ b 3f; \ ++ 1: .word _GLOBAL_OFFSET_TABLE_-(3f+8); \ ++ 2: .word name(GOT); \ ++ 3: add reg, pc, reg; \ ++ ldr reg, [reg, rtmp]; ++#else ++# define GET_DATA_POINTER(reg, name, rtmp) ldr reg, =name ++#endif ++ + /* struct camellia_ctx: */ + #define key_table 0 + +@@ -261,7 +274,7 @@ _gcry_camellia_arm_encrypt_block: + */ + push {%r1, %r4-%r11, %ip, %lr}; + +- ldr RTAB1, =.Lcamellia_sp1110; ++ GET_DATA_POINTER(RTAB1, .Lcamellia_sp1110, RTAB3); + mov RMASK, #0xff; + add RTAB3, RTAB1, #(2 * 4); + push {%r3}; +@@ -309,7 +322,7 @@ _gcry_camellia_arm_decrypt_block: + */ + push {%r1, %r4-%r11, %ip, %lr}; + +- ldr RTAB1, =.Lcamellia_sp1110; ++ GET_DATA_POINTER(RTAB1, .Lcamellia_sp1110, RTAB3); + mov RMASK, #0xff; + add RTAB3, RTAB1, #(2 * 4); + mov RMASK, RMASK, lsl#4 /* byte mask */ +diff --git a/cipher/cast5-arm.S b/cipher/cast5-arm.S +index ce7fa93..db96db4 100644 +--- a/cipher/cast5-arm.S ++++ b/cipher/cast5-arm.S +@@ -30,6 +30,19 @@ + + .extern _gcry_cast5_s1to4; + ++#ifdef __PIC__ ++# define GET_DATA_POINTER(reg, name, rtmp) \ ++ ldr reg, 1f; \ ++ ldr rtmp, 2f; \ ++ b 3f; \ ++ 1: .word _GLOBAL_OFFSET_TABLE_-(3f+8); \ ++ 2: .word name(GOT); \ ++ 3: add reg, pc, reg; \ ++ ldr reg, [reg, rtmp]; ++#else ++# define GET_DATA_POINTER(reg, name, rtmp) ldr reg, =name ++#endif ++ + /* structure of crypto context */ + #define Km 0 + #define Kr (Km + (16 * 4)) +@@ -260,7 +273,7 @@ _gcry_cast5_arm_encrypt_block: + */ + push {%r1, %r4-%r11, %ip, %lr}; + +- ldr Rs1, =_gcry_cast5_s1to4; ++ GET_DATA_POINTER(Rs1, _gcry_cast5_s1to4, Rs2); + mov RMASK, #(0xff << 2); + add Rs2, Rs1, #(0x100*4); + add Rs3, Rs1, #(0x100*4*2); +@@ -306,7 +319,7 @@ _gcry_cast5_arm_decrypt_block: + */ + push {%r1, %r4-%r11, %ip, %lr}; + +- ldr Rs1, =_gcry_cast5_s1to4; ++ GET_DATA_POINTER(Rs1, _gcry_cast5_s1to4, Rs2); + mov RMASK, #(0xff << 2); + add Rs2, Rs1, #(0x100 * 4); + add Rs3, Rs1, #(0x100 * 4 * 2); +@@ -500,7 +513,7 @@ _gcry_cast5_arm_enc_blk2: + */ + push {%lr}; + +- ldr Rs1, =_gcry_cast5_s1to4; ++ GET_DATA_POINTER(Rs1, _gcry_cast5_s1to4, Rs2); + mov RMASK, #(0xff << 2); + add Rs2, Rs1, #(0x100 * 4); + +@@ -631,7 +644,7 @@ _gcry_cast5_arm_dec_blk2: + * [RR0, RL0], [RR1, RL1]: dst + */ + +- ldr Rs1, =_gcry_cast5_s1to4; ++ GET_DATA_POINTER(Rs1, _gcry_cast5_s1to4, Rs2); + mov RMASK, #(0xff << 2); + add Rs2, Rs1, #(0x100 * 4); + +diff --git a/cipher/rijndael-arm.S b/cipher/rijndael-arm.S +index 22c350c..421c3b4 100644 +--- a/cipher/rijndael-arm.S ++++ b/cipher/rijndael-arm.S +@@ -28,6 +28,19 @@ + .syntax unified + .arm + ++#ifdef __PIC__ ++# define GET_DATA_POINTER(reg, name, rtmp) \ ++ ldr reg, 1f; \ ++ ldr rtmp, 2f; \ ++ b 3f; \ ++ 1: .word _GLOBAL_OFFSET_TABLE_-(3f+8); \ ++ 2: .word name(GOT); \ ++ 3: add reg, pc, reg; \ ++ ldr reg, [reg, rtmp]; ++#else ++# define GET_DATA_POINTER(reg, name, rtmp) ldr reg, =name ++#endif ++ + /* register macros */ + #define CTX %r0 + #define RTAB %lr +@@ -249,7 +262,7 @@ _gcry_aes_arm_encrypt_block: + 2: + sub %sp, #16; + +- ldr RTAB, =.LtableE0; ++ GET_DATA_POINTER(RTAB, .LtableE0, RMASK); + + str %r1, [%sp, #4]; /* dst */ + mov RMASK, #0xff; +@@ -503,7 +516,7 @@ _gcry_aes_arm_decrypt_block: + 2: + sub %sp, #16; + +- ldr RTAB, =.LtableD0; ++ GET_DATA_POINTER(RTAB, .LtableD0, RMASK); + + mov RMASK, #0xff; + str %r1, [%sp, #4]; /* dst */ diff --git a/meta/recipes-support/libgcrypt/files/libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch b/meta/recipes-support/libgcrypt/files/libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch new file mode 100644 index 0000000000..a3e540369c --- /dev/null +++ b/meta/recipes-support/libgcrypt/files/libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch @@ -0,0 +1,32 @@ +Upstream-Status: Pending + +libgcrypt: fix building error with '-O2' in sysroot path + +Characters like '-O2' or '-Ofast' will be replaced by '-O1' when compiling cipher. +If we are cross compiling libgcrypt and sysroot contains such characters, we would +get compile errors because the sysroot path has been modified. + +Fix this by adding blank spaces before and after the original matching pattern in the +sed command. + +Signed-off-by: Chen Qi +--- + cipher/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cipher/Makefile.am b/cipher/Makefile.am +index 76cdc96..9a89792 100644 +--- a/cipher/Makefile.am ++++ b/cipher/Makefile.am +@@ -69,7 +69,7 @@ rfc2268.c \ + camellia.c camellia.h camellia-glue.c + + if ENABLE_O_FLAG_MUNGING +-o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 's/-Ofast/-O1/g' ++o_flag_munging = sed -e 's/ -O\([2-9s][2-9s]*\) / -O1 /' -e 's/ -Ofast / -O1 /g' + else + o_flag_munging = cat + endif +-- +1.7.9.5 + diff --git a/meta/recipes-support/libgcrypt/libgcrypt.inc b/meta/recipes-support/libgcrypt/libgcrypt.inc new file mode 100644 index 0000000000..43e0291a7b --- /dev/null +++ b/meta/recipes-support/libgcrypt/libgcrypt.inc @@ -0,0 +1,40 @@ +SUMMARY = "General purpose cryptographic library based on the code from GnuPG" +HOMEPAGE = "http://directory.fsf.org/project/libgcrypt/" +BUGTRACKER = "https://bugs.g10code.com/gnupg/index" +SECTION = "libs" + +# helper program gcryptrnd and getrandom are under GPL, rest LGPL +LICENSE = "GPLv2+ & LGPLv2.1+" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ + file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff" + +DEPENDS = "libgpg-error libcap" + +SRC_URI = "ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-${PV}.tar.gz \ + file://add-pkgconfig-support.patch \ + file://libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch \ + file://fix-ICE-failure-on-mips-with-option-O-and-g.patch \ +" + +BINCONFIG = "${bindir}/libgcrypt-config" + +inherit autotools-brokensep texinfo binconfig-disabled pkgconfig + +EXTRA_OECONF = "--disable-asm --with-capabilities" + +do_configure_prepend () { + # Else this could be used in preference to the one in aclocal-copy + rm -f ${S}/m4/gpg-error.m4 +} + +# libgcrypt.pc is added locally and thus installed here +do_install_append() { + install -d ${D}/${libdir}/pkgconfig + install -m 0644 ${B}/src/libgcrypt.pc ${D}/${libdir}/pkgconfig/ +} + +FILES_${PN}-dev += "${bindir}/dumpsexp ${bindir}/hmac256" + +ARM_INSTRUCTION_SET = "arm" + +BBCLASSEXTEND = "native" diff --git a/meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb b/meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb new file mode 100644 index 0000000000..903ed661ed --- /dev/null +++ b/meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb @@ -0,0 +1,6 @@ +require libgcrypt.inc + +SRC_URI += "file://libgcrypt-1.6.1-make-arm-asm-fPIC-friendly.patch" + +SRC_URI[md5sum] = "d155aa1b06fa879175922ba28f6a6509" +SRC_URI[sha256sum] = "7c1007197bef49c3b8740cf6af8b4eb4eb74c7a69796ebcf555d928c287255de" -- cgit v1.2.3-54-g00ecf