• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright (C) 2022 Huawei Technologies Co., Ltd.
4# Licensed under the Mulan PSL v2.
5# You can use this software according to the terms and conditions of the Mulan
6# PSL v2.
7# You may obtain a copy of Mulan PSL v2 at:
8#     http://license.coscl.org.cn/MulanPSL2
9# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
10# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
11# NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
12# See the Mulan PSL v2 for more details.
13
14set -e
15
16#params: $1-readelf cmd; $2-libcombine.so; $3-USE_ENTRY_BINARY; $4-DYN_LINK; $5-TARGET_IS_ARM64
17
18# if USE_ENTRY_BINARY is y, means link elf_main_entry.o
19# no need to check
20if [ "$3" == "y" ]; then
21	echo "------ no need to check task_entry ----"
22	exit 0
23fi
24
25# for ta not link elf_main_entry.o
26# should not define tee_task_entry symbol
27echo "------------- check TA tee_task_entry begin --------------"
28task_entry=$($1 -s $2 | grep -w tee_task_entry) || true
29if [[ "$task_entry" != "" ]]; then
30	echo "----- ERROR TA should not define tee_task_entry symbol ---"
31	echo "        $task_entry"
32	exit 1
33fi
34echo "------------- check TA tee_task_entry succ --------------"
35
36# if TARGET_IS_ARM64 is y, means is aarch64 TA
37# for aarch64 ta no need to compile ta_magic.c
38if [ "$5" == "y" ]; then
39	echo "------- aarch64 TA no need check magic ----"
40	exit 0
41fi
42
43# if DYN_LINK is y, means is DYN TA
44# for 32bit dyn ta should compile ta_magic.c
45# since it not link elf_main_entry.o
46task_magic=$($1 -S $2 | grep -w ".magic") || true
47if [ "$4" == "y" ]; then
48	echo "------- check TA magic begin ------"
49	if [[ "$task_magic" == "" ]]; then
50		echo "------ ERROR DYN TA should compile ta_magic.c -----"
51		exit 1
52	fi;
53	echo "------- check TA magic succ ------"
54fi