From 1f6b3ddcbba7432a5b2f1061f24297989d6ce791 Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Mon, 9 Nov 2020 13:02:44 -0800
Subject: [PATCH] Add picolibc include directory to cc1plus spec

G++ doesn't use the cpp spec to add include directories, so we need to
add the picolibc include directory to the cc1plus spec element as well
as the cpp one. To make sure the libstdc++ headers can use
GCC-provided header directories, so use -idirafter instead of -isystem.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 picolibc.specs.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/picolibc.specs.in
+++ b/picolibc.specs.in
@@ -10,7 +10,7 @@
 @TLSMODEL@ %(picolibc_cc1) @CC1_SPEC@
 
 *cc1plus:
-@TLSMODEL@ %(picolibc_cc1plus) @CC1_SPEC@ @CC1PLUS_SPEC@
+-idirafter @INCLUDEDIR@ @TLSMODEL@ %(picolibc_cc1plus) @CC1_SPEC@ @CC1PLUS_SPEC@
 
 *link:
 @SPECS_PRINTF@ -L@LIBDIR@/%M -L@LIBDIR@ %{!T:-Tpicolibc.ld} %(picolibc_link) --gc-sections @LINK_SPEC@
