Re: [PATCH][RFC] libstdc++ Provide <cerrno> and <errno.h> for freestanding

Jonathan Wakely <[email protected]> Tue, 4 Aug 2026 17:00:57 +0100
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.libstdc++.devel
Message-ID <CAH6eHdTx_sfa=_FgXYDoEw8en85X8_CtSVK54vtmzHCSq00=Vw@mail.gmail.com>
--0000000000006052d806583ac3a0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, 4 Aug 2026, 12:10 Tomasz Kaminski, <[email protected]> wrote:

>
>
> On Mon, Aug 3, 2026 at 6:58=E2=80=AFPM Jonathan Wakely <[email protected]=
m> wrote:
>
>> The <cerrno> header is freestanding in C++26. Since we don't have to be
>> compatible with a C library or a kernel for freestanding, we can just
>> define the error number macros to arbitrary values.
>>
>> We need to provide a consistent set of definitions whether <cerrno> or
>> <errno.h> is included, and whether a freestanding header is included by
>> using -ffreestanding with a full hosted installation, or with a
>> non-hosted (i.e. --disable-hosted-libstdcxx) installation. We do not
>> want a situation where including <errno.h> uses a system libc header and
>> defines one set of values, but <cerrno> provides our own freestanding
>> values.
>>
>> The approach taken here is to install our own copy of <errno.h> which
>> does #include_next <errno.h> for hosted and which defines its own values
>> for freestanding. Our <cerrno> will then find our own <errno.h> and so
>> <cerrno> and <errno.h> will be consistent, and the macro values will
>> always be the same for the freestanding headers.
>>
>> libstdc++-v3/ChangeLog:
>>
>>         * include/Makefile.am (c_base_freestanding): Move cerrno to
>>         here from ...
>>         (c_base_headers): ... here.
>>         (c_compatibility_headers): Add errno.h.
>>         * include/Makefile.in: Regenerate.
>>         * include/c_compatibility/errno.h: Replace include <cerrno> with
>>         include_next <errno.h>.
>>         [!_GLIBCXX_HOSTED] (E2BIG,EACCES,EADDRINUSE,EADDRNOTAVAIL)
>>         (EAFNOSUPPORT,EAGAIN,EALREADY,EBADF,EBADMSG,EBUSY,ECANCELED)
>>         (ECHILD,ECONNABORTED,ECONNREFUSED,ECONNRESET,EDEADLK)
>>         (EDESTADDRREQ,EDOM,EEXIST,EFAULT,EFBIG,EHOSTUNREACH,EIDRM)
>>         (EILSEQ,EINPROGRESS,EINTR,EINVAL,EIO,EISCONN,EISDIR,ELOOP)
>>         (EMFILE,EMLINK,EMSGSIZE,ENAMETOOLONG,ENETDOWN,ENETRESET)
>>         (ENETUNREACH,ENFILE,ENOBUFS,ENODEV,ENOENT,ENOEXEC,ENOLCK)
>>         (ENOLINK,ENOMEM,ENOMSG,ENOPROTOOPT,ENOSPC,ENOSYS,ENOTCONN)
>>         (ENOTDIR,ENOTEMPTY,ENOTRECOVERABLE,ENOTSOCK,ENOTSUP,ENOTTY)
>>         (ENXIO,EOPNOTSUPP,EOVERFLOW,EOWNERDEAD,EPERM,EPIPE,EPROTO)
>>         (EPROTONOSUPPORT,EPROTOTYPE,ERANGE,EROFS,ESPIPE,ESRCH)
>>         (ETIMEDOUT,ETXTBSY,EWOULDBLOCK,EXDEV): Define.
>> ---
>>
>> I don't really like this patch, but sending it for comment.
>>
>> Every time we add our own <name.h> C header it complicates things, and
>> we have various bug reports (and patches) related to those files causing
>> problems during bootstrap of obscure canadian-cross configurations.
>>
>> So I'm a bit concerned that adding <errno.h> just for Freestanding would
>> end up causing regressions that affect Hosted builds too.
>>
> We are already conditionally installing more headers for Hosted builds, s=
o
> could we conditionally install the new header only for environments that
> are
> not hosted? This should avoid any potential impact on existing platforms.
>

