polarssl: disable assembly for more scenarios
authorGustavo Zacarias <gustavo@zacarias.com.ar>
Mon, 27 Oct 2014 14:07:18 +0000 (11:07 -0300)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 27 Oct 2014 16:49:13 +0000 (17:49 +0100)
Disable assembly optimizations for:
Microblaze in general (previously a patch).
ARM with debugging in Thumb1/2 mode. This one fixes:
http://autobuild.buildroot.net/results/31e/31e8c4e29d51039cd5d213c2fe176a9cc39879da/

Do so in a nicer way with a one-liner sed and drop the patch.

And rename patches around, numbering was off.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/polarssl/polarssl-0001-no-test-suite.patch [new file with mode: 0644]
package/polarssl/polarssl-0002-cmake-use-the-standard-CMake-flag-to-drive-the-share.patch [new file with mode: 0644]
package/polarssl/polarssl-0003-cmake-use-the-standard-CMake-flag-to-drive-the-share.patch [deleted file]
package/polarssl/polarssl-01-no-test-suite.patch [deleted file]
package/polarssl/polarssl-02-disable-microblaze-asm.patch [deleted file]
package/polarssl/polarssl.mk

diff --git a/package/polarssl/polarssl-0001-no-test-suite.patch b/package/polarssl/polarssl-0001-no-test-suite.patch
new file mode 100644 (file)
index 0000000..4c8552a
--- /dev/null
@@ -0,0 +1,27 @@
+Add BUILD_TESTS option to disable test suite
+
+By default, PolarSSL builds a fairly extensive test suite to validate
+the library. In the context of Buildroot, building this test suite is
+not really useful, so we add a BUILD_TESTS to disable its build.
+
+[Gustavo: update for 1.2.11]
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+
+diff -Nura polarssl-1.2.11.orig/CMakeLists.txt polarssl-1.2.11/CMakeLists.txt
+--- polarssl-1.2.11.orig/CMakeLists.txt        2014-07-11 17:14:43.414651327 -0300
++++ polarssl-1.2.11/CMakeLists.txt     2014-07-11 17:23:00.573498626 -0300
+@@ -49,9 +49,11 @@
+ add_subdirectory(library)
+ add_subdirectory(include)
+-if(CMAKE_COMPILER_IS_GNUCC)
++option(BUILD_TESTS "Build tests." ON)
++
++if(CMAKE_COMPILER_IS_GNUCC AND BUILD_TESTS)
+   add_subdirectory(tests)
+-endif(CMAKE_COMPILER_IS_GNUCC)
++endif(CMAKE_COMPILER_IS_GNUCC AND BUILD_TESTS)
+ if(CMAKE_COMPILER_IS_CLANG)
+   add_subdirectory(tests)
+ endif(CMAKE_COMPILER_IS_CLANG)
diff --git a/package/polarssl/polarssl-0002-cmake-use-the-standard-CMake-flag-to-drive-the-share.patch b/package/polarssl/polarssl-0002-cmake-use-the-standard-CMake-flag-to-drive-the-share.patch
new file mode 100644 (file)
index 0000000..d241ae2
--- /dev/null
@@ -0,0 +1,39 @@
+From a14028b0878c1ba27f7c7a6d0962874d0f7f3801 Mon Sep 17 00:00:00 2001
+From: Samuel Martin <s.martin49@gmail.com>
+Date: Sun, 31 Aug 2014 11:54:37 +0200
+Subject: [PATCH 3/3] cmake: use the standard CMake flag to drive the shared
+ object build
+
+If BUILD_SHARED_LIBS is set and not USE_SHARED_POLARSSL_LIBRARY, then
+drive USE_SHARED_POLARSSL_LIBRARY with the BUILD_SHARED_LIBS value.
+
+Signed-off-by: Samuel Martin <s.martin49@gmail.com>
+---
+ library/CMakeLists.txt | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
+index 27bd2e0..2ae0aba 100644
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -1,5 +1,15 @@
+-option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL static library." ON)
+-option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL shared library." OFF)
++# Use the standard CMake flag to drive the shared object build.
++if(DEFINED BUILD_SHARED_LIBS AND NOT DEFINED USE_STATIC_POLARSSL_LIBRARY AND NOT DEFINED USE_SHARED_POLARSSL_LIBRARY)
++  set(USE_STATIC_POLARSSL_LIBRARY ON)
++  if(BUILD_SHARED_LIBS)
++    set(USE_SHARED_POLARSSL_LIBRARY ON)
++  else()
++    set(USE_SHARED_POLARSSL_LIBRARY OFF)
++  endif()
++else()
++  option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL static library." ON)
++  option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL shared library." OFF)
++endif()
+ set(src
+      aes.c
+-- 
+2.1.0
+
diff --git a/package/polarssl/polarssl-0003-cmake-use-the-standard-CMake-flag-to-drive-the-share.patch b/package/polarssl/polarssl-0003-cmake-use-the-standard-CMake-flag-to-drive-the-share.patch
deleted file mode 100644 (file)
index d241ae2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-From a14028b0878c1ba27f7c7a6d0962874d0f7f3801 Mon Sep 17 00:00:00 2001
-From: Samuel Martin <s.martin49@gmail.com>
-Date: Sun, 31 Aug 2014 11:54:37 +0200
-Subject: [PATCH 3/3] cmake: use the standard CMake flag to drive the shared
- object build
-
-If BUILD_SHARED_LIBS is set and not USE_SHARED_POLARSSL_LIBRARY, then
-drive USE_SHARED_POLARSSL_LIBRARY with the BUILD_SHARED_LIBS value.
-
-Signed-off-by: Samuel Martin <s.martin49@gmail.com>
----
- library/CMakeLists.txt | 14 ++++++++++++--
- 1 file changed, 12 insertions(+), 2 deletions(-)
-
-diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
-index 27bd2e0..2ae0aba 100644
---- a/library/CMakeLists.txt
-+++ b/library/CMakeLists.txt
-@@ -1,5 +1,15 @@
--option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL static library." ON)
--option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL shared library." OFF)
-+# Use the standard CMake flag to drive the shared object build.
-+if(DEFINED BUILD_SHARED_LIBS AND NOT DEFINED USE_STATIC_POLARSSL_LIBRARY AND NOT DEFINED USE_SHARED_POLARSSL_LIBRARY)
-+  set(USE_STATIC_POLARSSL_LIBRARY ON)
-+  if(BUILD_SHARED_LIBS)
-+    set(USE_SHARED_POLARSSL_LIBRARY ON)
-+  else()
-+    set(USE_SHARED_POLARSSL_LIBRARY OFF)
-+  endif()
-+else()
-+  option(USE_STATIC_POLARSSL_LIBRARY "Build PolarSSL static library." ON)
-+  option(USE_SHARED_POLARSSL_LIBRARY "Build PolarSSL shared library." OFF)
-+endif()
- set(src
-      aes.c
--- 
-2.1.0
-
diff --git a/package/polarssl/polarssl-01-no-test-suite.patch b/package/polarssl/polarssl-01-no-test-suite.patch
deleted file mode 100644 (file)
index 4c8552a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-Add BUILD_TESTS option to disable test suite
-
-By default, PolarSSL builds a fairly extensive test suite to validate
-the library. In the context of Buildroot, building this test suite is
-not really useful, so we add a BUILD_TESTS to disable its build.
-
-[Gustavo: update for 1.2.11]
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
-
-diff -Nura polarssl-1.2.11.orig/CMakeLists.txt polarssl-1.2.11/CMakeLists.txt
---- polarssl-1.2.11.orig/CMakeLists.txt        2014-07-11 17:14:43.414651327 -0300
-+++ polarssl-1.2.11/CMakeLists.txt     2014-07-11 17:23:00.573498626 -0300
-@@ -49,9 +49,11 @@
- add_subdirectory(library)
- add_subdirectory(include)
--if(CMAKE_COMPILER_IS_GNUCC)
-+option(BUILD_TESTS "Build tests." ON)
-+
-+if(CMAKE_COMPILER_IS_GNUCC AND BUILD_TESTS)
-   add_subdirectory(tests)
--endif(CMAKE_COMPILER_IS_GNUCC)
-+endif(CMAKE_COMPILER_IS_GNUCC AND BUILD_TESTS)
- if(CMAKE_COMPILER_IS_CLANG)
-   add_subdirectory(tests)
- endif(CMAKE_COMPILER_IS_CLANG)
diff --git a/package/polarssl/polarssl-02-disable-microblaze-asm.patch b/package/polarssl/polarssl-02-disable-microblaze-asm.patch
deleted file mode 100644 (file)
index e90e12d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-Microblaze assembly seems to be broken, fixes:
-
-http://autobuild.buildroot.net/results/4d5/4d54958ded61a0d929d992e4ca0bb31c996953cb/
-
-Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
-
-diff -Nura polarssl-1.2.11.orig/include/polarssl/bn_mul.h polarssl-1.2.11/include/polarssl/bn_mul.h
---- polarssl-1.2.11.orig/include/polarssl/bn_mul.h     2014-07-30 15:47:27.381658434 -0300
-+++ polarssl-1.2.11/include/polarssl/bn_mul.h  2014-07-30 15:48:52.616543074 -0300
-@@ -480,7 +480,7 @@
- #endif /* SPARCv8 */
--#if defined(__microblaze__) || defined(microblaze)
-+#if 0 && defined(__microblaze__) || defined(microblaze)
- #define MULADDC_INIT                    \
-     asm(                                \
index 7c2750518a63f283f8c770071e10d62d3435663d..046c6bfd0c019d1863ddf2f2a3df4eea26096e9c 100644 (file)
@@ -14,4 +14,16 @@ POLARSSL_INSTALL_STAGING = YES
 POLARSSL_LICENSE = GPLv2
 POLARSSL_LICENSE_FILES = LICENSE
 
+define POLARSSL_DISABLE_ASM
+       $(SED) '/^#define POLARSSL_HAVE_ASM/d' $(@D)/include/polarssl/config.h
+endef
+
+# ARM in thumb mode breaks debugging with asm optimizations
+# Microblaze asm optimizations are broken in general
+ifeq ($(BR2_ENABLE_DEBUG)$(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_ARM_INSTRUCTIONS_THUMB2),yy)
+POLARSSL_POST_CONFIGURE_HOOKS += POLARSSL_DISABLE_ASM
+else ifeq ($(BR2_microblaze),y)
+POLARSSL_POST_CONFIGURE_HOOKS += POLARSSL_DISABLE_ASM
+endif
+
 $(eval $(cmake-package))