blob: 5e0a888b78ca5c9e5371e286eae43e7b06e0dc55 [file] [log] [blame]
Imre Kis2cfb2b42021-12-15 19:15:42 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8#GNUARM v8 and v9 compilers use a different triplet.
9if(NOT CROSS_COMPILE AND NOT DEFINED ENV{CROSS_COMPILE})
10 set(CROSS_COMPILE "aarch64-elf-;aarch64-none-elf-;aarch64-linux-gnu-;aarch64-none-linux-gnu-" CACHE STRING "List of GCC prefix triplets to use.")
11endif()
12
13set(CMAKE_CROSSCOMPILING True)
14set(CMAKE_SYSTEM_NAME Generic)
15set(CMAKE_SYSTEM_PROCESSOR arm)
16set(CMAKE_POSITION_INDEPENDENT_CODE True)
17
18include($ENV{TS_ROOT}/tools/cmake/compiler/GCC.cmake REQUIRED)
19include($ENV{TS_ROOT}/tools/cmake/compiler/config_iface.cmake REQUIRED)
20# Set mandatory compiler and linker flags for this environment:
21# - Compile position independent code
22string(APPEND CMAKE_C_FLAGS_INIT " -fpie")
23# - Disable startup files and default libraries.
24# - Link position independent executable
25string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,-pie -Wl,--no-dynamic-linker")
26
27# -link libgcc with full PATH to work around disabled linker search paths.
28gcc_get_lib_location("libgcc.a" _TMP_VAR)
29string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${_TMP_VAR} ")
30unset(_TMP_VAR)