aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorBalint Matyi <Balint.Matyi@arm.com>2020-05-14 10:32:55 +0100
committerTamas Ban <tamas.ban@arm.com>2020-12-17 13:06:19 +0000
commitb7d1288e9aebbe2f880fc8640b3dd6590f11ca1f (patch)
treea65be4089c8494913ba6ea43fb8268832ba0d3a4 /cmake
parentec109eabcfca540ffbee5dcbf1f629740f9de5dd (diff)
downloadtrusted-firmware-m-b7d1288e9aebbe2f880fc8640b3dd6590f11ca1f.tar.gz
Build: Extend code sharing
Utilize the additional opportunities for code sharing that are made possible by applying the patch in the previous commit. Allow data ('D') symbols to be shared. Also allow for empty lines in the symbol template file. Signed-off-by: Balint Matyi <Balint.Matyi@arm.com> Change-Id: Ife5fc6011c678c8f43e53d8cc087f40e32871301
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Common/FilterSharedSymbols.cmake28
1 files changed, 16 insertions, 12 deletions
diff --git a/cmake/Common/FilterSharedSymbols.cmake b/cmake/Common/FilterSharedSymbols.cmake
index feac8919c..9a10b9faf 100644
--- a/cmake/Common/FilterSharedSymbols.cmake
+++ b/cmake/Common/FilterSharedSymbols.cmake
@@ -24,22 +24,26 @@ file(STRINGS ${ALL_SYMBOLS} ALL_SYMBOLS)
# In 'arm-none-eabi-nm' and 'armclang --symdefs' output 'T' indicates the global
# symbols which can be shared between independently linked executables.
-set(_GLOBAL_TEXT_SYMBOL "T")
+# 'D' is necessary to share two specific function pointers: 'mbedtls_calloc_func'
+# and 'mbedtls_free_func'. These also need the 'static' keyword removed in mbed-crypto
+set(_SHARED_SYMBOL_TYPES "T;D")
foreach(_SYMBOL_TEMPLATE IN LISTS SHARED_SYMBOL_TEMPLATE)
string(SUBSTRING _SYMBOL_TEMPLATE 0 1 FIRST_CHAR)
- if(NOT _SYMBOL_TEMPLATE STREQUAL "" AND NOT FIRST_CHAR STREQUAL "#")
+ if (NOT _SYMBOL_TEMPLATE STREQUAL "" AND NOT FIRST_CHAR STREQUAL "#")
foreach(_ONE_SYMBOL IN LISTS ALL_SYMBOLS)
- string(FIND ${_ONE_SYMBOL} "${_GLOBAL_TEXT_SYMBOL} ${_SYMBOL_TEMPLATE}" POSITION)
- if (NOT POSITION EQUAL -1)
- # Get matching symbol name and its address
- list(APPEND SHARED_SYMBOL_ADDR_LIST "${_ONE_SYMBOL}")
-
- # Get matching symbol name
- string(SUBSTRING ${_ONE_SYMBOL} ${POSITION} 200 _ONE_SYMBOL_NAME)
- string(REPLACE "${_GLOBAL_TEXT_SYMBOL} " "" _ONE_SYMBOL_NAME ${_ONE_SYMBOL_NAME})
- list(APPEND SHARED_SYMBOL_NAME_LIST "${_ONE_SYMBOL_NAME}")
- endif()
+ foreach(_TEXT IN LISTS _SHARED_SYMBOL_TYPES)
+ string(FIND ${_ONE_SYMBOL} "${_TEXT} ${_SYMBOL_TEMPLATE}" POSITION)
+ if (NOT POSITION EQUAL -1)
+ # Get matching symbol name and its address
+ list(APPEND SHARED_SYMBOL_ADDR_LIST "${_ONE_SYMBOL}")
+
+ # Get matching symbol name
+ string(SUBSTRING ${_ONE_SYMBOL} ${POSITION} 200 _ONE_SYMBOL_NAME)
+ string(REPLACE "${_TEXT} " "" _ONE_SYMBOL_NAME ${_ONE_SYMBOL_NAME})
+ list(APPEND SHARED_SYMBOL_NAME_LIST "${_ONE_SYMBOL_NAME}")
+ endif()
+ endforeach()
endforeach()
endif()
endforeach()