summaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3/recipes-bsp/optee
diff options
context:
space:
mode:
authorThuy Tran <thuy.tran.xh@renesas.com>2019-04-19 15:45:58 +0700
committerThuy Tran <thuy.tran.xh@renesas.com>2019-05-23 16:12:00 +0700
commitd97057b273ef07270cef7bc2845670c545b330ab (patch)
treec5c22301b7e33107b7030e7dbe82a515dbed2801 /meta-rcar-gen3/recipes-bsp/optee
parent55c33ce0a852710bf68e515f992f954b2b8c171b (diff)
rcar-gen3: optee-os: Fix GCC 8.x compilation warnings
This commit adds a fix patch from optee-os upstream [1] to fix GCC 8.x compilation warnings with -Wcast-function-type. [1] OPTEE-OS rev: f6d17e33e7b95c90a2521cfd37cd5cb511909fc4 Signed-off-by: Thuy Tran <thuy.tran.xh@renesas.com> Signed-off-by: Takamitsu Honda <takamitsu.honda.pv@renesas.com>
Diffstat (limited to 'meta-rcar-gen3/recipes-bsp/optee')
-rw-r--r--meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-core-define-syscall_t-as-void-void.patch75
-rw-r--r--meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bb3
2 files changed, 77 insertions, 1 deletions
diff --git a/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-core-define-syscall_t-as-void-void.patch b/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-core-define-syscall_t-as-void-void.patch
new file mode 100644
index 0000000..bad7b27
--- /dev/null
+++ b/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-core-define-syscall_t-as-void-void.patch
@@ -0,0 +1,75 @@
+From f6d17e33e7b95c90a2521cfd37cd5cb511909fc4 Mon Sep 17 00:00:00 2001
+From: Jerome Forissier <jerome.forissier@linaro.org>
+Date: Thu, 5 Jul 2018 13:07:52 +0200
+Subject: [PATCH] core: define syscall_t as void (*)(void)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+syscall_t is currently typedef'ed as TEE_Result (*)(void). It is used to
+represent a pointer to any system call, in the syscall table for instance.
+As such, the exact type behind syscall_t cannot reflect all the syscalls
+since they have different prototypes. The current declaration with a
+TEE_Result return type was probably chosen because it was a common
+characteristic of all syscalls to return a TEE_Result.
+
+However, this type causes compilation warnings with GCC 8.1:
+
+core/arch/arm/tee/arch_svc.c:43:36: warning: cast between incompatible function types from ‘void (*)(long unsigned int)’ to ‘TEE_Result (*)(void)’ {aka ‘unsigned int (*)(void)’} [-Wcast-function-type]
+ #define SYSCALL_ENTRY(_fn) { .fn = (syscall_t)_fn }
+ ^
+core/arch/arm/tee/arch_svc.c:50:2: note: in expansion of macro ‘SYSCALL_ENTRY’
+ SYSCALL_ENTRY(syscall_sys_return),
+ ^~~~~~~~~~~~~
+
+The solution is to use 'void (*)(void)' instead, as explained in the GCC
+documentation:
+
+ -Wcast-function-type
+
+ Warn when a function pointer is cast to an incompatible function
+ pointer. [...] The function type void (*) (void) is special and matches
+ everything, which can be used to suppress this warning. [...]
+
+Link: [1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
+Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
+Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
+---
+ core/arch/arm/tee/arch_svc.c | 2 +-
+ core/arch/arm/tee/arch_svc_private.h | 7 +++++--
+ 2 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/core/arch/arm/tee/arch_svc.c b/core/arch/arm/tee/arch_svc.c
+index eb142ec..b2dd193 100644
+--- a/core/arch/arm/tee/arch_svc.c
++++ b/core/arch/arm/tee/arch_svc.c
+@@ -208,7 +208,7 @@ void __weak tee_svc_handler(struct thread_svc_regs *regs)
+ }
+
+ if (scn > TEE_SCN_MAX)
+- scf = syscall_not_supported;
++ scf = (syscall_t)syscall_not_supported;
+ else
+ scf = tee_svc_syscall_table[scn].fn;
+
+diff --git a/core/arch/arm/tee/arch_svc_private.h b/core/arch/arm/tee/arch_svc_private.h
+index c0b3a73..695e733 100644
+--- a/core/arch/arm/tee/arch_svc_private.h
++++ b/core/arch/arm/tee/arch_svc_private.h
+@@ -7,8 +7,11 @@
+
+ #include <tee_api_types.h>
+
+-/* void argument but in reality it can be any number of arguments */
+-typedef TEE_Result (*syscall_t)(void);
++/*
++ * Generic "pointer to function" type. Actual syscalls take zero or more
++ * arguments and return TEE_Result.
++ */
++typedef void (*syscall_t)(void);
+
+ /* Helper function for tee_svc_handler() */
+ uint32_t tee_svc_do_call(struct thread_svc_regs *regs, syscall_t func);
+--
+2.7.4
+
diff --git a/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bb b/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bb
index 8c1b18d..c129b50 100644
--- a/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bb
+++ b/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bb
@@ -21,6 +21,7 @@ SRC_URI = " \
git://github.com/renesas-rcar/optee_os.git;branch=${BRANCH};name=renesas \
git://github.com/OP-TEE/optee_os.git;branch=master;name=officialgit;destsuffix=git_official \
file://0001-core-crypto-arm64-ce-update-AES-CBC-routines.patch;patchdir=../git_official \
+ file://0001-core-define-syscall_t-as-void-void.patch \
"
COMPATIBLE_MACHINE = "(salvator-x|h3ulcb|m3ulcb|m3nulcb|ebisu)"
@@ -45,7 +46,7 @@ do_configure() {
}
do_compile() {
- oe_runmake PLATFORM=${PLATFORM} CFG_ARM64_core=y NOWERROR=1
+ oe_runmake PLATFORM=${PLATFORM} CFG_ARM64_core=y
}
# do_install() nothing