aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0004-linux-pcc-make-it-more-robust-and-recognize-KERNEL_B.patch
blob: 2d722d8a2a53ea5213fd7b81cb7b1735bf3388f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From 7d770f0324498d1fa78300cc5cecc8c1dcd3b788 Mon Sep 17 00:00:00 2001
From: Andy Polyakov <appro@openssl.org>
Date: Sun, 21 Oct 2012 18:19:41 +0000
Subject: [PATCH 04/26] linux-pcc: make it more robust and recognize
 KERNEL_BITS variable.

(cherry picked from commit 78c3e20579d3baa159c8b51b59d415b6e521614b)

Change-Id: I769c466f052305681ab54a1b6545d94c7fbf5a9d
Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
---
 config          | 19 +++++++++++++------
 crypto/ppccap.c |  7 +++++++
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/config b/config
index 41fa2a6..f37b9e6 100755
--- a/config
+++ b/config
@@ -587,13 +587,20 @@ case "$GUESSOS" in
 	fi
 	;;
   ppc64-*-linux2)
-	echo "WARNING! If you wish to build 64-bit library, then you have to"
-	echo "         invoke './Configure linux-ppc64' *manually*."
-	if [ "$TEST" = "false" -a -t 1 ]; then
-	    echo "         You have about 5 seconds to press Ctrl-C to abort."
-	    (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
+	if [ -z "$KERNEL_BITS" ]; then
+	    echo "WARNING! If you wish to build 64-bit library, then you have to"
+	    echo "         invoke './Configure linux-ppc64' *manually*."
+	    if [ "$TEST" = "false" -a -t 1 ]; then
+		echo "         You have about 5 seconds to press Ctrl-C to abort."
+		(trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
+	    fi
+	fi
+	if [ "$KERNEL_BITS" = "64" ]; then
+	    OUT="linux-ppc64"
+	else
+	    OUT="linux-ppc"
+	    (echo "__LP64__" | gcc -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null) || options="$options -m32"
 	fi
-	OUT="linux-ppc"
 	;;
   ppc-*-linux2) OUT="linux-ppc" ;;
   ppc60x-*-vxworks*) OUT="vxworks-ppc60x" ;;
diff --git a/crypto/ppccap.c b/crypto/ppccap.c
index f71ba66..531f1b3 100644
--- a/crypto/ppccap.c
+++ b/crypto/ppccap.c
@@ -4,6 +4,9 @@
 #include <setjmp.h>
 #include <signal.h>
 #include <unistd.h>
+#ifdef __linux
+#include <sys/utsname.h>
+#endif
 #include <crypto.h>
 #include <openssl/bn.h>
 
@@ -102,6 +105,10 @@ void OPENSSL_cpuid_setup(void)
 
 	if (sizeof(size_t)==4)
 		{
+#ifdef __linux
+		struct utsname uts;
+		if (uname(&uts)==0 && strcmp(uts.machine,"ppc64")==0)
+#endif
 		if (sigsetjmp(ill_jmp,1) == 0)
 			{
 			OPENSSL_ppc64_probe();
-- 
2.3.5