Imre Kis | 2cfb2b4 | 2021-12-15 19:15:42 +0100 | [diff] [blame^] | 1 | #------------------------------------------------------------------------------- |
| 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. |
| 9 | if(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.") |
| 11 | endif() |
| 12 | |
| 13 | set(CMAKE_CROSSCOMPILING True) |
| 14 | set(CMAKE_SYSTEM_NAME Generic) |
| 15 | set(CMAKE_SYSTEM_PROCESSOR arm) |
| 16 | set(CMAKE_POSITION_INDEPENDENT_CODE True) |
| 17 | |
| 18 | include($ENV{TS_ROOT}/tools/cmake/compiler/GCC.cmake REQUIRED) |
| 19 | include($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 |
| 22 | string(APPEND CMAKE_C_FLAGS_INIT " -fpie") |
| 23 | # - Disable startup files and default libraries. |
| 24 | # - Link position independent executable |
| 25 | string(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. |
| 28 | gcc_get_lib_location("libgcc.a" _TMP_VAR) |
| 29 | string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${_TMP_VAR} ") |
| 30 | unset(_TMP_VAR) |