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