summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJackie Huang <jackie.huang@windriver.com>2014-09-15 06:16:00 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-09-16 22:14:11 +0100
commit0db15bb0626b16201d0767d87e91c61828a449ef (patch)
tree1e793c6f49ac759701113aacaf2c71ec998757b8
parentda36b0ac959d3a0508d086fced9637bba83e93e3 (diff)
downloadpoky-0db15bb0626b16201d0767d87e91c61828a449ef.tar.gz
libgcrypt: Fix ARM assembly when building __PIC__
libgcrypt.so.20 contains .text relocations, backport a patch to fix it. (From OE-Core rev: a81d59bc8d13402725f0f5b42af92332570484d3) Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-support/libgcrypt/files/libgcrypt-1.6.1-make-arm-asm-fPIC-friendly.patch169
-rw-r--r--meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb2
2 files changed, 171 insertions, 0 deletions
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 @@
1Fix ARM assembly when building __PIC__
2
3* cipher/camellia-arm.S (GET_DATA_POINTER): New.
4(_gcry_camellia_arm_encrypt_block): Use GET_DATA_POINTER.
5(_gcry_camellia_arm_decrypt_block): Ditto.
6* cipher/cast5-arm.S (GET_DATA_POINTER): New.
7(_gcry_cast5_arm_encrypt_block, _gcry_cast5_arm_decrypt_block)
8(_gcry_cast5_arm_enc_blk2, _gcry_cast5_arm_dec_blk2): Use
9GET_DATA_POINTER.
10* cipher/rijndael-arm.S (GET_DATA_POINTER): New.
11(_gcry_aes_arm_encrypt_block, _gcry_aes_arm_decrypt_block): Use
12GET_DATA_POINTER.
13--
14
15Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
16
17Upstream-Status: Backport
18
19Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
20---
21 cipher/camellia-arm.S | 17 +++++++++++++++--
22 cipher/cast5-arm.S | 21 +++++++++++++++++----
23 cipher/rijndael-arm.S | 17 +++++++++++++++--
24 3 files changed, 47 insertions(+), 8 deletions(-)
25
26diff --git a/cipher/camellia-arm.S b/cipher/camellia-arm.S
27index c30d194..cdeaf8b 100644
28--- a/cipher/camellia-arm.S
29+++ b/cipher/camellia-arm.S
30@@ -28,6 +28,19 @@
31 .syntax unified
32 .arm
33
34+#ifdef __PIC__
35+# define GET_DATA_POINTER(reg, name, rtmp) \
36+ ldr reg, 1f; \
37+ ldr rtmp, 2f; \
38+ b 3f; \
39+ 1: .word _GLOBAL_OFFSET_TABLE_-(3f+8); \
40+ 2: .word name(GOT); \
41+ 3: add reg, pc, reg; \
42+ ldr reg, [reg, rtmp];
43+#else
44+# define GET_DATA_POINTER(reg, name, rtmp) ldr reg, =name
45+#endif
46+
47 /* struct camellia_ctx: */
48 #define key_table 0
49
50@@ -261,7 +274,7 @@ _gcry_camellia_arm_encrypt_block:
51 */
52 push {%r1, %r4-%r11, %ip, %lr};
53
54- ldr RTAB1, =.Lcamellia_sp1110;
55+ GET_DATA_POINTER(RTAB1, .Lcamellia_sp1110, RTAB3);
56 mov RMASK, #0xff;
57 add RTAB3, RTAB1, #(2 * 4);
58 push {%r3};
59@@ -309,7 +322,7 @@ _gcry_camellia_arm_decrypt_block:
60 */
61 push {%r1, %r4-%r11, %ip, %lr};
62
63- ldr RTAB1, =.Lcamellia_sp1110;
64+ GET_DATA_POINTER(RTAB1, .Lcamellia_sp1110, RTAB3);
65 mov RMASK, #0xff;
66 add RTAB3, RTAB1, #(2 * 4);
67 mov RMASK, RMASK, lsl#4 /* byte mask */
68diff --git a/cipher/cast5-arm.S b/cipher/cast5-arm.S
69index ce7fa93..db96db4 100644
70--- a/cipher/cast5-arm.S
71+++ b/cipher/cast5-arm.S
72@@ -30,6 +30,19 @@
73
74 .extern _gcry_cast5_s1to4;
75
76+#ifdef __PIC__
77+# define GET_DATA_POINTER(reg, name, rtmp) \
78+ ldr reg, 1f; \
79+ ldr rtmp, 2f; \
80+ b 3f; \
81+ 1: .word _GLOBAL_OFFSET_TABLE_-(3f+8); \
82+ 2: .word name(GOT); \
83+ 3: add reg, pc, reg; \
84+ ldr reg, [reg, rtmp];
85+#else
86+# define GET_DATA_POINTER(reg, name, rtmp) ldr reg, =name
87+#endif
88+
89 /* structure of crypto context */
90 #define Km 0
91 #define Kr (Km + (16 * 4))
92@@ -260,7 +273,7 @@ _gcry_cast5_arm_encrypt_block:
93 */
94 push {%r1, %r4-%r11, %ip, %lr};
95
96- ldr Rs1, =_gcry_cast5_s1to4;
97+ GET_DATA_POINTER(Rs1, _gcry_cast5_s1to4, Rs2);
98 mov RMASK, #(0xff << 2);
99 add Rs2, Rs1, #(0x100*4);
100 add Rs3, Rs1, #(0x100*4*2);
101@@ -306,7 +319,7 @@ _gcry_cast5_arm_decrypt_block:
102 */
103 push {%r1, %r4-%r11, %ip, %lr};
104
105- ldr Rs1, =_gcry_cast5_s1to4;
106+ GET_DATA_POINTER(Rs1, _gcry_cast5_s1to4, Rs2);
107 mov RMASK, #(0xff << 2);
108 add Rs2, Rs1, #(0x100 * 4);
109 add Rs3, Rs1, #(0x100 * 4 * 2);
110@@ -500,7 +513,7 @@ _gcry_cast5_arm_enc_blk2:
111 */
112 push {%lr};
113
114- ldr Rs1, =_gcry_cast5_s1to4;
115+ GET_DATA_POINTER(Rs1, _gcry_cast5_s1to4, Rs2);
116 mov RMASK, #(0xff << 2);
117 add Rs2, Rs1, #(0x100 * 4);
118
119@@ -631,7 +644,7 @@ _gcry_cast5_arm_dec_blk2:
120 * [RR0, RL0], [RR1, RL1]: dst
121 */
122
123- ldr Rs1, =_gcry_cast5_s1to4;
124+ GET_DATA_POINTER(Rs1, _gcry_cast5_s1to4, Rs2);
125 mov RMASK, #(0xff << 2);
126 add Rs2, Rs1, #(0x100 * 4);
127
128diff --git a/cipher/rijndael-arm.S b/cipher/rijndael-arm.S
129index 22c350c..421c3b4 100644
130--- a/cipher/rijndael-arm.S
131+++ b/cipher/rijndael-arm.S
132@@ -28,6 +28,19 @@
133 .syntax unified
134 .arm
135
136+#ifdef __PIC__
137+# define GET_DATA_POINTER(reg, name, rtmp) \
138+ ldr reg, 1f; \
139+ ldr rtmp, 2f; \
140+ b 3f; \
141+ 1: .word _GLOBAL_OFFSET_TABLE_-(3f+8); \
142+ 2: .word name(GOT); \
143+ 3: add reg, pc, reg; \
144+ ldr reg, [reg, rtmp];
145+#else
146+# define GET_DATA_POINTER(reg, name, rtmp) ldr reg, =name
147+#endif
148+
149 /* register macros */
150 #define CTX %r0
151 #define RTAB %lr
152@@ -249,7 +262,7 @@ _gcry_aes_arm_encrypt_block:
153 2:
154 sub %sp, #16;
155
156- ldr RTAB, =.LtableE0;
157+ GET_DATA_POINTER(RTAB, .LtableE0, RMASK);
158
159 str %r1, [%sp, #4]; /* dst */
160 mov RMASK, #0xff;
161@@ -503,7 +516,7 @@ _gcry_aes_arm_decrypt_block:
162 2:
163 sub %sp, #16;
164
165- ldr RTAB, =.LtableD0;
166+ GET_DATA_POINTER(RTAB, .LtableD0, RMASK);
167
168 mov RMASK, #0xff;
169 str %r1, [%sp, #4]; /* dst */
diff --git a/meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb b/meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb
index 1657ea4de4..903ed661ed 100644
--- a/meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb
+++ b/meta/recipes-support/libgcrypt/libgcrypt_1.6.1.bb
@@ -1,4 +1,6 @@
1require libgcrypt.inc 1require libgcrypt.inc
2 2
3SRC_URI += "file://libgcrypt-1.6.1-make-arm-asm-fPIC-friendly.patch"
4
3SRC_URI[md5sum] = "d155aa1b06fa879175922ba28f6a6509" 5SRC_URI[md5sum] = "d155aa1b06fa879175922ba28f6a6509"
4SRC_URI[sha256sum] = "7c1007197bef49c3b8740cf6af8b4eb4eb74c7a69796ebcf555d928c287255de" 6SRC_URI[sha256sum] = "7c1007197bef49c3b8740cf6af8b4eb4eb74c7a69796ebcf555d928c287255de"