Add Linux PC and Arm environments
Adds build system config and toolchain options to enable building for
x86 and Arm AArch64 Linux environments.
Change-Id: Id1cf40842fcdc9648a4e06b5ac82e5385f6b2fa4
Signed-off-by: Julian Hall <julian.hall@arm.com>
diff --git a/environments/arm-linux/link_options.cmake b/environments/arm-linux/link_options.cmake
new file mode 100644
index 0000000..717b1ae
--- /dev/null
+++ b/environments/arm-linux/link_options.cmake
@@ -0,0 +1,50 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#[===[.rst:
+.. cmake:command:: env_set_link_options
+
+ .. code-block:: cmake
+
+ env_set_link_options(TGT foo)
+
+ Set default compile options for the arm-linux environment.
+
+ Inputs:
+
+ ``TGT``
+ Name of target to compile generated source files.
+
+#]===]
+function(env_set_link_options)
+ set(_options )
+ set(_oneValueArgs TGT)
+ set(_multiValueArgs )
+
+ cmake_parse_arguments(PARAMS "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
+
+ #Verify mandatory parameters
+ if (NOT DEFINED PARAMS_TGT)
+ message(FATAL_ERROR "env_set_link_options(): mandatory parameter TGT missing.")
+ endif()
+
+ if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ # Options for GCC that control linking
+ target_link_options(${PARAMS_TGT} PRIVATE
+ -fno-lto
+ -pie
+ -zmax-page-size=4096
+ )
+ # Options directly for LD, these are not understood by GCC
+ target_link_options(${PARAMS_TGT} PRIVATE
+ -Wl,--as-needed
+ -Wl,--sort-section=alignment
+ # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
+ )
+ endif()
+
+endfunction()