[PATCHv2] gnulib: update to 776af40e0

Paul E. Murphy via Gdb-patches
2021-01-22T19:56:11Z

Changes generated by rerunning are left out as the
resulting patch is too big for the mailing list.

Likewise, tested compilation on x86 and ppc64le,
and I do not have commit access, but I do have
gnu copyright assignment.

V2 updates:

Apply suggested fixes from Simon Marchi and
Christian Biesinger for unoptimized gcc builds
and mingw.

---8<---

This fixes PR27184, a failure to compile gdb due to
cdefs.h being out of sync with glibc on ppc64le targets
which are compiled with -mabi=ieeelongdouble and glibc
2.32.

Likewise, update usage of _GL_ATTRIBUTE_FORMAT_PRINTF to
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD.

Likewise, disable newly added rpl_free gnulib api in
gdbserver support libraries.

Likewise, undefine read/write macros before redefining them
on mingw targets.

Likewise, wrap C++ usage of free with GNULIB_NAMESPACE namespace
as needed.
---
gdbserver/ChangeLog | 7 +++++++
gdbserver/Makefile.in | 2 +-
gdbserver/remote-utils.cc | 4 ++++
gdbsupport/ChangeLog | 7 +++++++
gdbsupport/common-defs.h | 4 ++--
gdbsupport/common-utils.h | 6 +++++-
gnulib/ChangeLog | 5 +++++
gnulib/update-gnulib.sh | 2 +-
8 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index 3323ecfbf89..8aa82967471 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,10 @@
+2021-01-22 Paul E. Murphy <murphyp@linux.ibm.com>
+
+ * Makefile.in (UNDO_GNULIB_CFLAGS): disable
+ gnulib free replacement too.
+ * common-defs.h [USE_WIN32API](read, write): undefine
+ gnulib versions before defining these macros.
+
2021-01-07 Tom de Vries <tdevries@suse.de>

* Makefile.in (LIBIBERTY_NORMAL, LIBIBERTY_NOASAN, LIBIBERTY_PIC):
diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index a14d3a7bc18..8e174da8dcf 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -490,7 +490,7 @@ UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
# Undo gnulib replacements for the IPA shared library build.
# The gnulib headers are still needed, but gnulib is not linked
# into the IPA lib so replacement apis don't work.
-UNDO_GNULIB_CFLAGS = -Drpl_strerror_r=strerror_r
+UNDO_GNULIB_CFLAGS = -Drpl_strerror_r=strerror_r -Drpl_free=free

# Note, we only build the IPA if -fvisibility=hidden is supported in
# the first place.
diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index cfdf1c1883c..4f63d73785d 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -102,6 +102,10 @@ static int remote_desc = -1;
static int listen_desc = -1;

#ifdef USE_WIN32API
+/* gnulib wraps these as macros, undo them. */
+# undef read
+# undef write
+
# define read(fd, buf, len) recv (fd, (char *) buf, len, 0)
# define write(fd, buf, len) send (fd, (char *) buf, len, 0)
#endif
diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
index d973a6daa4f..f032f445693 100644
--- a/gdbsupport/ChangeLog
+++ b/gdbsupport/ChangeLog
@@ -1,3 +1,10 @@
+2021-01-22 Paul E. Murphy <murphy@linux.ibm.com>
+
+ * common-defs.h (ATTRIBUTE_PRINTF): rename
+ _GL_ATTRIBUTE_FORMAT_PRINTF to _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD.
+ * common-utils.h (xfree): use GNULIB_NAMESPACE namespace when calling
+ free if this macro is defined.
+
2021-01-08 Simon Marchi <simon.marchi@polymtl.ca>

PR gdb/27157
diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h
index e5ece3baccc..5b644010cd9 100644
--- a/gdbsupport/common-defs.h
+++ b/gdbsupport/common-defs.h
@@ -105,10 +105,10 @@
/* This is defined by ansidecl.h, but we prefer gnulib's version. On
MinGW, gnulib might enable __USE_MINGW_ANSI_STDIO, which may or not
require use of attribute gnu_printf instead of printf. gnulib
- checks that at configure time. Since _GL_ATTRIBUTE_FORMAT_PRINTF
+ checks that at configure time. Since _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD
is compatible with ATTRIBUTE_PRINTF, simply use it. */
#undef ATTRIBUTE_PRINTF
-#define ATTRIBUTE_PRINTF _GL_ATTRIBUTE_FORMAT_PRINTF
+#define ATTRIBUTE_PRINTF _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD

#if GCC_VERSION >= 3004
#define ATTRIBUTE_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
index 4429f086fce..28c08ee9766 100644
--- a/gdbsupport/common-utils.h
+++ b/gdbsupport/common-utils.h
@@ -59,7 +59,11 @@ xfree (T *ptr)
data type. Use operator delete instead.");

if (ptr != NULL)
- free (ptr); /* ARI: free */
+#ifdef GNULIB_NAMESPACE
+ GNULIB_NAMESPACE::free (ptr); /* ARI: free */
+#else
+ free (ptr); /* ARI: free */
+#endif
}

diff --git a/gnulib/ChangeLog b/gnulib/ChangeLog
index 909df781797..8adb8156518 100644
--- a/gnulib/ChangeLog
+++ b/gnulib/ChangeLog
@@ -1,3 +1,8 @@
+2021-01-22 Paul E. Murphy <murphyp@linux.ibm.com>
+ * update-gnulib.sh (GNULIB_COMMIT_SHA1): Bump to
+ 776af40e09b476a41073131a90022572f448c189.
+ * Makefile.in, config.in, configure, import/*: Re-generate.
+
2020-10-09 Andrew Burgess <andrew.burgess@embecosm.com>

* Makefile.gnulib.inc.in: New file.
diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh
index e9b377ca475..02d045b5348 100755
--- a/gnulib/update-gnulib.sh
+++ b/gnulib/update-gnulib.sh
@@ -70,7 +70,7 @@ IMPORTED_GNULIB_MODULES="\
"

# The gnulib commit ID to use for the update.
-GNULIB_COMMIT_SHA1="4e3f2d4cfdba14e1d89479362061a9280f2f22b6"
+GNULIB_COMMIT_SHA1="776af40e09b476a41073131a90022572f448c189"

# The expected version number for the various auto tools we will
# use after the import.
--
2.26.2