1# Copyright (c) 2024 Nordic Semiconductor
2#
3# SPDX-License-Identifier: Apache-2.0
4
5check_set_linker_property(TARGET linker PROPERTY base
6                          ${LINKERFLAGPREFIX},--gc-sections
7                          ${LINKERFLAGPREFIX},--build-id=none
8)
9
10if(NOT CONFIG_NATIVE_LIBRARY AND NOT CONFIG_EXTERNAL_MODULE_LIBCPP)
11  set_property(TARGET linker PROPERTY cpp_base -lstdc++)
12endif()
13
14check_set_linker_property(TARGET linker PROPERTY baremetal
15    -nostdlib
16    -static
17    ${LINKERFLAGPREFIX},-X
18    ${LINKERFLAGPREFIX},-N
19)
20
21check_set_linker_property(TARGET linker PROPERTY orphan_warning
22			  ${LINKERFLAGPREFIX},--orphan-handling=warn
23)
24
25check_set_linker_property(TARGET linker PROPERTY orphan_error
26			  ${LINKERFLAGPREFIX},--orphan-handling=error
27)
28
29set_property(TARGET linker PROPERTY partial_linking "-r")
30
31check_set_linker_property(TARGET linker PROPERTY no_relax ${LINKERFLAGPREFIX},--no-relax)
32
33check_set_linker_property(TARGET linker PROPERTY sort_alignment
34                          ${LINKERFLAGPREFIX},--sort-common=descending
35                          ${LINKERFLAGPREFIX},--sort-section=alignment
36)
37