kumquat-buildroot/package/optee-client/0001-cmake-support-BUILD_STATIC_LIBS-BUILD_SHARED_LIBS.patch
Etienne Carriere 34d743be7a package/optee-client: fix build warnings from 3.4.0
Add two patches over current optee-client 3.4.0 to fix build issues
reported by some toolchains with traces like:

  /path/to/build/optee-client-3.4.0/libteec/src/tee_client_api.c: In function 'TEEC_InitializeContext':
  /path/to/build/optee-client-3.4.0/libteec/src/tee_client_api.c:149:28: error: 'gen_caps' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    ctx->reg_mem = gen_caps & TEE_GEN_CAP_REG_MEM;
                            ^
  /path/to/build/optee-client-3.4.0/libteec/src/tee_client_api.c: In function ‘TEEC_OpenSession’:
  /path/to/build/optee-client-3.4.0/libteec/src/tee_client_api.c:507:8: error: cast increases required alignment of target type [-Werror=cast-align]
    arg = (struct tee_ioctl_open_session_arg *)buf;
          ^
  /path/to/build/optee-client-3.4.0/libteec/src/tee_client_api.c: In function ‘TEEC_InvokeCommand’:
  /path/to/build/optee-client-3.4.0/libteec/src/tee_client_api.c:581:8: error: cast increases required alignment of target type [-Werror=cast-align]
    arg = (struct tee_ioctl_invoke_arg *)buf;

The optee-client patches have been in the OP-TEE project [1] & [2] and
will be available in the OP-TEE next release planned 3.5.0.

Fixes [3], [4], [5] and other failing builds reported by autobuild tests.

[1] 9dbc61b376
[2] 16c8f54878
[3] http://autobuild.buildroot.net/results/80e78cb0bb955e912d6cbe5b30c9b024e7efc802
[4] http://autobuild.buildroot.net/results/a42c19897d03beb02fde2e7e6da25532be27d5ca
[5] http://autobuild.buildroot.net/results/827087f91b7481d1c3effd615172bbee86317962

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-03-26 18:50:18 +01:00

53 lines
2.2 KiB
Diff

From e2d82d46b33b693305978dfe64d84148314aef46 Mon Sep 17 00:00:00 2001
From: Etienne Carriere <etienne.carriere@linaro.org>
Date: Wed, 6 Mar 2019 11:46:07 +0100
Subject: [PATCH] cmake: support BUILD_STATIC_LIBS/BUILD_SHARED_LIBS
CMake variables BUILD_STATIC_LIBS and BUILD_SHARED_LIBS
set constraints on libraries and executable linkage.
With this change OP-TEE client CMake script builds and installs the
embedded files with the expected linkage configuration.
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
---
libteec/CMakeLists.txt | 5 +++--
tee-supplicant/CMakeLists.txt | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libteec/CMakeLists.txt b/libteec/CMakeLists.txt
index 3ec8f66..e3495fb 100644
--- a/libteec/CMakeLists.txt
+++ b/libteec/CMakeLists.txt
@@ -33,7 +33,7 @@ endif()
################################################################################
# Built library
################################################################################
-add_library (teec SHARED ${SRC})
+add_library (teec ${SRC})
set_target_properties (teec PROPERTIES
VERSION ${PROJECT_VERSION}
@@ -71,4 +71,5 @@ target_link_libraries (teec
################################################################################
# FIXME: This should in someway harmonize with CFG_TEE_CLIENT_LOAD_PATH
# FIXME: Should we change this to /usr/local/lib?
-install (TARGETS teec DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install (TARGETS teec LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
diff --git a/tee-supplicant/CMakeLists.txt b/tee-supplicant/CMakeLists.txt
index d2d3afd..e663be9 100644
--- a/tee-supplicant/CMakeLists.txt
+++ b/tee-supplicant/CMakeLists.txt
@@ -85,4 +85,4 @@ target_link_libraries (${PROJECT_NAME}
################################################################################
# Install targets
################################################################################
-install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_SBINDIR})
+install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
--
2.17.1