Skip to content
Permalink
Browse files

cmake: Toolchain abstraction: introduce LINKER variable

The LINKER variable is introduced to follow the same logic and flow as
the existing COMPILER variable: That is, each TOOLCHAIN is responsible
for choosing COMPILER and LINKER.

Currently, Zephyr's build system is hardcoded for GNU ld.
Reflect this in LINKER by letting all existing toolchains use GNU ld.

No functional change expected.

This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
  • Loading branch information...
mped-oticon authored and nashif committed Apr 25, 2019
1 parent 3419efd commit 0cad53b5ce3f4041998c72d8abd7869a2caaac24
@@ -25,3 +25,4 @@ set( CROSS_COMPILE ${CROSS_COMPILE} CACHE PATH "")
assert(CROSS_COMPILE "CROSS_COMPILE is not set")

set(COMPILER gcc)
set(LINKER ld)
@@ -7,6 +7,7 @@ assert( ESPRESSIF_TOOLCHAIN_PATH "ESPRESSIF_TOOLCHAIN_PATH is not set")
set(TOOLCHAIN_HOME ${ESPRESSIF_TOOLCHAIN_PATH})

set(COMPILER gcc)
set(LINKER ld)

set(CROSS_COMPILE_TARGET xtensa-esp32-elf)
set(SYSROOT_TARGET xtensa-esp32-elf)
@@ -19,6 +19,7 @@ endif()
set(TOOLCHAIN_HOME ${GNUARMEMB_TOOLCHAIN_PATH})

set(COMPILER gcc)
set(LINKER ld)

set(CROSS_COMPILE_TARGET arm-none-eabi)
set(SYSROOT_TARGET arm-none-eabi)
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

set(COMPILER host-gcc)
set(LINKER ld)
set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib")
@@ -11,6 +11,7 @@ set( ISSM_INSTALLATION_PATH ${ISSM_INSTALLATION_PATH} CACHE PATH "")
assert( ISSM_INSTALLATION_PATH "ISSM_INSTALLATION_PATH is not set")

set(COMPILER gcc)
set(LINKER ld)

set(TOOLCHAIN_VENDOR intel)

@@ -6,6 +6,7 @@ set_ifndef(CLANG_ROOT /usr)
set(TOOLCHAIN_HOME ${CLANG_ROOT}/bin/)

set(COMPILER clang)
set(LINKER ld) # TODO: Use lld eventually rather than GNU ld

if("${ARCH}" STREQUAL "arm")
set(triple arm-none-eabi)
@@ -11,6 +11,7 @@ endif()
set(TOOLCHAIN_HOME ${XTENSA_TOOLCHAIN_PATH}/XtDevTools/install/tools/$ENV{TOOLCHAIN_VER}/XtensaTools)

set(COMPILER xcc)
set(LINKER ld)

set(CROSS_COMPILE_TARGET xt)
set(SYSROOT_TARGET xtensa-elf)
@@ -7,6 +7,7 @@ assert( XTOOLS_TOOLCHAIN_PATH "XTOOLS_TOOLCHAIN_PATH is not set")
set(TOOLCHAIN_HOME ${XTOOLS_TOOLCHAIN_PATH})

set(COMPILER gcc)
set(LINKER ld)

# Choose one of the toolchains in 'TOOLCHAIN_HOME' at random to use as
# a 'generic' toolchain until we know for sure which toolchain we
@@ -3,6 +3,7 @@
set(TOOLCHAIN_HOME ${ZEPHYR_SDK_INSTALL_DIR})

set(COMPILER gcc)
set(LINKER ld)

set(CROSS_COMPILE_TARGET i586-${TOOLCHAIN_VENDOR}-elf)
set(SYSROOT_TARGET i586-${TOOLCHAIN_VENDOR}-elf)
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

set(COMPILER gcc)
set(LINKER ld)

set(CROSS_COMPILE_TARGET i586-${TOOLCHAIN_VENDOR}-elf)
set(SYSROOT_TARGET i586-${TOOLCHAIN_VENDOR}-elf)

0 comments on commit 0cad53b

Please sign in to comment.
You can’t perform that action at this time.