That won't work, not consistently anyway. For freestanding, you can either
build GCC with --disable-hosted-libstdcxx or you can build a hosted
implementation but then use -ffreestanding.

If we install different headers for the non-hosted build, you would not be
able to include errno.h with -ffreestanding, or you would get the libc one
which would have different error numbers.

Maybe that's ok, and users would need to use a consistent "really
freestanding" or "hosted but used as freestanding" installation. But I
think it would be surprising.





>>
>>  libstdc++-v3/include/Makefile.am             |  3 +-
>>  libstdc++-v3/include/Makefile.in             |  3 +-
>>  libstdc++-v3/include/c_compatibility/errno.h | 91 +++++++++++++++++++-
>>  3 files changed, 94 insertions(+), 3 deletions(-)
>>
>> diff --git a/libstdc++-v3/include/Makefile.am
>> b/libstdc++-v3/include/Makefile.am
>> index 3c30aa21d6b5..18bb9f224563 100644
>> --- a/libstdc++-v3/include/Makefile.am
>> +++ b/libstdc++-v3/include/Makefile.am
>> @@ -902,6 +902,7 @@ endif
>>  c_base_srcdir =3D $(C_INCLUDE_DIR)
>>  c_base_builddir =3D .
>>  c_base_freestanding =3D \
>> +       ${c_base_srcdir}/cerrno \
>>         ${c_base_srcdir}/cfloat \
>>         ${c_base_srcdir}/climits \
>>         ${c_base_srcdir}/cstdalign \
>> @@ -919,7 +920,6 @@ c_base_headers =3D \
>>         ${c_base_srcdir}/cassert \
>>         ${c_base_srcdir}/ccomplex \
>>         ${c_base_srcdir}/cctype \
>> -       ${c_base_srcdir}/cerrno \
>>         ${c_base_srcdir}/cfenv \
>>         ${c_base_srcdir}/cinttypes \
>>         ${c_base_srcdir}/ciso646 \
>> @@ -947,6 +947,7 @@ endif
>>  if GLIBCXX_C_HEADERS_C_GLOBAL
>>  c_compatibility_headers =3D \
>>         ${c_compatibility_srcdir}/complex.h \
>> +       ${c_compatibility_srcdir}/errno.h \
>>         ${c_compatibility_srcdir}/fenv.h \
>>         ${c_compatibility_srcdir}/tgmath.h \
>>         ${c_compatibility_srcdir}/math.h \
>> diff --git a/libstdc++-v3/include/Makefile.in
>> b/libstdc++-v3/include/Makefile.in
>> index d081481293ff..feb6665ca401 100644
>> --- a/libstdc++-v3/include/Makefile.in
>> +++ b/libstdc++-v3/include/Makefile.in
>> @@ -1250,6 +1250,7 @@ experimental_bits_headers =3D \
>>  c_base_srcdir =3D $(C_INCLUDE_DIR)
>>  c_base_builddir =3D .
>>  c_base_freestanding =3D \
>> +       ${c_base_srcdir}/cerrno \
>>         ${c_base_srcdir}/cfloat \
>>         ${c_base_srcdir}/climits \
>>         ${c_base_srcdir}/cstdalign \
>> @@ -1265,7 +1266,6 @@ c_base_freestanding =3D \
>>  @GLIBCXX_HOSTED_TRUE@  ${c_base_srcdir}/cassert \
>>  @GLIBCXX_HOSTED_TRUE@  ${c_base_srcdir}/ccomplex \
>>  @GLIBCXX_HOSTED_TRUE@  ${c_base_srcdir}/cctype \
>> -@GLIBCXX_HOSTED_TRUE@  ${c_base_srcdir}/cerrno \
>>  @GLIBCXX_HOSTED_TRUE@  ${c_base_srcdir}/cfenv \
>>  @GLIBCXX_HOSTED_TRUE@  ${c_base_srcdir}/cinttypes \
>>  @GLIBCXX_HOSTED_TRUE@  ${c_base_srcdir}/ciso646 \
>> @@ -1287,6 +1287,7 @@ c_compatibility_srcdir =3D
>> ${glibcxx_srcdir}/include/c_compatibility
>>  c_compatibility_builddir =3D .
>>  @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@c_compatibility_headers =3D \
>>  @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@
>> ${c_compatibility_srcdir}/complex.h \
>> +@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@
>> ${c_compatibility_srcdir}/errno.h \
>>  @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@      ${c_compatibility_srcdir}/fenv.h
>> \
>>  @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@
>> ${c_compatibility_srcdir}/tgmath.h \
>>  @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@      ${c_compatibility_srcdir}/math.h
>> \
>> diff --git a/libstdc++-v3/include/c_compatibility/errno.h
>> b/libstdc++-v3/include/c_compatibility/errno.h
>> index 07e3c17e9173..3eea20e081bb 100644
>> --- a/libstdc++-v3/include/c_compatibility/errno.h
>> +++ b/libstdc++-v3/include/c_compatibility/errno.h
>> @@ -29,6 +29,95 @@
>>  #ifndef _GLIBCXX_ERRNO_H
>>  #define _GLIBCXX_ERRNO_H 1
>>
>> -#include <cerrno>
>> +#include <bits/c++config.h>
>> +
>> +#if _GLIBCXX_HOSTED
>>
> Should whe use _has_include_next(<errno.h>)? So pull this header
> if it is provided?
>

