1# Copyright (c) 2022 Google LLC
2# Copyright (c) 2024 Nordic Semiconductor
3#
4# SPDX-License-Identifier: Apache-2.0
5
6# Since lld is a drop in replacement for ld, we can just use ld's flags as a base
7# and adjust for lld specifics afterwards.
8include(${ZEPHYR_BASE}/cmake/linker/ld/linker_flags.cmake OPTIONAL)
9
10if(NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP)
11  set_property(TARGET linker PROPERTY cpp_base ${LINKERFLAGPREFIX},-z,norelro)
12endif()
13
14set_property(TARGET linker PROPERTY no_position_independent "${LINKERFLAGPREFIX},--no-pie")
15
16set_property(TARGET linker PROPERTY lto_arguments)
17
18check_set_linker_property(TARGET linker PROPERTY sort_alignment ${LINKERFLAGPREFIX},--sort-section=alignment)
19
20if(CONFIG_RISCV_GP)
21  check_set_linker_property(TARGET linker PROPERTY relax ${LINKERFLAGPREFIX},--relax-gp)
22endif()
23