1# SPDX-License-Identifier: Apache-2.0
2
3include(${ZEPHYR_BASE}/cmake/compiler/xcc/target.cmake)
4
5# Flags not supported by llext linker
6# (regexps are supported and match whole word)
7set(LLEXT_REMOVE_FLAGS
8  -ffunction-sections
9  -fdata-sections
10  -g.*
11  -Os
12  -mcpu=.*
13)
14
15# Flags to be added to llext code compilation
16set(LLEXT_APPEND_FLAGS
17  -nostdlib
18  -nodefaultlibs
19)
20
21if(CONFIG_LLEXT_BUILD_PIC)
22set(LLEXT_REMOVE_FLAGS ${LLEXT_REMOVE_FLAGS}
23  -fno-pic
24  -fno-pie
25)
26set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS}
27  -fPIC
28)
29else()
30set(LLEXT_APPEND_FLAGS ${LLEXT_APPEND_FLAGS}
31  -ffreestanding
32  -mno-generate-flix
33)
34endif()
35