libc: armclang: Implement compiler printf symbols
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Thu, 16 Aug 2018 14:42:44 +0000 (15:42 +0100)
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Wed, 22 Aug 2018 09:26:05 +0000 (10:26 +0100)
armclang replaces calls to printf by calls to one of the symbols
__0printf, __1printf or __2printf. This patch adds new functions with
these names that internally call printf so that the Trusted Firmware can
be compiled with this compiler.

Change-Id: I06a0e3e5001232fe5b2577615666ddd66e81eef0
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Makefile
lib/aarch32/armclang_printf.S [new file with mode: 0644]
lib/aarch64/armclang_printf.S [new file with mode: 0644]

index e7ca14a5724a76d42ae3181404bd1c953a058bed..bdc317b190647cf9898955949cbac80adc9f0e1a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -211,6 +211,10 @@ BL_COMMON_SOURCES  +=      common/bl_common.c                      \
                                plat/common/${ARCH}/platform_helpers.S  \
                                ${COMPILER_RT_SRCS}
 
+ifeq ($(notdir $(CC)),armclang)
+BL_COMMON_SOURCES      +=      lib/${ARCH}/armclang_printf.S
+endif
+
 INCLUDES               +=      -Iinclude                               \
                                -Iinclude/bl1                           \
                                -Iinclude/bl2                           \
@@ -239,7 +243,6 @@ INCLUDES            +=      -Iinclude                               \
                                ${SPD_INCLUDES}                         \
                                -Iinclude/tools_share
 
-
 ################################################################################
 # Generic definitions
 ################################################################################
diff --git a/lib/aarch32/armclang_printf.S b/lib/aarch32/armclang_printf.S
new file mode 100644 (file)
index 0000000..2b87bf7
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <asm_macros.S>
+
+/* Symbols needed by armclang */
+
+       .globl __0printf
+       .globl __1printf
+       .globl __2printf
+
+func __0printf
+__1printf:
+__2printf:
+        b      printf
+endfunc __0printf
diff --git a/lib/aarch64/armclang_printf.S b/lib/aarch64/armclang_printf.S
new file mode 100644 (file)
index 0000000..2b87bf7
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <asm_macros.S>
+
+/* Symbols needed by armclang */
+
+       .globl __0printf
+       .globl __1printf
+       .globl __2printf
+
+func __0printf
+__1printf:
+__2printf:
+        b      printf
+endfunc __0printf