Skip to content

Commit f8e1419

Browse files
committed
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.
1 parent 0a53b61 commit f8e1419

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

makefiles/libc/newlib.mk

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ ifeq ($(TOOLCHAIN),llvm)
6969
# in case some header is missing from the cross tool chain
7070
NEWLIB_INCLUDES := -isystem $(NEWLIB_INCLUDE_DIR) -nostdinc
7171
NEWLIB_INCLUDES += $(addprefix -isystem ,$(abspath $(wildcard $(dir $(NEWLIB_INCLUDE_DIR))/usr/include)))
72+
73+
# Newlib includes should go before GCC includes. This is especially important
74+
# when using Clang, because Clang will yield compilation errors on some GCC-
75+
# bundled headers. Clang compatible versions of those headers are already
76+
# provided by Newlib, so placing this directory first will eliminate those problems.
77+
# The above problem was observed with LLVM 3.9.1 when building against GCC 6.3.0 headers.
78+
INCLUDES := $(NEWLIB_INCLUDES) $(INCLUDES)
7279
endif
7380

7481
ifeq (1,$(USE_NEWLIB_NANO))
@@ -79,10 +86,3 @@ ifeq (1,$(USE_NEWLIB_NANO))
7986
# the regular system include dirs.
8087
INCLUDES := -isystem $(NEWLIB_NANO_INCLUDE_DIR) $(INCLUDES)
8188
endif
82-
83-
# Newlib includes should go before GCC includes. This is especially important
84-
# when using Clang, because Clang will yield compilation errors on some GCC-
85-
# bundled headers. Clang compatible versions of those headers are already
86-
# provided by Newlib, so placing this directory first will eliminate those problems.
87-
# The above problem was observed with LLVM 3.9.1 when building against GCC 6.3.0 headers.
88-
export INCLUDES := $(NEWLIB_INCLUDES) $(INCLUDES)

0 commit comments

Comments
 (0)