File tree Expand file tree Collapse file tree 7 files changed +18
-6
lines changed Expand file tree Collapse file tree 7 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -94,12 +94,12 @@ elseif (CONFIG_NATIVE_LIBRARY)
9494
9595 # Do not use the C library from this compiler/host,
9696 # but still use the basic compiler headers
97- # -fno-builtin to avoid the compiler using builtin replacements for std library functions
97+ # no_builtin to avoid the compiler using builtin replacements for std library functions
9898 zephyr_compile_options(
9999 -nostdinc
100100 -isystem ${COMPILER_OWN_INCLUDE_PATH}
101101 $<TARGET_PROPERTY:compiler,freestanding>
102- -fno-builtin
102+ $<TARGET_PROPERTY:compiler,no_builtin>
103103 )
104104 endif ()
105105endif ()
Original file line number Diff line number Diff line change @@ -206,3 +206,6 @@ endif()
206206
207207# Remove after testing that -Wshadow works
208208set_compiler_property(PROPERTY warning_shadow_variables)
209+
210+ set_compiler_property(PROPERTY no_builtin -fno-builtin)
211+ set_compiler_property(PROPERTY no_builtin_malloc -fno-builtin-malloc)
Original file line number Diff line number Diff line change @@ -133,3 +133,7 @@ set_compiler_property(PROPERTY no_global_merge)
133133
134134# Compiler flag for warning about shadow variables
135135set_compiler_property(PROPERTY warning_shadow_variables)
136+
137+ # Compiler flags to avoid recognizing built-in functions
138+ set_compiler_property(PROPERTY no_builtin)
139+ set_compiler_property(PROPERTY no_builtin_malloc)
Original file line number Diff line number Diff line change @@ -227,3 +227,6 @@ set_compiler_property(PROPERTY no_position_independent
227227set_compiler_property(PROPERTY no_global_merge "" )
228228
229229set_compiler_property(PROPERTY warning_shadow_variables -Wshadow)
230+
231+ set_compiler_property(PROPERTY no_builtin -fno-builtin)
232+ set_compiler_property(PROPERTY no_builtin_malloc -fno-builtin-malloc)
Original file line number Diff line number Diff line change @@ -8,4 +8,4 @@ zephyr_library_sources_ifdef(CONFIG_COMMON_LIBC_MALLOC source/stdlib/malloc.c)
88zephyr_library_sources_ifdef(CONFIG_COMMON_LIBC_STRNLEN source /string /strnlen.c)
99
1010# Prevent compiler from optimizing calloc into an infinite recursive call
11- zephyr_library_cc_option(-fno-builtin-malloc )
11+ zephyr_library_compile_options($<TARGET_PROPERTY:compiler,no_builtin_malloc> )
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ zephyr_library()
77set (GEN_DIR ${ZEPHYR_BINARY_DIR} /include /generated )
88set (STRERROR_TABLE_H ${GEN_DIR} /libc/minimal/strerror_table.h)
99
10- zephyr_library_cc_option(-fno-builtin )
10+ zephyr_library_compile_options($<TARGET_PROPERTY:compiler,no_builtin> )
1111
1212zephyr_library_sources(
1313 source /stdlib/atoi.c
Original file line number Diff line number Diff line change @@ -547,7 +547,8 @@ target_compile_definitions(ot-config INTERFACE
547547# libraries do not include this header. So we add the defines to all
548548# OpenThread files through the gcc flag -imacros instead.
549549target_compile_options (ot-config INTERFACE
550- $<TARGET_PROPERTY:zephyr_interface,INTERFACE_COMPILE_OPTIONS> -fno-builtin
550+ $<TARGET_PROPERTY:zephyr_interface,INTERFACE_COMPILE_OPTIONS>
551+ $<TARGET_PROPERTY:compiler,no_builtin>
551552 -imacros ${AUTOCONF_H}
552553)
553554
@@ -600,7 +601,8 @@ endif()
600601
601602if (CONFIG_OPENTHREAD_SETTINGS_RAM)
602603 target_compile_options (openthread-platform-utils PRIVATE
603- $<TARGET_PROPERTY:zephyr_interface,INTERFACE_COMPILE_OPTIONS> -fno-builtin)
604+ $<TARGET_PROPERTY:zephyr_interface,INTERFACE_COMPILE_OPTIONS>
605+ $<TARGET_PROPERTY:compiler,no_builtin>)
604606 add_dependencies (openthread-platform-utils syscall_list_h_target)
605607
606608 list (APPEND ot_libs openthread-platform-utils-static )
You can’t perform that action at this time.
0 commit comments