On Tue, Nov 29, 2022 at 4:10 PM Ian Lance Taylor <[email protected]> wrote:
>
> On Tue, Nov 29, 2022 at 9:54 AM <[email protected]> wrote:
> >
> > From: Sören Tempel <[email protected]>
> >
> > On glibc, there are two versions of strerror_r: An XSI-compliant and a
> > GNU-specific version. The latter is only available on glibc. In order
> > to avoid duplicating the post-processing code of error messages, this
> > commit provides a separate strerror_go symbol which always refers to the
> > XSI-compliant version of strerror_r (even on glibc) by selectively
> > undefining the corresponding feature test macro.
> >
> > Previously, gofrontend assumed that the GNU-specific version of
> > strerror_r was always available on Linux (which isn't the case when
> > using a musl as a libc, for example). This commit thereby improves
> > compatibility with Linux systems that are not using glibc.
> >
> > Tested on x86_64 Alpine Linux Edge and Arch Linux (glibc 2.36).
>
> Thanks. I committed a version of this, as attached.
I've committed this follow-on patch for Hurd.
Ian
91607eba8fe49c064192122ec60a3e03dd8f2515
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 984d8324004..a26f779557d 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-fef6aa3c1678cdbe7dca454b2cebb369d8ba81bf
+1c5bfd57131b68b91d8400bb017f35d416f7aa7b
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/libgo/runtime/go-strerror.c b/libgo/runtime/go-strerror.c
index 13d1d91df84..8ff5ffbdfec 100644
--- a/libgo/runtime/go-strerror.c
+++ b/libgo/runtime/go-strerror.c
@@ -12,7 +12,7 @@
exists to selectively undefine it and provides an alias to the
XSI-compliant version of strerror_r(3). */
-#ifdef __linux__
+#if defined(__linux__) || defined(__gnu_hurd__)
/* Force selection of XSI-compliant strerror_r by glibc. */
#undef XOPEN_SOURCE
@@ -21,7 +21,7 @@
#define _POSIX_C_SOURCE 200112L
#undef _GNU_SOURCE
-#endif /* __linux__ */
+#endif /* defined(__linux__) || defined(__gnu_hurd__) */
#include <string.h>