From 270a0feff6605ab1bc2e85f5c60f6c87d4d96772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Tue, 3 Jul 2018 12:17:46 +0200 Subject: [PATCH] newlib.mk: llvm, fix newlib-nano header not used In the previous state, with llvm and arm for example, newlib-nano include dir NEWLIB_NANO_INCLUDE_DIR is placed after NEWLIB_INCLUDES and so the default 'newlib.h' is used instead of the nano version. (cherry picked from commit f8e1419a315c61efa320752b219092bff2077c2b) --- makefiles/libc/newlib.mk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/makefiles/libc/newlib.mk b/makefiles/libc/newlib.mk index e5a1bc68b1f3..c61370a5d86d 100644 --- a/makefiles/libc/newlib.mk +++ b/makefiles/libc/newlib.mk @@ -69,6 +69,13 @@ ifeq ($(TOOLCHAIN),llvm) # in case some header is missing from the cross tool chain NEWLIB_INCLUDES := -isystem $(NEWLIB_INCLUDE_DIR) -nostdinc NEWLIB_INCLUDES += $(addprefix -isystem ,$(abspath $(wildcard $(dir $(NEWLIB_INCLUDE_DIR))/usr/include))) + + # Newlib includes should go before GCC includes. This is especially important + # when using Clang, because Clang will yield compilation errors on some GCC- + # bundled headers. Clang compatible versions of those headers are already + # provided by Newlib, so placing this directory first will eliminate those problems. + # The above problem was observed with LLVM 3.9.1 when building against GCC 6.3.0 headers. + INCLUDES := $(NEWLIB_INCLUDES) $(INCLUDES) endif ifeq (1,$(USE_NEWLIB_NANO)) @@ -79,10 +86,3 @@ ifeq (1,$(USE_NEWLIB_NANO)) # the regular system include dirs. INCLUDES := -isystem $(NEWLIB_NANO_INCLUDE_DIR) $(INCLUDES) endif - -# Newlib includes should go before GCC includes. This is especially important -# when using Clang, because Clang will yield compilation errors on some GCC- -# bundled headers. Clang compatible versions of those headers are already -# provided by Newlib, so placing this directory first will eliminate those problems. -# The above problem was observed with LLVM 3.9.1 when building against GCC 6.3.0 headers. -export INCLUDES := $(NEWLIB_INCLUDES) $(INCLUDES)