__DYNAMIC_REENT__ is used as a preprocessor flag in several public
header files (most importantly, stdio.h). This means that if newlib is
compiled with one set of flags and the rest of the build with another,
the header file and the implementation don't match. This leads to
problems such as stdin/stdoud/stderr not working because they always use
the (non-functional) versions inside _impure_data instead instead of the
current environment's private _reent struct.
Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
################################################################################
ifeq ($(CONFIG_HAVE_SCHED),y)
# if scheduling enabled, then Unikraft provides __getreent()
-LIBNEWLIBC_CFLAGS-y += -D__DYNAMIC_REENT__
+CFLAGS-$(CONFIG_LIBNEWLIBC) += -D__DYNAMIC_REENT__
+CXXFLAGS-$(CONFIG_LIBNEWLIBC) += -D__DYNAMIC_REENT__
else
LIBNEWLIBC_SRCS-y += $(LIBNEWLIB_LIBC)/reent/getreent.c
endif