Build: Remove input of standard libraries in linker scripts
Removes the GROUP() command with standard libraries in the GCC linker
scripts in favour of specifying -specs=nano.specs and -specs=nosys.specs
in the toolchain file. These two specs together cause the binary to be
linked with "-lgcc -lc_nano -lnosys" which is exactly what we want. Also
specifying this in the linker script is mostly duplication, but actually
somewhat detrimental in some cases as the GROUP() command included libc,
whereas we prefer to only use libc_nano.
Also removed -nostdlib from the compile options as it is a linker option
and so had no effect there. It cannot be used as a link option with TF-M
currently since we do rely on a few things from the standard libraries.
Signed-off-by: Jamie Fox <jamie.fox@arm.com>
Change-Id: I190cad7f112df5de75417776c42af7bb9a9d9c35
diff --git a/toolchain_GNUARM.cmake b/toolchain_GNUARM.cmake
index b6ae50e..4746f58 100644
--- a/toolchain_GNUARM.cmake
+++ b/toolchain_GNUARM.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020-2023, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2024, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -107,6 +107,7 @@
add_compile_options(
-specs=nano.specs
+ -specs=nosys.specs
-Wall
-Wno-format
-Wno-return-type
@@ -118,7 +119,6 @@
-fshort-enums
-funsigned-char
-mthumb
- -nostdlib
$<$<COMPILE_LANGUAGE:C>:-std=c99>
$<$<COMPILE_LANGUAGE:CXX>:-std=c++11>
$<$<OR:$<BOOL:${TFM_DEBUG_SYMBOLS}>,$<BOOL:${TFM_CODE_COVERAGE}>>:-g>
@@ -127,6 +127,7 @@
add_link_options(
--entry=Reset_Handler
-specs=nano.specs
+ -specs=nosys.specs
LINKER:-check-sections
LINKER:-fatal-warnings
LINKER:--gc-sections