newlib: disable some optimizations for syscalls.c

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.
This commit is contained in:
Ivan Grokhotkov 2018-11-22 12:19:49 +08:00
parent 0d7f2d77c2
commit 8deb885ce3
2 changed files with 4 additions and 0 deletions

View File

@ -30,3 +30,5 @@ register_component()
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)

View File

@ -20,3 +20,5 @@ COMPONENT_ADD_LDFLAGS := $(LIBC_PATH) $(LIBM_PATH) -lnewlib
COMPONENT_ADD_LINKER_DEPS := $(LIBC_PATH) $(LIBM_PATH)
COMPONENT_ADD_INCLUDEDIRS := platform_include include
syscalls.o: CFLAGS += -fno-builtin