It's required for hosted implementations, and we know it's always present
because everybody can already include it today.


+#include_next <errno.h>
>> +// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
>> +#ifndef errno
>> +#define errno errno
>> +#endif
>> +
>> +#else
>> +__thread inline int __errno_v =3D 0;
>> +
>> +#define errno __errno_v
>> +
>> +#define E2BIG  10007
>> +#define EACCES  10013
>> +#define EADDRINUSE  10098
>> +#define EADDRNOTAVAIL  10099
>> +#define EAFNOSUPPORT  10097
>> +#define EAGAIN  10011
>> +#define EALREADY  10114
>> +#define EBADF  10009
>> +#define EBADMSG  10074
>> +#define EBUSY  10016
>> +#define ECANCELED  10125
>> +#define ECHILD  10010
>> +#define ECONNABORTED  10103
>> +#define ECONNREFUSED  10111
>> +#define ECONNRESET  10104
>> +#define EDEADLK  10035
>> +#define EDESTADDRREQ  10089
>> +#define EDOM  10033
>> +#define EEXIST  10017
>> +#define EFAULT  10014
>> +#define EFBIG  10027
>> +#define EHOSTUNREACH  10113
>> +#define EIDRM  10043
>> +#define EILSEQ  10084
>> +#define EINPROGRESS  10115
>> +#define EINTR  10004
>> +#define EINVAL  10022
>> +#define EIO  10005
>> +#define EISCONN  10106
>> +#define EISDIR  10021
>> +#define ELOOP  10040
>> +#define EMFILE  10024
>> +#define EMLINK  10031
>> +#define EMSGSIZE  10090
>> +#define ENAMETOOLONG  10036
>> +#define ENETDOWN  10100
>> +#define ENETRESET  10102
>> +#define ENETUNREACH  10101
>> +#define ENFILE  10023
>> +#define ENOBUFS  10105
>> +#define ENODEV  10019
>> +#define ENOENT  10002
>> +#define ENOEXEC  10008
>> +#define ENOLCK  10037
>> +#define ENOLINK  10067
>> +#define ENOMEM  10012
>> +#define ENOMSG  10042
>> +#define ENOPROTOOPT  10092
>> +#define ENOSPC  10028
>> +#define ENOSYS  10038
>> +#define ENOTCONN  10107
>> +#define ENOTDIR  10020
>> +#define ENOTEMPTY  10039
>> +#define ENOTRECOVERABLE  10131
>> +#define ENOTSOCK  10088
>> +#define ENOTSUP  10095
>> +#define ENOTTY  10025
>> +#define ENXIO  10006
>> +#define EOPNOTSUPP  10095
>> +#define EOVERFLOW  10075
>> +#define EOWNERDEAD  10130
>> +#define EPERM  10001
>> +#define EPIPE  10032
>> +#define EPROTO  10071
>> +#define EPROTONOSUPPORT  10093
>> +#define EPROTOTYPE  10091
>> +#define ERANGE  10034
>> +#define EROFS  10030
>> +#define ESPIPE  10029
>> +#define ESRCH  10003
>> +#define ETIMEDOUT  10110
>> +#define ETXTBSY  10026
>> +#define EWOULDBLOCK  10011
>> +#define EXDEV  10018
>> +
>> +#endif // HOSTED
>>
>>  #endif
>> --
>> 2.55.0
>>
>>

