From cefbba59925a01248b63ed85e0d0f96bfd1fed13 Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Wed, 10 Jul 2019 01:54:14 -0700 Subject: [PATCH] Build newlib with POSIX mode - newlib was default to XOPEN MODE before 2018/12/6[1], but newlib decide to remove XOPEN mode SVID3 mode, and change the default IEEE mode. - The problem is IEEE won't set errno on several math function, so build with POSIX mode would be better for newlib. - For newlib nano, we might able to build with _IEEE_LIBM in future to reduce code size, and improve performance. [1] https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=b14a879d85b171960df789ac8ba2332004f838e0 --- Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index c7938b72..12e39343 100644 --- a/Makefile.in +++ b/Makefile.in @@ -477,8 +477,8 @@ stamps/build-newlib: $(srcdir)/riscv-newlib stamps/build-gcc-newlib-stage1 --enable-newlib-io-long-long \ --enable-newlib-io-c99-formats \ --enable-newlib-register-fini \ - CFLAGS_FOR_TARGET="-O2 $(CFLAGS_FOR_TARGET)" \ - CXXFLAGS_FOR_TARGET="-O2 $(CXXFLAGS_FOR_TARGET)" + CFLAGS_FOR_TARGET="-O2 -D_POSIX_MODE $(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="-O2 -D_POSIX_MODE $(CXXFLAGS_FOR_TARGET)" $(MAKE) -C $(notdir $@) $(MAKE) -C $(notdir $@) install mkdir -p $(dir $@) && touch $@