srcs-y += memchr.c
cflags-remove-memchr.c-y += -Wcast-align
cflags-memchr.c-y += -Wno-sign-compare

srcs-y += memcmp.c
cflags-remove-memcmp.c-y += -Wcast-align

srcs-y += memcpy.c
cflags-remove-memcpy.c-y += -Wcast-align

srcs-y += memmove.c
cflags-remove-memmove.c-y += -Wcast-align

srcs-y += memset.c
cflags-remove-memset.c-y += -Wcast-align
cflags-memset.c-y += -Wno-sign-compare

srcs-y += strcmp.c
cflags-remove-strcmp.c-y += -Wcast-align

srcs-y += strncmp.c
cflags-remove-strncmp.c-y += -Wcast-align

srcs-y += strlen.c
cflags-remove-strlen.c-y += -Wcast-align

srcs-y += strnlen.c

srcs-y += abs.c

srcs-y += memchr.c
cflags-remove-memchr.c-y += -Wcast-align
cflags-memchr.c-y += -Wno-sign-compare

srcs-y += memcmp.c
cflags-remove-memcmp.c-y += -Wcast-align

srcs-y += memcpy.c
cflags-remove-memcpy.c-y += -Wcast-align

srcs-y += memmove.c
cflags-remove-memmove.c-y += -Wcast-align

srcs-y += memset.c
cflags-remove-memset.c-y += -Wcast-align
cflags-memset.c-y += -Wno-sign-compare

srcs-y += strcmp.c
cflags-remove-strcmp.c-y += -Wcast-align

srcs-y += strncmp.c
cflags-remove-strncmp.c-y += -Wcast-align

srcs-y += strlen.c
cflags-remove-strlen.c-y += -Wcast-align

srcs-y += strnlen.c

srcs-y += abs.c

cflags-y += -ffreestanding

Add -ffreestanding to newlib files
newlib: Add -ffreestanding to newlib files

When doing builds with –O3, the GCC compiler in some cases generates
re-entrant code for memset() function which can result in calling itself
infinitely causing overflow of stack & data corruption. One way to
prevent this from happening is to enable the -ffreestanding compiler
flag.

Signed-off-by: Joakim Bech <741f90e2a7f4d9afbad8bd50be20560f4cf38962@linaro.org>
Tested-by: Joakim Bech <741f90e2a7f4d9afbad8bd50be20560f4cf38962@linaro.org> (QEMU)
Suggested-by: Alexei Fedorov <b7acd6fbcbaba825a067fb736083a1aa6aee8cd9@arm.com>
Reviewed-by: Jens Wiklander <7706914404370d7502c27a0eff493dcf491feb51@linaro.org>
Reviewed-by: Pascal Brand <0b55292d2562685bad4ce52d64f802e8f1cd299e@linaro.org>
