Integrate libc and dlmalloc to opteesp and sp environments

Replace newlib with libc and dlmalloc components in the optee and sp
environments and implement required interfaces. Using the libc component
also required the following changes:
* Fix duplicate __maybe_unused in compiler.h
* Change external/tf_a/include/cdefs.h to point to new cdefs.h
* Resolve __packed usage issues

Signed-off-by: Imre Kis <imre.kis@arm.com>
Change-Id: Ie798eb426378529b5d84f1708beebe85cd061fb3
diff --git a/environments/opteesp/sp_assert.c b/environments/opteesp/sp_assert.c
index 8f336e7..69f7b74 100644
--- a/environments/opteesp/sp_assert.c
+++ b/environments/opteesp/sp_assert.c
@@ -1,17 +1,16 @@
 // SPDX-License-Identifier: BSD-3-Clause
 /*
- * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved.
  */
 
-#include "assert_fail_handler.h"
-#include "compiler.h"
+#include "libc_platform.h"
 #include "trace.h"
 
 /*
  * The generic trace function called on assert fail.
  */
-void __noreturn assert_fail_handler(const char *file, int line,
-				    const char *func, const char *failedexpr)
+void __noreturn platform_assert(const char *file, int line, const char *func,
+				const char *failedexpr)
 {
 #if TRACE_LEVEL >= TRACE_LEVEL_ERROR
 	trace_printf(func, line, TRACE_LEVEL_ERROR, "assertion %s failed", failedexpr);
@@ -20,3 +19,13 @@
 	while (1)
 		;
 }
+
+void __noreturn platform_abort(void)
+{
+#if TRACE_LEVEL >= TRACE_LEVEL_ERROR
+	trace_puts("abort()");
+#endif /* TRACE_LEVEL */
+
+	while (1)
+		;
+}