Don’t allow the compiler to convert malloc + memset into calloc,
causing a recursive call in _calloc_r. Fixes crash when building with
-O2 optimization level.
target_link_libraries(newlib "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib")
target_link_libraries(newlib ${LIBC} ${LIBM})
+
+set_source_files_properties(syscalls.c PROPERTIES COMPILE_FLAGS -fno-builtin)
COMPONENT_ADD_LINKER_DEPS := $(LIBC_PATH) $(LIBM_PATH)
COMPONENT_ADD_INCLUDEDIRS := platform_include include
+
+syscalls.o: CFLAGS += -fno-builtin