--0000000000006052d806583ac3a0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><br><br><div class=3D"gmail_quote gmail_quote_contai=
ner"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, 4 Aug 2026, 12:10 Tomasz=
 Kaminski, &lt;<a href=3D"mailto:[email protected]">[email protected]</=
a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><d=
iv dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote"><d=
iv dir=3D"ltr" class=3D"gmail_attr">On Mon, Aug 3, 2026 at 6:58=E2=80=AFPM =
Jonathan Wakely &lt;<a href=3D"mailto:[email protected]" target=3D"_blank"=
 rel=3D"noreferrer">[email protected]</a>&gt; wrote:<br></div><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol=
id rgb(204,204,204);padding-left:1ex">The &lt;cerrno&gt; header is freestan=
ding in C++26. Since we don&#39;t have to be<br>
compatible with a C library or a kernel for freestanding, we can just<br>
define the error number macros to arbitrary values.<br>
<br>
We need to provide a consistent set of definitions whether &lt;cerrno&gt; o=
r<br>
&lt;errno.h&gt; is included, and whether a freestanding header is included =
by<br>
using -ffreestanding with a full hosted installation, or with a<br>
non-hosted (i.e. --disable-hosted-libstdcxx) installation. We do not<br>
want a situation where including &lt;errno.h&gt; uses a system libc header =
and<br>
defines one set of values, but &lt;cerrno&gt; provides our own freestanding=
<br>
values.<br>
<br>
The approach taken here is to install our own copy of &lt;errno.h&gt; which=
<br>
does #include_next &lt;errno.h&gt; for hosted and which defines its own val=
ues<br>
for freestanding. Our &lt;cerrno&gt; will then find our own &lt;errno.h&gt;=
 and so<br>
&lt;cerrno&gt; and &lt;errno.h&gt; will be consistent, and the macro values=
 will<br>
always be the same for the freestanding headers.<br>
<br>
libstdc++-v3/ChangeLog:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 * include/Makefile.am (c_base_freestanding): Mo=
ve cerrno to<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 here from ...<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (c_base_headers): ... here.<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (c_compatibility_headers): Add errno.h.<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 * include/Makefile.in: Regenerate.<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 * include/c_compatibility/errno.h: Replace incl=
ude &lt;cerrno&gt; with<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 include_next &lt;errno.h&gt;.<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 [!_GLIBCXX_HOSTED] (E2BIG,EACCES,EADDRINUSE,EAD=
DRNOTAVAIL)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (EAFNOSUPPORT,EAGAIN,EALREADY,EBADF,EBADMSG,EBU=
SY,ECANCELED)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (ECHILD,ECONNABORTED,ECONNREFUSED,ECONNRESET,ED=
EADLK)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (EDESTADDRREQ,EDOM,EEXIST,EFAULT,EFBIG,EHOSTUNR=
EACH,EIDRM)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (EILSEQ,EINPROGRESS,EINTR,EINVAL,EIO,EISCONN,EI=
SDIR,ELOOP)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (EMFILE,EMLINK,EMSGSIZE,ENAMETOOLONG,ENETDOWN,E=
NETRESET)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (ENETUNREACH,ENFILE,ENOBUFS,ENODEV,ENOENT,ENOEX=
EC,ENOLCK)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (ENOLINK,ENOMEM,ENOMSG,ENOPROTOOPT,ENOSPC,ENOSY=
S,ENOTCONN)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (ENOTDIR,ENOTEMPTY,ENOTRECOVERABLE,ENOTSOCK,ENO=
TSUP,ENOTTY)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (ENXIO,EOPNOTSUPP,EOVERFLOW,EOWNERDEAD,EPERM,EP=
IPE,EPROTO)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (EPROTONOSUPPORT,EPROTOTYPE,ERANGE,EROFS,ESPIPE=
,ESRCH)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (ETIMEDOUT,ETXTBSY,EWOULDBLOCK,EXDEV): Define.<=
br>
---<br>
<br>
I don&#39;t really like this patch, but sending it for comment.<br>
<br>
Every time we add our own &lt;name.h&gt; C header it complicates things, an=
d<br>
we have various bug reports (and patches) related to those files causing<br=
>
problems during bootstrap of obscure canadian-cross configurations.<br>
<br>
So I&#39;m a bit concerned that adding &lt;errno.h&gt; just for Freestandin=
g would<br>
end up causing regressions that affect Hosted builds too.<br></blockquote><=
div>We are already conditionally installing more headers for Hosted builds,=
 so</div><div>could we conditionally install the new header only for enviro=
