1# Copyright (c) 2024 Nordic Semiconductor
2#
3# SPDX-License-Identifier: Apache-2.0
4
5set_property(TARGET linker PROPERTY cpp_base -Hcplus)
6
7check_set_linker_property(TARGET linker PROPERTY baremetal
8                          -Hlld
9                          -Hnosdata
10                          -Xtimer0 # to suppress the warning message
11                          -Hnoxcheck_obj
12                          -Hnocplus
13                          -Hhostlib=
14                          -Hheap=0
15                          -Hnoivt
16                          -Hnocrt
17)
18
19# There are two options:
20# - We have full MWDT libc support and we link MWDT libc - this is default
21#   behavior and we don't need to do something for that.
22# - We use minimal libc provided by Zephyr itself. In that case we must not
23#   link MWDT libc, but we still need to link libmw
24if(CONFIG_MINIMAL_LIBC)
25  check_set_linker_property(TARGET linker APPEND PROPERTY baremetal
26                            -Hnolib
27                            -Hldopt=-lmw
28  )
29endif()
30
31check_set_linker_property(TARGET linker PROPERTY orphan_warning
32                          ${LINKERFLAGPREFIX},--orphan-handling=warn
33)
34
35check_set_linker_property(TARGET linker PROPERTY orphan_error
36                          ${LINKERFLAGPREFIX},--orphan-handling=error
37)
38
39# Extra warnings options for twister run
40set_property(TARGET linker PROPERTY warnings_as_errors -Wl,--fatal-warnings)
41
42check_set_linker_property(TARGET linker PROPERTY sort_alignment -Wl,--sort-section=alignment)
43