summaryrefslogtreecommitdiff
path: root/zephyr/cmake/linker/lld/target.cmake
blob: 10774909a2fc0ba08c1ac4bad298597360a1d656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Include definitions for bfd as a base.  We need to pretend that
# LINKER=ld to do this.
set(LINKER ld)
include("${ZEPHYR_BASE}/cmake/linker/ld/target.cmake")
set(LINKER lld)

# Override the path to the linker.
set(CMAKE_LINKER "${CROSS_COMPILE}ld.lld")

# Zephyr CMake system expects this macro to be defined to provide
# default linker flags.
macro(toolchain_ld_base)
  # For linker scripts, we pretend to bfd-like
  set_property(GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES
    -D__GCC_LINKER_CMD__)

  # Default flags
  zephyr_ld_options(
    ${TOOLCHAIN_LD_FLAGS}
    -no-pie
    -Wl,--gc-sections
    --build-id=none)
endmacro()