nments that are</div><div>not hosted? This should avoid any potential impac=
t on existing platforms.</div></div></div></blockquote></div></div><div dir=
=3D"auto"><br></div><div dir=3D"auto">That won&#39;t work, not consistently=
 anyway. For freestanding, you can either build GCC with --disable-hosted-l=
ibstdcxx or you can build a hosted implementation but then use -ffreestandi=
ng.</div><div dir=3D"auto"><br></div><div dir=3D"auto">If we install differ=
ent headers for the non-hosted build, you would not be able to include errn=
o.h with -ffreestanding, or you would get the libc one which would have dif=
ferent error numbers.</div><div dir=3D"auto"><br></div><div dir=3D"auto">Ma=
ybe that&#39;s ok, and users would need to use a consistent &quot;really fr=
eestanding&quot; or &quot;hosted but used as freestanding&quot; installatio=
n. But I think it would be surprising.=C2=A0</div><div dir=3D"auto"><br></d=
iv><div dir=3D"auto"><br></div><div dir=3D"auto"><br></div><div dir=3D"auto=
"><br></div><div dir=3D"auto"><div class=3D"gmail_quote gmail_quote_contain=
er"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div=
 class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
=C2=A0libstdc++-v3/include/Makefile.am=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0|=C2=A0 3 +-<br>
=C2=A0libstdc++-v3/include/Makefile.in=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0|=C2=A0 3 +-<br>
=C2=A0libstdc++-v3/include/c_compatibility/errno.h | 91 +++++++++++++++++++=
-<br>
=C2=A03 files changed, 94 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefi=
le.am<br>
index 3c30aa21d6b5..18bb9f224563 100644<br>
--- a/libstdc++-v3/include/Makefile.am<br>
+++ b/libstdc++-v3/include/Makefile.am<br>
@@ -902,6 +902,7 @@ endif<br>
=C2=A0c_base_srcdir =3D $(C_INCLUDE_DIR)<br>
=C2=A0c_base_builddir =3D .<br>
=C2=A0c_base_freestanding =3D \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0${c_base_srcdir}/cerrno \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/cfloat \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/climits \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/cstdalign \<br>
@@ -919,7 +920,6 @@ c_base_headers =3D \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/cassert \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/ccomplex \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/cctype \<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0${c_base_srcdir}/cerrno \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/cfenv \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/cinttypes \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/ciso646 \<br>
@@ -947,6 +947,7 @@ endif<br>
=C2=A0if GLIBCXX_C_HEADERS_C_GLOBAL<br>
=C2=A0c_compatibility_headers =3D \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_compatibility_srcdir}/complex.h \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0${c_compatibility_srcdir}/errno.h \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_compatibility_srcdir}/fenv.h \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_compatibility_srcdir}/tgmath.h \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_compatibility_srcdir}/math.h \<br>
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefi=
le.in<br>
index d081481293ff..feb6665ca401 100644<br>
--- a/libstdc++-v3/include/Makefile.in<br>
+++ b/libstdc++-v3/include/Makefile.in<br>
@@ -1250,6 +1250,7 @@ experimental_bits_headers =3D \<br>
=C2=A0c_base_srcdir =3D $(C_INCLUDE_DIR)<br>
=C2=A0c_base_builddir =3D .<br>
=C2=A0c_base_freestanding =3D \<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0${c_base_srcdir}/cerrno \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/cfloat \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/climits \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ${c_base_srcdir}/cstdalign \<br>
@@ -1265,7 +1266,6 @@ c_base_freestanding =3D \<br>
=C2=A0@GLIBCXX_HOSTED_TRUE@=C2=A0 ${c_base_srcdir}/cassert \<br>
=C2=A0@GLIBCXX_HOSTED_TRUE@=C2=A0 ${c_base_srcdir}/ccomplex \<br>
=C2=A0@GLIBCXX_HOSTED_TRUE@=C2=A0 ${c_base_srcdir}/cctype \<br>
-@GLIBCXX_HOSTED_TRUE@=C2=A0 ${c_base_srcdir}/cerrno \<br>
=C2=A0@GLIBCXX_HOSTED_TRUE@=C2=A0 ${c_base_srcdir}/cfenv \<br>
=C2=A0@GLIBCXX_HOSTED_TRUE@=C2=A0 ${c_base_srcdir}/cinttypes \<br>
=C2=A0@GLIBCXX_HOSTED_TRUE@=C2=A0 ${c_base_srcdir}/ciso646 \<br>
@@ -1287,6 +1287,7 @@ c_compatibility_srcdir =3D ${glibcxx_srcdir}/include/=
c_compatibility<br>
=C2=A0c_compatibility_builddir =3D .<br>
=C2=A0@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@c_compatibility_headers =3D \<br>
=C2=A0@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@=C2=A0 =C2=A0 =C2=A0 ${c_compatibili=
ty_srcdir}/complex.h \<br>
+@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@=C2=A0 =C2=A0 =C2=A0 ${c_compatibility_sr=
cdir}/errno.h \<br>
=C2=A0@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@=C2=A0 =C2=A0 =C2=A0 ${c_compatibili=
ty_srcdir}/fenv.h \<br>
=C2=A0@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@=C2=A0 =C2=A0 =C2=A0 ${c_compatibili=
ty_srcdir}/tgmath.h \<br>
=C2=A0@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@=C2=A0 =C2=A0 =C2=A0 ${c_compatibili=
ty_srcdir}/math.h \<br>
diff --git a/libstdc++-v3/include/c_compatibility/errno.h b/libstdc++-v3/in=
clude/c_compatibility/errno.h<br>
index 07e3c17e9173..3eea20e081bb 100644<br>
--- a/libstdc++-v3/include/c_compatibility/errno.h<br>
+++ b/libstdc++-v3/include/c_compatibility/errno.h<br>
@@ -29,6 +29,95 @@<br>
=C2=A0#ifndef _GLIBCXX_ERRNO_H<br>
=C2=A0#define _GLIBCXX_ERRNO_H 1<br>
<br>
-#include &lt;cerrno&gt;<br>
+#include &lt;bits/c++config.h&gt;<br>
+<br>
+#if _GLIBCXX_HOSTED<br></blockquote><div>Should whe use _has_include_next(=
&lt;errno.h&gt;)? So pull this header</div><div>if it is provided?=C2=A0</d=
iv></div></div></blockquote></div></div><div dir=3D"auto"><br></div><div di=
r=3D"auto">It&#39;s required for hosted implementations, and we know it&#39=
;s always present because everybody can already include it today.</div><div=
 dir=3D"auto"><br></div><div dir=3D"auto"><br></div><div dir=3D"auto"><div =
