Fix libc dependency of external components

Currently the stdlib::c library, which represents the standard
library in deployments compiled for "freestanding" environments (SPs)
is added early to link dependencies of the target. As a result the
link order is incorrect and symbol search for external components
added later and depending on libc fails with GCC.
As a workaround make external components depend on libc directly.

Change-Id: Idb9da18bb8228dea56ef539cacf36964d2349937
Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
diff --git a/deployments/crypto/crypto.cmake b/deployments/crypto/crypto.cmake
index 9020cc0..9ca26cd 100644
--- a/deployments/crypto/crypto.cmake
+++ b/deployments/crypto/crypto.cmake
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -47,7 +47,6 @@
 # Mbed TLS provides libmbedcrypto
 include(${TS_ROOT}/external/MbedTLS/MbedTLS.cmake)
 target_link_libraries(crypto PRIVATE mbedcrypto)
-target_link_libraries(mbedcrypto INTERFACE stdlib::c)
 
 #################################################################
 
diff --git a/deployments/libsp/opteesp/CMakeLists.txt b/deployments/libsp/opteesp/CMakeLists.txt
index fb47a60..0e83302 100644
--- a/deployments/libsp/opteesp/CMakeLists.txt
+++ b/deployments/libsp/opteesp/CMakeLists.txt
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -55,7 +55,7 @@
 get_newlib_compile_flags()
 
 # Get libc specific settings from newlib.
-target_link_libraries(sp PRIVATE stdlib::c)
+target_link_libraries(sp PUBLIC stdlib::c)
 
 target_compile_definitions(sp PRIVATE
 	ARM64=1