[OE-core] [meta-oe][PATCH] openssl: remove lock data_word from x86cpuid.pl

Kinsella, Ray ray.kinsella at intel.com
Thu Sep 17 15:03:28 UTC 2015


The cmpxchg instruction is encoded in functions such as OPENSSL_atomic_add
as a perlasm data_word. This has the effect of hiding the instruction from 
the assembler. Stripping the LOCK prefix on cmpxchg via the assembler with 
--momit-lock-prefix=yes then becomes impossible (required on the Intel X1000). 
This patch converts the data_word into perlasm instructions.

Signed-off-by: Ray Kinsella <ray.kinsella at intel.com>
---
 .../openssl/remove-lock-data_word-from-x86cpuid.pl.patch   |   12 ++++++++++++
 meta/recipes-connectivity/openssl/openssl_1.0.2d.bb        |    1 +
 2 files changed, 13 insertions(+)
 create mode 100644 meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch

diff --git a/meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch b/meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch
new file mode 100644
index 0000000..e969e91
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl/remove-lock-data_word-from-x86cpuid.pl.patch
@@ -0,0 +1,12 @@
+--- openssl-1.0.2d/crypto/x86cpuid.pl.orig	2015-09-16 21:11:01.927322252 +0100
++++ openssl-1.0.2d/crypto/x86cpuid.pl	2015-09-16 21:14:45.795314992 +0100
+@@ -275,7 +275,8 @@
+ &set_label("spin");
+ 	&lea	("ebx",&DWP(0,"eax","ecx"));
+ 	&nop	();
+-	&data_word(0x1ab10ff0);	# lock;	cmpxchg	%ebx,(%edx)	# %eax is envolved and is always reloaded
++	&lock	();
++	&cmpxchg(&DWP(0,"edx"), "ebx"); # %eax is envolved and is always reloaded
+ 	&jne	(&label("spin"));
+ 	&mov	("eax","ebx");	# OpenSSL expects the new value
+ 	&pop	("ebx");
diff --git a/meta/recipes-connectivity/openssl/openssl_1.0.2d.bb b/meta/recipes-connectivity/openssl/openssl_1.0.2d.bb
index 32d8dce..de2ec1a 100644
--- a/meta/recipes-connectivity/openssl/openssl_1.0.2d.bb
+++ b/meta/recipes-connectivity/openssl/openssl_1.0.2d.bb
@@ -33,6 +33,7 @@ SRC_URI += "file://configure-targets.patch \
             file://openssl-fix-des.pod-error.patch \
             file://Makefiles-ptest.patch \
             file://ptest-deps.patch \
+            file://remove-lock-data_word-from-x86cpuid.pl.patch \
             file://run-ptest \
             file://crypto_use_bigint_in_x86-64_perl.patch \
             file://openssl-1.0.2a-x32-asm.patch \
-- 
1.7.10.4



More information about the Openembedded-core mailing list