class=3D"gmail_quote gmail_quote_container"><blockquote class=3D"gmail_quot=
e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)=
;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol=
id rgb(204,204,204);padding-left:1ex">
+#include_next &lt;errno.h&gt;<br>
+// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998<br>
+#ifndef errno<br>
+#define errno errno<br>
+#endif<br>
+<br>
+#else<br>
+__thread inline int __errno_v =3D 0;<br>
+<br>
+#define errno __errno_v<br>
+<br>
+#define E2BIG=C2=A0 10007<br>
+#define EACCES=C2=A0 10013<br>
+#define EADDRINUSE=C2=A0 10098<br>
+#define EADDRNOTAVAIL=C2=A0 10099<br>
+#define EAFNOSUPPORT=C2=A0 10097<br>
+#define EAGAIN=C2=A0 10011<br>
+#define EALREADY=C2=A0 10114<br>
+#define EBADF=C2=A0 10009<br>
+#define EBADMSG=C2=A0 10074<br>
+#define EBUSY=C2=A0 10016<br>
+#define ECANCELED=C2=A0 10125<br>
+#define ECHILD=C2=A0 10010<br>
+#define ECONNABORTED=C2=A0 10103<br>
+#define ECONNREFUSED=C2=A0 10111<br>
+#define ECONNRESET=C2=A0 10104<br>
+#define EDEADLK=C2=A0 10035<br>
+#define EDESTADDRREQ=C2=A0 10089<br>
+#define EDOM=C2=A0 10033<br>
+#define EEXIST=C2=A0 10017<br>
+#define EFAULT=C2=A0 10014<br>
+#define EFBIG=C2=A0 10027<br>
+#define EHOSTUNREACH=C2=A0 10113<br>
+#define EIDRM=C2=A0 10043<br>
+#define EILSEQ=C2=A0 10084<br>
+#define EINPROGRESS=C2=A0 10115<br>
+#define EINTR=C2=A0 10004<br>
+#define EINVAL=C2=A0 10022<br>
+#define EIO=C2=A0 10005<br>
+#define EISCONN=C2=A0 10106<br>
+#define EISDIR=C2=A0 10021<br>
+#define ELOOP=C2=A0 10040<br>
+#define EMFILE=C2=A0 10024<br>
+#define EMLINK=C2=A0 10031<br>
+#define EMSGSIZE=C2=A0 10090<br>
+#define ENAMETOOLONG=C2=A0 10036<br>
+#define ENETDOWN=C2=A0 10100<br>
+#define ENETRESET=C2=A0 10102<br>
+#define ENETUNREACH=C2=A0 10101<br>
+#define ENFILE=C2=A0 10023<br>
+#define ENOBUFS=C2=A0 10105<br>
+#define ENODEV=C2=A0 10019<br>
+#define ENOENT=C2=A0 10002<br>
+#define ENOEXEC=C2=A0 10008<br>
+#define ENOLCK=C2=A0 10037<br>
+#define ENOLINK=C2=A0 10067<br>
+#define ENOMEM=C2=A0 10012<br>
+#define ENOMSG=C2=A0 10042<br>
+#define ENOPROTOOPT=C2=A0 10092<br>
+#define ENOSPC=C2=A0 10028<br>
+#define ENOSYS=C2=A0 10038<br>
+#define ENOTCONN=C2=A0 10107<br>
+#define ENOTDIR=C2=A0 10020<br>
+#define ENOTEMPTY=C2=A0 10039<br>
+#define ENOTRECOVERABLE=C2=A0 10131<br>
+#define ENOTSOCK=C2=A0 10088<br>
+#define ENOTSUP=C2=A0 10095<br>
+#define ENOTTY=C2=A0 10025<br>
+#define ENXIO=C2=A0 10006<br>
+#define EOPNOTSUPP=C2=A0 10095<br>
+#define EOVERFLOW=C2=A0 10075<br>
+#define EOWNERDEAD=C2=A0 10130<br>
+#define EPERM=C2=A0 10001<br>
+#define EPIPE=C2=A0 10032<br>
+#define EPROTO=C2=A0 10071<br>
+#define EPROTONOSUPPORT=C2=A0 10093<br>
+#define EPROTOTYPE=C2=A0 10091<br>
+#define ERANGE=C2=A0 10034<br>
+#define EROFS=C2=A0 10030<br>
+#define ESPIPE=C2=A0 10029<br>
+#define ESRCH=C2=A0 10003<br>
+#define ETIMEDOUT=C2=A0 10110<br>
+#define ETXTBSY=C2=A0 10026<br>
+#define EWOULDBLOCK=C2=A0 10011<br>
+#define EXDEV=C2=A0 10018<br>
+<br>
+#endif // HOSTED<br>
<br>
=C2=A0#endif<br>
-- <br>
2.55.0<br>
<br>
</blockquote></div></div>
</blockquote></div></div></div>

--0000000000006052d806583ac3a0--