public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* GDB 10.1 release -- 2020-09-18 Update
@ 2020-09-18 23:46 Joel Brobecker
  2020-09-19  1:37 ` Simon Marchi
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Joel Brobecker @ 2020-09-18 23:46 UTC (permalink / raw)
  To: gdb-patches

Hello,

A quick update on the release status since the 10.0.90 pre-release
was published last Saturday...

So far, we don't have anything really worrisome that could significantly
delay the release. I'll try to find some time to test the gnulib patches
that Eli pointed out next week.

Fixed Since the Previous Update:
--------------------------------

Fixed prior to branching:

  * [TomT/HannesD] <PR win32/25302>
    Mismatching fstat() function calls in gdb_bfd_open() and cache_bstat()
    https://sourceware.org/bugzilla/show_bug.cgi?id=25302

Fixed since branching:

  * [TomT] <PR gdb/26598> (reported by SimonM)
    skip compares pattern against mangled name
    https://sourceware.org/bugzilla/show_bug.cgi?id=26598

  * [TomT] <PR rust/26197>
    rust FAILs with rustc 1.36.0 and llvm 7
    https://sourceware.org/bugzilla/show_bug.cgi?id=26197

Added Since the Last Update:
----------------------------

Other Ongoing Items:
--------------------

  * [EliZ] <PR build/26607>
    GDB build failure in gnulib if building on Windows version older than 8
    https://sourceware.org/bugzilla/show_bug.cgi?id=26607

    gnulib pushed a couple of patches:
    https://sourceware.org/pipermail/gdb-patches/2020-September/171920.html

    The proposal is the following:
      - On the branch: we review, and test the two patches, then
        integrate them;
      - On master, we schedule a gnulib update.

Not Critical, but Requested:
----------------------------

  * [<unassigned>] <PR python/26586> (raised by Christian B)
    from_tty argument to Python's gdb.execute is no longer effective
    https://sourceware.org/bugzilla/show_bug.cgi?id=26586

    Not release blocking because not exactly a regressions (8.2 and 9
    already had the bug).

  * [AntonK, ShahabV] (suggested by SimonM)
    Add ARC Linux gdbserver support

    Patch (Aug 26th):
    https://sourceware.org/pipermail/gdb-patches/2020-August/171499.html

    Latest messages:
    https://sourceware.org/pipermail/gdb-patches/2020-September/171911.html

-- 
Joel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-18 23:46 GDB 10.1 release -- 2020-09-18 Update Joel Brobecker
@ 2020-09-19  1:37 ` Simon Marchi
  2020-09-19 19:42   ` Joel Brobecker
  2020-09-19  7:41 ` Eli Zaretskii
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Simon Marchi @ 2020-09-19  1:37 UTC (permalink / raw)
  To: Joel Brobecker, gdb-patches

On 2020-09-18 7:46 p.m., Joel Brobecker wrote:
> Hello,
>
> A quick update on the release status since the 10.0.90 pre-release
> was published last Saturday...
>
> So far, we don't have anything really worrisome that could significantly
> delay the release. I'll try to find some time to test the gnulib patches
> that Eli pointed out next week.

Huh, the patch to skip the endbr32 instruction in prologues kind of fell
through the cracks until today.  It was just merged to master.  Should
we consider it for the release branch?  If you don't have it and your
compiler inserts these instructions, it kind of screws up the debugging
experience, since the function prologues are never properly skipped.  In
my experience, this results in GDB showing wrong argument values when
reaching a function breakpoint, for example.

The patch in question is:

  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=14f9473ca225290680c8b21240cdca49f8d3b332

Simon

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-18 23:46 GDB 10.1 release -- 2020-09-18 Update Joel Brobecker
  2020-09-19  1:37 ` Simon Marchi
@ 2020-09-19  7:41 ` Eli Zaretskii
  2020-09-19 19:48   ` Joel Brobecker
  2020-09-20  1:03 ` GDB 10.1 release -- 2020-09-18 Update Simon Marchi
  2020-09-21 19:54 ` Simon Marchi
  3 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2020-09-19  7:41 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Date: Fri, 18 Sep 2020 16:46:02 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> 
> So far, we don't have anything really worrisome that could significantly
> delay the release. I'll try to find some time to test the gnulib patches
> that Eli pointed out next week.

Do you want me to install those Gnulib changes on the release branch,
or would you prefer doing that yourself?

Thanks.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-19  1:37 ` Simon Marchi
@ 2020-09-19 19:42   ` Joel Brobecker
  2020-09-19 23:58     ` Simon Marchi
  0 siblings, 1 reply; 16+ messages in thread
From: Joel Brobecker @ 2020-09-19 19:42 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

> > A quick update on the release status since the 10.0.90 pre-release
> > was published last Saturday...
> >
> > So far, we don't have anything really worrisome that could significantly
> > delay the release. I'll try to find some time to test the gnulib patches
> > that Eli pointed out next week.
> 
> Huh, the patch to skip the endbr32 instruction in prologues kind of fell
> through the cracks until today.  It was just merged to master.  Should
> we consider it for the release branch?  If you don't have it and your
> compiler inserts these instructions, it kind of screws up the debugging
> experience, since the function prologues are never properly skipped.  In
> my experience, this results in GDB showing wrong argument values when
> reaching a function breakpoint, for example.
> 
> The patch in question is:
> 
>   https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=14f9473ca225290680c8b21240cdca49f8d3b332

Sure. This patch does look safe to backport, so OK with me.

Thanks for pointing this patch out for the release, Simon.

-- 
Joel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-19  7:41 ` Eli Zaretskii
@ 2020-09-19 19:48   ` Joel Brobecker
  2020-09-21 16:26     ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Joel Brobecker @ 2020-09-19 19:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

Hi Eli,

> > So far, we don't have anything really worrisome that could significantly
> > delay the release. I'll try to find some time to test the gnulib patches
> > that Eli pointed out next week.
> 
> Do you want me to install those Gnulib changes on the release branch,
> or would you prefer doing that yourself?

Let's test it first, both in your context, and in a situation
where the Windows version is more recent, and also with a mingw64
version of MinGW. Perhaps the way we could do it is if you sent
the actual GDB patch to install those two gnulib patches into
our copy after testing on your end that this fixes things, and
then I could test your patch with newer Windows + MinGW64?

There's also the question of updating gnulib on master. I haven't
heard of anyone who's volunteered for that one... I assume one
will happen at some point out of someone needing it for other
reasons, but there is no guarantee this will happen. Do you want
to take care of doing an update as well? The earlier we do the update,
the smaller the delta between the version we are using today and
the version we update to is.

-- 
Joel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-19 19:42   ` Joel Brobecker
@ 2020-09-19 23:58     ` Simon Marchi
  0 siblings, 0 replies; 16+ messages in thread
From: Simon Marchi @ 2020-09-19 23:58 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 2020-09-19 3:42 p.m., Joel Brobecker wrote:
>>> A quick update on the release status since the 10.0.90 pre-release
>>> was published last Saturday...
>>>
>>> So far, we don't have anything really worrisome that could significantly
>>> delay the release. I'll try to find some time to test the gnulib patches
>>> that Eli pointed out next week.
>>
>> Huh, the patch to skip the endbr32 instruction in prologues kind of fell
>> through the cracks until today.  It was just merged to master.  Should
>> we consider it for the release branch?  If you don't have it and your
>> compiler inserts these instructions, it kind of screws up the debugging
>> experience, since the function prologues are never properly skipped.  In
>> my experience, this results in GDB showing wrong argument values when
>> reaching a function breakpoint, for example.
>>
>> The patch in question is:
>>
>>   https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=14f9473ca225290680c8b21240cdca49f8d3b332
> 
> Sure. This patch does look safe to backport, so OK with me.
> 
> Thanks for pointing this patch out for the release, Simon.

Done, thanks.

Simon

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-18 23:46 GDB 10.1 release -- 2020-09-18 Update Joel Brobecker
  2020-09-19  1:37 ` Simon Marchi
  2020-09-19  7:41 ` Eli Zaretskii
@ 2020-09-20  1:03 ` Simon Marchi
  2020-09-20  6:09   ` Eli Zaretskii
  2020-09-21 19:54 ` Simon Marchi
  3 siblings, 1 reply; 16+ messages in thread
From: Simon Marchi @ 2020-09-20  1:03 UTC (permalink / raw)
  To: Joel Brobecker, gdb-patches

On 2020-09-18 7:46 p.m., Joel Brobecker wrote:
> Hello,
>
> A quick update on the release status since the 10.0.90 pre-release
> was published last Saturday...
>
> So far, we don't have anything really worrisome that could significantly
> delay the release. I'll try to find some time to test the gnulib patches
> that Eli pointed out next week.

I just filed this ("TUI focus behavior change"), if it's considered a
bug then I think it should be put on the list of blockers.

https://sourceware.org/bugzilla/show_bug.cgi?id=26638

Simon

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-20  1:03 ` GDB 10.1 release -- 2020-09-18 Update Simon Marchi
@ 2020-09-20  6:09   ` Eli Zaretskii
  0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2020-09-20  6:09 UTC (permalink / raw)
  To: Simon Marchi; +Cc: brobecker, gdb-patches

> From: Simon Marchi <simark@simark.ca>
> Date: Sat, 19 Sep 2020 21:03:41 -0400
> 
> I just filed this ("TUI focus behavior change"), if it's considered a
> bug then I think it should be put on the list of blockers.
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=26638

Thanks, I think we should indeed try to fix this before the release.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-19 19:48   ` Joel Brobecker
@ 2020-09-21 16:26     ` Eli Zaretskii
  2020-09-26 17:39       ` Joel Brobecker
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2020-09-21 16:26 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Date: Sat, 19 Sep 2020 12:48:50 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
> 
> Let's test it first, both in your context, and in a situation
> where the Windows version is more recent, and also with a mingw64
> version of MinGW. Perhaps the way we could do it is if you sent
> the actual GDB patch to install those two gnulib patches into
> our copy after testing on your end that this fixes things, and
> then I could test your patch with newer Windows + MinGW64?

I attach below the patch for our copy of Gnulib on the release
branch.  It works here.  (I will again ask you to kindly regenerate
the configure script(s) that depend on gnulib/import/m4/*.m4 files.)

> There's also the question of updating gnulib on master. I haven't
> heard of anyone who's volunteered for that one... I assume one
> will happen at some point out of someone needing it for other
> reasons, but there is no guarantee this will happen. Do you want
> to take care of doing an update as well?

I've never done this, and would prefer that someone else does that.
Sorry for being such a coward.

Here's the patch for the release branch:

diff --git a/gnulib/ChangeLog b/gnulib/ChangeLog
index bf61742..dfd6d79 100644
--- a/gnulib/ChangeLog
+++ b/gnulib/ChangeLog
@@ -1,3 +1,16 @@
+2020-09-16  Bruno Haible  <bruno@clisp.org>
+
+	stat, fstat: Fix when compiling for versions older than Windows Vista.
+	Reported by Eli Zaretskii <eliz@gnu.org> in
+	<https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00027.html>.
+	* import/stat-w32.c: Include <sdkddkver.h>. Test the value of
+	_WIN32_WINNT that was originally set before we redefined it.
+	(VOLUME_NAME_NONE): Define if the Windows headers don't define
+	it.
+	* import/m4/stat.m4 (gl_PREREQ_STAT_W32): New macro.
+	(gl_PREREQ_STAT): Require it.
+	* import/m4/fstat.m4 (gl_PREREQ_FSTAT): Likewise.
+
 2020-09-08  Tom Tromey  <tromey@adacore.com>
 
 	PR win32/25302:
diff --git a/gnulib/import/m4/fstat.m4 b/gnulib/import/m4/fstat.m4
index 53c0896..bd8cb79 100644
--- a/gnulib/import/m4/fstat.m4
+++ b/gnulib/import/m4/fstat.m4
@@ -1,4 +1,4 @@
-# fstat.m4 serial 6
+# fstat.m4 serial 7
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,5 +35,6 @@ AC_DEFUN([gl_FUNC_FSTAT],
 # Prerequisites of lib/fstat.c and lib/stat-w32.c.
 AC_DEFUN([gl_PREREQ_FSTAT], [
   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
+  AC_REQUIRE([gl_PREREQ_STAT_W32])
   :
 ])
diff --git a/gnulib/import/m4/stat.m4 b/gnulib/import/m4/stat.m4
index 8ef355f..5e827b5 100644
--- a/gnulib/import/m4/stat.m4
+++ b/gnulib/import/m4/stat.m4
@@ -1,4 +1,4 @@
-# serial 16
+# serial 17
 
 # Copyright (C) 2009-2020 Free Software Foundation, Inc.
 #
@@ -70,5 +70,16 @@ AC_DEFUN([gl_FUNC_STAT],
 # Prerequisites of lib/stat.c and lib/stat-w32.c.
 AC_DEFUN([gl_PREREQ_STAT], [
   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
+  AC_REQUIRE([gl_PREREQ_STAT_W32])
   :
 ])
+
+# Prerequisites of lib/stat-w32.c.
+AC_DEFUN([gl_PREREQ_STAT_W32], [
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw*)
+      AC_CHECK_HEADERS([sdkddkver.h])
+      ;;
+  esac
+])
diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c
index 19bdfaa..108ce19 100644
--- a/gnulib/import/stat-w32.c
+++ b/gnulib/import/stat-w32.c
@@ -20,10 +20,22 @@
 
 #if defined _WIN32 && ! defined __CYGWIN__
 
-/* Ensure that <windows.h> defines FILE_ID_INFO.  */
-#if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_WIN8
+/* Attempt to make <windows.h> define FILE_ID_INFO.
+   But ensure that the redefinition of _WIN32_WINNT does not make us assume
+   Windows Vista or newer when building for an older version of Windows.  */
+#if HAVE_SDKDDKVER_H
+# include <sdkddkver.h>
+# if _WIN32_WINNT >= _WIN32_WINNT_VISTA
+#  define WIN32_ASSUME_VISTA 1
+# else
+#  define WIN32_ASSUME_VISTA 0
+# endif
+# if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT _WIN32_WINNT_WIN8
+# endif
+#else
+# define WIN32_ASSUME_VISTA (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
 #endif
 
 #include <sys/types.h>
@@ -46,7 +58,12 @@
 #undef GetFinalPathNameByHandle
 #define GetFinalPathNameByHandle GetFinalPathNameByHandleA
 
-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+/* Older mingw headers do not define VOLUME_NAME_NONE.  */
+#ifndef VOLUME_NAME_NONE
+# define VOLUME_NAME_NONE 4
+#endif
+
+#if !WIN32_ASSUME_VISTA
 
 /* Avoid warnings from gcc -Wcast-function-type.  */
 # define GetProcAddress \
@@ -149,7 +166,7 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf)
   DWORD type = GetFileType (h);
   if (type == FILE_TYPE_DISK)
     {
-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+#if !WIN32_ASSUME_VISTA
       if (!initialized)
         initialize ();
 #endif

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-18 23:46 GDB 10.1 release -- 2020-09-18 Update Joel Brobecker
                   ` (2 preceding siblings ...)
  2020-09-20  1:03 ` GDB 10.1 release -- 2020-09-18 Update Simon Marchi
@ 2020-09-21 19:54 ` Simon Marchi
  2020-09-23 13:39   ` Tom Tromey
  3 siblings, 1 reply; 16+ messages in thread
From: Simon Marchi @ 2020-09-21 19:54 UTC (permalink / raw)
  To: Joel Brobecker, gdb-patches

On 2020-09-18 7:46 p.m., Joel Brobecker wrote:
> Hello,
> 
> A quick update on the release status since the 10.0.90 pre-release
> was published last Saturday...
> 
> So far, we don't have anything really worrisome that could significantly
> delay the release. I'll try to find some time to test the gnulib patches
> that Eli pointed out next week.

Here's another regression since the last release, which should be fixed prior to the release:

"maintenance set target-async off" is broken on GNU/Linux
https://sourceware.org/bugzilla/show_bug.cgi?id=26642

I'm starting to look into it, though I'm not sure I'll get to the bottom of it quickly.

Simon

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-21 19:54 ` Simon Marchi
@ 2020-09-23 13:39   ` Tom Tromey
  2020-09-23 14:00     ` Simon Marchi
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2020-09-23 13:39 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Joel Brobecker, gdb-patches

Simon> Here's another regression since the last release, which should be
Simon> fixed prior to the release:

Simon> "maintenance set target-async off" is broken on GNU/Linux
Simon> https://sourceware.org/bugzilla/show_bug.cgi?id=26642

Is there some particular need for this?
I tend to think maintenance commands shouldn't block a release.

Tom

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-23 13:39   ` Tom Tromey
@ 2020-09-23 14:00     ` Simon Marchi
  0 siblings, 0 replies; 16+ messages in thread
From: Simon Marchi @ 2020-09-23 14:00 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Joel Brobecker, gdb-patches

On 2020-09-23 9:39 a.m., Tom Tromey wrote:
> Simon> Here's another regression since the last release, which should be
> Simon> fixed prior to the release:
>
> Simon> "maintenance set target-async off" is broken on GNU/Linux
> Simon> https://sourceware.org/bugzilla/show_bug.cgi?id=26642
>
> Is there some particular need for this?
> I tend to think maintenance commands shouldn't block a release.
>
> Tom

There is no real need for using "target-async off" on Linux, but I think
it exposes a real bug in the core of GDB (in infrun) that would affect
any sync target.

However, the bug happens because even in target-async off mode,
linux_nat_target::wait obeys the TARGET_WNOHANG and doesn't block.
Maybe that doesn't make sense: a sync target should block in wait, by
definition.  Any other sync target would just ignore TARGET_WNOHANG, so
we wouldn't hit the same bug as I hit with the linux-nat target.

Simon

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-21 16:26     ` Eli Zaretskii
@ 2020-09-26 17:39       ` Joel Brobecker
  2020-09-28  9:30         ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Joel Brobecker @ 2020-09-26 17:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1588 bytes --]

Hi Eli,

> > Let's test it first, both in your context, and in a situation
> > where the Windows version is more recent, and also with a mingw64
> > version of MinGW. Perhaps the way we could do it is if you sent
> > the actual GDB patch to install those two gnulib patches into
> > our copy after testing on your end that this fixes things, and
> > then I could test your patch with newer Windows + MinGW64?
> 
> I attach below the patch for our copy of Gnulib on the release
> branch.  It works here.  (I will again ask you to kindly regenerate
> the configure script(s) that depend on gnulib/import/m4/*.m4 files.)

The patch as you propose it is not enough, because you also need to
regenerate the configury stuff. Also, I think that anyone re-rerunning
the update-gnulib.sh script would end up overwriting your changes.

Rather than doing everything by hand and risk missing something,
I just propose we take advantage of our update-gnulib.sh script
instead. To do so, I've imported the commits from gnulib as patches,
and then updated the update-gnulib.sh script to include those two
import patches in the sequence. The patches had to be adjusted
a bit to the layout in the import as opposed to in the repository
of origin, but they are otherwise the same.

This is the first moment I've had to work on this, so the patch
hasn't been tested on our Windows machines yet. I expected to be
able to report on that mid-to-late next week. In the meantime,
if you could test this patch in your environment, this would help us
guarantee that things are good on your end too, now.

-- 
Joel

[-- Attachment #2: 0001-gnulib-fix-stat-fstat-build-errors-on-old-Windows-ve.patch --]
[-- Type: text/x-diff, Size: 11927 bytes --]

From 61cf3638c9e0c3a9258e097d2eef37eb781bc98d Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Sat, 26 Sep 2020 10:15:34 -0700
Subject: [PATCH] gnulib: fix stat/fstat build errors on old Windows version or
 using old MinGW

This commit imports two commits from gnulib's master branch fixing
a build error when building on a version of Windows that's older
than Vista, or when using an mingw's MinGW.

gnulib/ChangeLog:

	GDB PR build/26607
	* patches/0002-stat-fstat-windows-older-vista: New patch.
	* patches/0003-stat-fstat-windows-old-mingw: New patch.
	* update-gnulib.sh: Update to use the two new patches above.
	* import/m4/fstat.m4: Update after applying patches above.
	* import/m4/stat.m4: Ditto.
	* import/stat-w32.c: Ditto.
	* config.in: Regenerate.
	* configure: Regenerate.

Change-Id: I92029ac55825e9116b4f77cd7acb0596102338b3
TN: T925-029
---
 gnulib/config.in                              |   3 +
 gnulib/configure                              |  21 ++++
 gnulib/import/m4/fstat.m4                     |   3 +-
 gnulib/import/m4/stat.m4                      |  13 +-
 gnulib/import/stat-w32.c                      |  29 ++++-
 .../0002-stat-fstat-windows-older-vista       | 116 ++++++++++++++++++
 .../patches/0003-stat-fstat-windows-old-mingw |  34 +++++
 gnulib/update-gnulib.sh                       |   6 +
 8 files changed, 217 insertions(+), 8 deletions(-)
 create mode 100644 gnulib/patches/0002-stat-fstat-windows-older-vista
 create mode 100644 gnulib/patches/0003-stat-fstat-windows-old-mingw

diff --git a/gnulib/config.in b/gnulib/config.in
index 4a20b470fb2..d8a5e8be727 100644
--- a/gnulib/config.in
+++ b/gnulib/config.in
@@ -693,6 +693,9 @@
 /* Define to 1 if the system has the type `sa_family_t'. */
 #undef HAVE_SA_FAMILY_T
 
+/* Define to 1 if you have the <sdkddkver.h> header file. */
+#undef HAVE_SDKDDKVER_H
+
 /* Define to 1 if you have the <search.h> header file. */
 #undef HAVE_SEARCH_H
 
diff --git a/gnulib/configure b/gnulib/configure
index 5c6add6e371..ef7f6d5e80f 100644
--- a/gnulib/configure
+++ b/gnulib/configure
@@ -10107,6 +10107,25 @@ fi
 
 
 
+
+  case "$host_os" in
+    mingw*)
+      for ac_header in sdkddkver.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sdkddkver.h" "ac_cv_header_sdkddkver_h" "$ac_includes_default"
+if test "x$ac_cv_header_sdkddkver_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SDKDDKVER_H 1
+_ACEOF
+
+fi
+
+done
+
+      ;;
+  esac
+
+
          { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
 if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
@@ -19576,6 +19595,7 @@ $as_echo "#define GNULIB_TEST_FREXPL 1" >>confdefs.h
     esac
 
 
+
   :
 
   fi
@@ -27005,6 +27025,7 @@ $as_echo "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h
     esac
 
 
+
   :
 
   fi
diff --git a/gnulib/import/m4/fstat.m4 b/gnulib/import/m4/fstat.m4
index 53c08961937..bd8cb796621 100644
--- a/gnulib/import/m4/fstat.m4
+++ b/gnulib/import/m4/fstat.m4
@@ -1,4 +1,4 @@
-# fstat.m4 serial 6
+# fstat.m4 serial 7
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,5 +35,6 @@ AC_DEFUN([gl_FUNC_FSTAT],
 # Prerequisites of lib/fstat.c and lib/stat-w32.c.
 AC_DEFUN([gl_PREREQ_FSTAT], [
   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
+  AC_REQUIRE([gl_PREREQ_STAT_W32])
   :
 ])
diff --git a/gnulib/import/m4/stat.m4 b/gnulib/import/m4/stat.m4
index 8ef355f9407..5e827b594ab 100644
--- a/gnulib/import/m4/stat.m4
+++ b/gnulib/import/m4/stat.m4
@@ -1,4 +1,4 @@
-# serial 16
+# serial 17
 
 # Copyright (C) 2009-2020 Free Software Foundation, Inc.
 #
@@ -70,5 +70,16 @@ AC_DEFUN([gl_FUNC_STAT],
 # Prerequisites of lib/stat.c and lib/stat-w32.c.
 AC_DEFUN([gl_PREREQ_STAT], [
   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
+  AC_REQUIRE([gl_PREREQ_STAT_W32])
   :
 ])
+
+# Prerequisites of lib/stat-w32.c.
+AC_DEFUN([gl_PREREQ_STAT_W32], [
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw*)
+      AC_CHECK_HEADERS([sdkddkver.h])
+      ;;
+  esac
+])
diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c
index 19bdfaa379c..108ce199cc8 100644
--- a/gnulib/import/stat-w32.c
+++ b/gnulib/import/stat-w32.c
@@ -20,10 +20,22 @@
 
 #if defined _WIN32 && ! defined __CYGWIN__
 
-/* Ensure that <windows.h> defines FILE_ID_INFO.  */
-#if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_WIN8
+/* Attempt to make <windows.h> define FILE_ID_INFO.
+   But ensure that the redefinition of _WIN32_WINNT does not make us assume
+   Windows Vista or newer when building for an older version of Windows.  */
+#if HAVE_SDKDDKVER_H
+# include <sdkddkver.h>
+# if _WIN32_WINNT >= _WIN32_WINNT_VISTA
+#  define WIN32_ASSUME_VISTA 1
+# else
+#  define WIN32_ASSUME_VISTA 0
+# endif
+# if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT _WIN32_WINNT_WIN8
+# endif
+#else
+# define WIN32_ASSUME_VISTA (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
 #endif
 
 #include <sys/types.h>
@@ -46,7 +58,12 @@
 #undef GetFinalPathNameByHandle
 #define GetFinalPathNameByHandle GetFinalPathNameByHandleA
 
-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+/* Older mingw headers do not define VOLUME_NAME_NONE.  */
+#ifndef VOLUME_NAME_NONE
+# define VOLUME_NAME_NONE 4
+#endif
+
+#if !WIN32_ASSUME_VISTA
 
 /* Avoid warnings from gcc -Wcast-function-type.  */
 # define GetProcAddress \
@@ -149,7 +166,7 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf)
   DWORD type = GetFileType (h);
   if (type == FILE_TYPE_DISK)
     {
-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+#if !WIN32_ASSUME_VISTA
       if (!initialized)
         initialize ();
 #endif
diff --git a/gnulib/patches/0002-stat-fstat-windows-older-vista b/gnulib/patches/0002-stat-fstat-windows-older-vista
new file mode 100644
index 00000000000..edb98276f60
--- /dev/null
+++ b/gnulib/patches/0002-stat-fstat-windows-older-vista
@@ -0,0 +1,116 @@
+From 1796cda9975bd459a87222676030b943869c686e Mon Sep 17 00:00:00 2001
+From: Bruno Haible <bruno@clisp.org>
+Date: Wed, 16 Sep 2020 23:51:52 +0200
+Subject: [PATCH 1/2] stat, fstat: Fix when compiling for versions older than
+ Windows Vista.
+
+Reported by Eli Zaretskii <eliz@gnu.org> in
+<https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00027.html>.
+
+* lib/stat-w32.c: Include <sdkddkver.h>. Test the value of _WIN32_WINNT
+that was originally set before we redefined it.
+* m4/stat.m4 (gl_PREREQ_STAT_W32): New macro.
+(gl_PREREQ_STAT): Require it.
+* m4/fstat.m4 (gl_PREREQ_FSTAT): Likewise.
+---
+ stat-w32.c | 24 ++++++++++++++++++------
+ m4/fstat.m4    |  3 ++-
+ m4/stat.m4     | 13 ++++++++++++-
+ 4 files changed, 43 insertions(+), 8 deletions(-)
+
+diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c
+index 19bdfaa37..72442e933 100644
+--- a/gnulib/import/stat-w32.c
++++ b/gnulib/import/stat-w32.c
+@@ -20,10 +20,22 @@
+ 
+ #if defined _WIN32 && ! defined __CYGWIN__
+ 
+-/* Ensure that <windows.h> defines FILE_ID_INFO.  */
+-#if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+-# undef _WIN32_WINNT
+-# define _WIN32_WINNT _WIN32_WINNT_WIN8
++/* Attempt to make <windows.h> define FILE_ID_INFO.
++   But ensure that the redefinition of _WIN32_WINNT does not make us assume
++   Windows Vista or newer when building for an older version of Windows.  */
++#if HAVE_SDKDDKVER_H
++# include <sdkddkver.h>
++# if _WIN32_WINNT >= _WIN32_WINNT_VISTA
++#  define WIN32_ASSUME_VISTA 1
++# else
++#  define WIN32_ASSUME_VISTA 0
++# endif
++# if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
++#  undef _WIN32_WINNT
++#  define _WIN32_WINNT _WIN32_WINNT_WIN8
++# endif
++#else
++# define WIN32_ASSUME_VISTA (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+ #endif
+ 
+ #include <sys/types.h>
+@@ -46,7 +58,7 @@
+ #undef GetFinalPathNameByHandle
+ #define GetFinalPathNameByHandle GetFinalPathNameByHandleA
+ 
+-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
++#if !WIN32_ASSUME_VISTA
+ 
+ /* Avoid warnings from gcc -Wcast-function-type.  */
+ # define GetProcAddress \
+@@ -149,7 +161,7 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf)
+   DWORD type = GetFileType (h);
+   if (type == FILE_TYPE_DISK)
+     {
+-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
++#if !WIN32_ASSUME_VISTA
+       if (!initialized)
+         initialize ();
+ #endif
+diff --git a/gnulib/import/m4/fstat.m4 b/gnulib/import/m4/fstat.m4
+index 53c089619..bd8cb7966 100644
+--- a/gnulib/import/m4/fstat.m4
++++ b/gnulib/import/m4/fstat.m4
+@@ -1,4 +1,4 @@
+-# fstat.m4 serial 6
++# fstat.m4 serial 7
+ dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+@@ -35,5 +35,6 @@ AC_DEFUN([gl_FUNC_FSTAT],
+ # Prerequisites of lib/fstat.c and lib/stat-w32.c.
+ AC_DEFUN([gl_PREREQ_FSTAT], [
+   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
++  AC_REQUIRE([gl_PREREQ_STAT_W32])
+   :
+ ])
+diff --git a/gnulib/import/m4/stat.m4 b/gnulib/import/m4/stat.m4
+index 46e9abcee..db2038f63 100644
+--- a/gnulib/import/m4/stat.m4
++++ b/gnulib/import/m4/stat.m4
+@@ -1,4 +1,4 @@
+-# serial 16
++# serial 17
+ 
+ # Copyright (C) 2009-2020 Free Software Foundation, Inc.
+ #
+@@ -70,5 +70,16 @@ AC_DEFUN([gl_FUNC_STAT],
+ # Prerequisites of lib/stat.c and lib/stat-w32.c.
+ AC_DEFUN([gl_PREREQ_STAT], [
+   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
++  AC_REQUIRE([gl_PREREQ_STAT_W32])
+   :
+ ])
++
++# Prerequisites of lib/stat-w32.c.
++AC_DEFUN([gl_PREREQ_STAT_W32], [
++  AC_REQUIRE([AC_CANONICAL_HOST])
++  case "$host_os" in
++    mingw*)
++      AC_CHECK_HEADERS([sdkddkver.h])
++      ;;
++  esac
++])
+-- 
+2.17.1
+
diff --git a/gnulib/patches/0003-stat-fstat-windows-old-mingw b/gnulib/patches/0003-stat-fstat-windows-old-mingw
new file mode 100644
index 00000000000..e43c88f08ce
--- /dev/null
+++ b/gnulib/patches/0003-stat-fstat-windows-old-mingw
@@ -0,0 +1,34 @@
+From f8c23f202d11992182e87736e73929bcc369cc75 Mon Sep 17 00:00:00 2001
+From: Bruno Haible <bruno@clisp.org>
+Date: Wed, 16 Sep 2020 23:52:44 +0200
+Subject: [PATCH 2/2] stat, fstat: Fix compilation error with old mingw
+ headers.
+
+Reported by Eli Zaretskii <eliz@gnu.org> in
+<https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00027.html>.
+
+* lib/stat-w32.c (VOLUME_NAME_NONE): Define if the Windows headers don't
+define it.
+---
+ stat-w32.c | 5 +++++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c
+index 72442e933..108ce199c 100644
+--- a/gnulib/import/stat-w32.c
++++ b/gnulib/import/stat-w32.c
+@@ -58,6 +58,11 @@
+ #undef GetFinalPathNameByHandle
+ #define GetFinalPathNameByHandle GetFinalPathNameByHandleA
+ 
++/* Older mingw headers do not define VOLUME_NAME_NONE.  */
++#ifndef VOLUME_NAME_NONE
++# define VOLUME_NAME_NONE 4
++#endif
++
+ #if !WIN32_ASSUME_VISTA
+ 
+ /* Avoid warnings from gcc -Wcast-function-type.  */
+-- 
+2.17.1
+
diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh
index ac5e3d56a29..3aa70141a59 100755
--- a/gnulib/update-gnulib.sh
+++ b/gnulib/update-gnulib.sh
@@ -174,6 +174,12 @@ apply_patches ()
 }
 
 apply_patches "patches/0001-use-windows-stat"
+# The following two patches are specific imports of two commits
+# already in gnulib's master. We import those patches individually
+# because we want to avoid doing a standard gnulib update, which
+# would be too disruptive for a release branch.
+apply_patches "patches/0002-stat-fstat-windows-older-vista"
+apply_patches "patches/0003-stat-fstat-windows-old-mingw"
 
 # Regenerate all necessary files...
 aclocal &&
-- 
2.17.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-26 17:39       ` Joel Brobecker
@ 2020-09-28  9:30         ` Eli Zaretskii
  2020-09-28 20:11           ` Joel Brobecker
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2020-09-28  9:30 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Date: Sat, 26 Sep 2020 10:39:40 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
> 
> > I attach below the patch for our copy of Gnulib on the release
> > branch.  It works here.  (I will again ask you to kindly regenerate
> > the configure script(s) that depend on gnulib/import/m4/*.m4 files.)
> 
> The patch as you propose it is not enough, because you also need to
> regenerate the configury stuff. Also, I think that anyone re-rerunning
> the update-gnulib.sh script would end up overwriting your changes.
> 
> Rather than doing everything by hand and risk missing something,
> I just propose we take advantage of our update-gnulib.sh script
> instead. To do so, I've imported the commits from gnulib as patches,
> and then updated the update-gnulib.sh script to include those two
> import patches in the sequence. The patches had to be adjusted
> a bit to the layout in the import as opposed to in the repository
> of origin, but they are otherwise the same.
> 
> This is the first moment I've had to work on this, so the patch
> hasn't been tested on our Windows machines yet. I expected to be
> able to report on that mid-to-late next week. In the meantime,
> if you could test this patch in your environment, this would help us
> guarantee that things are good on your end too, now.

I've downloaded today's snapshot of the branch, applied the patches
you sent, and build GDB.  It builds cleanly and passes all the sanity
checks I tried.

So I think you can install this (provided that you can build GDB using
MinGW64).

Thanks, and sorry I couldn't be of more help in this matter.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GDB 10.1 release -- 2020-09-18 Update
  2020-09-28  9:30         ` Eli Zaretskii
@ 2020-09-28 20:11           ` Joel Brobecker
  2020-10-09 19:53             ` [pushed/gdb-10-branch] gnulib: fix stat/fstat build errors on old Windows version or using old MinGW Joel Brobecker
  0 siblings, 1 reply; 16+ messages in thread
From: Joel Brobecker @ 2020-09-28 20:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

> I've downloaded today's snapshot of the branch, applied the patches
> you sent, and build GDB.  It builds cleanly and passes all the sanity
> checks I tried.

Perfect. Thank you!

> So I think you can install this (provided that you can build GDB using
> MinGW64).

We've put the patches on a queue to be tested. Since we still have
while waiting for other fixes, I'd like to collect a few days' worth
of nightly testing, JIC. I'll push towards the end of the week.

-- 
Joel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [pushed/gdb-10-branch] gnulib: fix stat/fstat build errors on old Windows version or using old MinGW
  2020-09-28 20:11           ` Joel Brobecker
@ 2020-10-09 19:53             ` Joel Brobecker
  0 siblings, 0 replies; 16+ messages in thread
From: Joel Brobecker @ 2020-10-09 19:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

Hello,

This commit imports two commits from gnulib's master branch fixing
a build error when building on a version of Windows that's older
than Vista, or when using an mingw's MinGW.

gnulib/ChangeLog:

	GDB PR build/26607
	* patches/0002-stat-fstat-windows-older-vista: New patch.
	* patches/0003-stat-fstat-windows-old-mingw: New patch.
	* update-gnulib.sh: Update to use the two new patches above.
	* import/m4/fstat.m4: Update after applying patches above.
	* import/m4/stat.m4: Ditto.
	* import/stat-w32.c: Ditto.
	* config.in: Regenerate.
	* configure: Regenerate.

Pushed to the gdb-10-branch. Not pushed on the master branch, since
the proper way to handle this on master is to update the gnulib import.

Tested on x86-windows and x86_64-windows, through AdaCore's testsuite,
to verify that this doesn't introduce any unexpected issue on the more
recent versions of Windows.

Thanks,
-- 
Joel

---
 gnulib/ChangeLog                              |  12 ++
 gnulib/config.in                              |   3 +
 gnulib/configure                              |  21 ++++
 gnulib/import/m4/fstat.m4                     |   3 +-
 gnulib/import/m4/stat.m4                      |  13 +-
 gnulib/import/stat-w32.c                      |  29 ++++-
 .../0002-stat-fstat-windows-older-vista       | 116 ++++++++++++++++++
 .../patches/0003-stat-fstat-windows-old-mingw |  34 +++++
 gnulib/update-gnulib.sh                       |   6 +
 9 files changed, 229 insertions(+), 8 deletions(-)
 create mode 100644 gnulib/patches/0002-stat-fstat-windows-older-vista
 create mode 100644 gnulib/patches/0003-stat-fstat-windows-old-mingw

diff --git a/gnulib/ChangeLog b/gnulib/ChangeLog
index bf617428c4d..714ca1dc3e3 100644
--- a/gnulib/ChangeLog
+++ b/gnulib/ChangeLog
@@ -1,3 +1,15 @@
+2020-10-09  Joel Brobecker  <brobecker@adacore.com>
+
+	GDB PR build/26607
+	* patches/0002-stat-fstat-windows-older-vista: New patch.
+	* patches/0003-stat-fstat-windows-old-mingw: New patch.
+	* update-gnulib.sh: Update to use the two new patches above.
+	* import/m4/fstat.m4: Update after applying patches above.
+	* import/m4/stat.m4: Ditto.
+	* import/stat-w32.c: Ditto.
+	* config.in: Regenerate.
+	* configure: Regenerate.
+
 2020-09-08  Tom Tromey  <tromey@adacore.com>
 
 	PR win32/25302:
diff --git a/gnulib/config.in b/gnulib/config.in
index 4a20b470fb2..d8a5e8be727 100644
--- a/gnulib/config.in
+++ b/gnulib/config.in
@@ -693,6 +693,9 @@
 /* Define to 1 if the system has the type `sa_family_t'. */
 #undef HAVE_SA_FAMILY_T
 
+/* Define to 1 if you have the <sdkddkver.h> header file. */
+#undef HAVE_SDKDDKVER_H
+
 /* Define to 1 if you have the <search.h> header file. */
 #undef HAVE_SEARCH_H
 
diff --git a/gnulib/configure b/gnulib/configure
index 5c6add6e371..ef7f6d5e80f 100644
--- a/gnulib/configure
+++ b/gnulib/configure
@@ -10107,6 +10107,25 @@ fi
 
 
 
+
+  case "$host_os" in
+    mingw*)
+      for ac_header in sdkddkver.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sdkddkver.h" "ac_cv_header_sdkddkver_h" "$ac_includes_default"
+if test "x$ac_cv_header_sdkddkver_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SDKDDKVER_H 1
+_ACEOF
+
+fi
+
+done
+
+      ;;
+  esac
+
+
          { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
 if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
@@ -19576,6 +19595,7 @@ $as_echo "#define GNULIB_TEST_FREXPL 1" >>confdefs.h
     esac
 
 
+
   :
 
   fi
@@ -27005,6 +27025,7 @@ $as_echo "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h
     esac
 
 
+
   :
 
   fi
diff --git a/gnulib/import/m4/fstat.m4 b/gnulib/import/m4/fstat.m4
index 53c08961937..bd8cb796621 100644
--- a/gnulib/import/m4/fstat.m4
+++ b/gnulib/import/m4/fstat.m4
@@ -1,4 +1,4 @@
-# fstat.m4 serial 6
+# fstat.m4 serial 7
 dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,5 +35,6 @@ AC_DEFUN([gl_FUNC_FSTAT],
 # Prerequisites of lib/fstat.c and lib/stat-w32.c.
 AC_DEFUN([gl_PREREQ_FSTAT], [
   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
+  AC_REQUIRE([gl_PREREQ_STAT_W32])
   :
 ])
diff --git a/gnulib/import/m4/stat.m4 b/gnulib/import/m4/stat.m4
index 8ef355f9407..5e827b594ab 100644
--- a/gnulib/import/m4/stat.m4
+++ b/gnulib/import/m4/stat.m4
@@ -1,4 +1,4 @@
-# serial 16
+# serial 17
 
 # Copyright (C) 2009-2020 Free Software Foundation, Inc.
 #
@@ -70,5 +70,16 @@ AC_DEFUN([gl_FUNC_STAT],
 # Prerequisites of lib/stat.c and lib/stat-w32.c.
 AC_DEFUN([gl_PREREQ_STAT], [
   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
+  AC_REQUIRE([gl_PREREQ_STAT_W32])
   :
 ])
+
+# Prerequisites of lib/stat-w32.c.
+AC_DEFUN([gl_PREREQ_STAT_W32], [
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw*)
+      AC_CHECK_HEADERS([sdkddkver.h])
+      ;;
+  esac
+])
diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c
index 19bdfaa379c..108ce199cc8 100644
--- a/gnulib/import/stat-w32.c
+++ b/gnulib/import/stat-w32.c
@@ -20,10 +20,22 @@
 
 #if defined _WIN32 && ! defined __CYGWIN__
 
-/* Ensure that <windows.h> defines FILE_ID_INFO.  */
-#if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_WIN8
+/* Attempt to make <windows.h> define FILE_ID_INFO.
+   But ensure that the redefinition of _WIN32_WINNT does not make us assume
+   Windows Vista or newer when building for an older version of Windows.  */
+#if HAVE_SDKDDKVER_H
+# include <sdkddkver.h>
+# if _WIN32_WINNT >= _WIN32_WINNT_VISTA
+#  define WIN32_ASSUME_VISTA 1
+# else
+#  define WIN32_ASSUME_VISTA 0
+# endif
+# if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT _WIN32_WINNT_WIN8
+# endif
+#else
+# define WIN32_ASSUME_VISTA (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
 #endif
 
 #include <sys/types.h>
@@ -46,7 +58,12 @@
 #undef GetFinalPathNameByHandle
 #define GetFinalPathNameByHandle GetFinalPathNameByHandleA
 
-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+/* Older mingw headers do not define VOLUME_NAME_NONE.  */
+#ifndef VOLUME_NAME_NONE
+# define VOLUME_NAME_NONE 4
+#endif
+
+#if !WIN32_ASSUME_VISTA
 
 /* Avoid warnings from gcc -Wcast-function-type.  */
 # define GetProcAddress \
@@ -149,7 +166,7 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf)
   DWORD type = GetFileType (h);
   if (type == FILE_TYPE_DISK)
     {
-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+#if !WIN32_ASSUME_VISTA
       if (!initialized)
         initialize ();
 #endif
diff --git a/gnulib/patches/0002-stat-fstat-windows-older-vista b/gnulib/patches/0002-stat-fstat-windows-older-vista
new file mode 100644
index 00000000000..edb98276f60
--- /dev/null
+++ b/gnulib/patches/0002-stat-fstat-windows-older-vista
@@ -0,0 +1,116 @@
+From 1796cda9975bd459a87222676030b943869c686e Mon Sep 17 00:00:00 2001
+From: Bruno Haible <bruno@clisp.org>
+Date: Wed, 16 Sep 2020 23:51:52 +0200
+Subject: [PATCH 1/2] stat, fstat: Fix when compiling for versions older than
+ Windows Vista.
+
+Reported by Eli Zaretskii <eliz@gnu.org> in
+<https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00027.html>.
+
+* lib/stat-w32.c: Include <sdkddkver.h>. Test the value of _WIN32_WINNT
+that was originally set before we redefined it.
+* m4/stat.m4 (gl_PREREQ_STAT_W32): New macro.
+(gl_PREREQ_STAT): Require it.
+* m4/fstat.m4 (gl_PREREQ_FSTAT): Likewise.
+---
+ stat-w32.c | 24 ++++++++++++++++++------
+ m4/fstat.m4    |  3 ++-
+ m4/stat.m4     | 13 ++++++++++++-
+ 4 files changed, 43 insertions(+), 8 deletions(-)
+
+diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c
+index 19bdfaa37..72442e933 100644
+--- a/gnulib/import/stat-w32.c
++++ b/gnulib/import/stat-w32.c
+@@ -20,10 +20,22 @@
+ 
+ #if defined _WIN32 && ! defined __CYGWIN__
+ 
+-/* Ensure that <windows.h> defines FILE_ID_INFO.  */
+-#if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
+-# undef _WIN32_WINNT
+-# define _WIN32_WINNT _WIN32_WINNT_WIN8
++/* Attempt to make <windows.h> define FILE_ID_INFO.
++   But ensure that the redefinition of _WIN32_WINNT does not make us assume
++   Windows Vista or newer when building for an older version of Windows.  */
++#if HAVE_SDKDDKVER_H
++# include <sdkddkver.h>
++# if _WIN32_WINNT >= _WIN32_WINNT_VISTA
++#  define WIN32_ASSUME_VISTA 1
++# else
++#  define WIN32_ASSUME_VISTA 0
++# endif
++# if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8)
++#  undef _WIN32_WINNT
++#  define _WIN32_WINNT _WIN32_WINNT_WIN8
++# endif
++#else
++# define WIN32_ASSUME_VISTA (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
+ #endif
+ 
+ #include <sys/types.h>
+@@ -46,7 +58,7 @@
+ #undef GetFinalPathNameByHandle
+ #define GetFinalPathNameByHandle GetFinalPathNameByHandleA
+ 
+-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
++#if !WIN32_ASSUME_VISTA
+ 
+ /* Avoid warnings from gcc -Wcast-function-type.  */
+ # define GetProcAddress \
+@@ -149,7 +161,7 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf)
+   DWORD type = GetFileType (h);
+   if (type == FILE_TYPE_DISK)
+     {
+-#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
++#if !WIN32_ASSUME_VISTA
+       if (!initialized)
+         initialize ();
+ #endif
+diff --git a/gnulib/import/m4/fstat.m4 b/gnulib/import/m4/fstat.m4
+index 53c089619..bd8cb7966 100644
+--- a/gnulib/import/m4/fstat.m4
++++ b/gnulib/import/m4/fstat.m4
+@@ -1,4 +1,4 @@
+-# fstat.m4 serial 6
++# fstat.m4 serial 7
+ dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+@@ -35,5 +35,6 @@ AC_DEFUN([gl_FUNC_FSTAT],
+ # Prerequisites of lib/fstat.c and lib/stat-w32.c.
+ AC_DEFUN([gl_PREREQ_FSTAT], [
+   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
++  AC_REQUIRE([gl_PREREQ_STAT_W32])
+   :
+ ])
+diff --git a/gnulib/import/m4/stat.m4 b/gnulib/import/m4/stat.m4
+index 46e9abcee..db2038f63 100644
+--- a/gnulib/import/m4/stat.m4
++++ b/gnulib/import/m4/stat.m4
+@@ -1,4 +1,4 @@
+-# serial 16
++# serial 17
+ 
+ # Copyright (C) 2009-2020 Free Software Foundation, Inc.
+ #
+@@ -70,5 +70,16 @@ AC_DEFUN([gl_FUNC_STAT],
+ # Prerequisites of lib/stat.c and lib/stat-w32.c.
+ AC_DEFUN([gl_PREREQ_STAT], [
+   AC_REQUIRE([gl_HEADER_SYS_STAT_H])
++  AC_REQUIRE([gl_PREREQ_STAT_W32])
+   :
+ ])
++
++# Prerequisites of lib/stat-w32.c.
++AC_DEFUN([gl_PREREQ_STAT_W32], [
++  AC_REQUIRE([AC_CANONICAL_HOST])
++  case "$host_os" in
++    mingw*)
++      AC_CHECK_HEADERS([sdkddkver.h])
++      ;;
++  esac
++])
+-- 
+2.17.1
+
diff --git a/gnulib/patches/0003-stat-fstat-windows-old-mingw b/gnulib/patches/0003-stat-fstat-windows-old-mingw
new file mode 100644
index 00000000000..e43c88f08ce
--- /dev/null
+++ b/gnulib/patches/0003-stat-fstat-windows-old-mingw
@@ -0,0 +1,34 @@
+From f8c23f202d11992182e87736e73929bcc369cc75 Mon Sep 17 00:00:00 2001
+From: Bruno Haible <bruno@clisp.org>
+Date: Wed, 16 Sep 2020 23:52:44 +0200
+Subject: [PATCH 2/2] stat, fstat: Fix compilation error with old mingw
+ headers.
+
+Reported by Eli Zaretskii <eliz@gnu.org> in
+<https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00027.html>.
+
+* lib/stat-w32.c (VOLUME_NAME_NONE): Define if the Windows headers don't
+define it.
+---
+ stat-w32.c | 5 +++++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c
+index 72442e933..108ce199c 100644
+--- a/gnulib/import/stat-w32.c
++++ b/gnulib/import/stat-w32.c
+@@ -58,6 +58,11 @@
+ #undef GetFinalPathNameByHandle
+ #define GetFinalPathNameByHandle GetFinalPathNameByHandleA
+ 
++/* Older mingw headers do not define VOLUME_NAME_NONE.  */
++#ifndef VOLUME_NAME_NONE
++# define VOLUME_NAME_NONE 4
++#endif
++
+ #if !WIN32_ASSUME_VISTA
+ 
+ /* Avoid warnings from gcc -Wcast-function-type.  */
+-- 
+2.17.1
+
diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh
index ac5e3d56a29..3aa70141a59 100755
--- a/gnulib/update-gnulib.sh
+++ b/gnulib/update-gnulib.sh
@@ -174,6 +174,12 @@ apply_patches ()
 }
 
 apply_patches "patches/0001-use-windows-stat"
+# The following two patches are specific imports of two commits
+# already in gnulib's master. We import those patches individually
+# because we want to avoid doing a standard gnulib update, which
+# would be too disruptive for a release branch.
+apply_patches "patches/0002-stat-fstat-windows-older-vista"
+apply_patches "patches/0003-stat-fstat-windows-old-mingw"
 
 # Regenerate all necessary files...
 aclocal &&
-- 
2.17.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-10-09 19:53 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 23:46 GDB 10.1 release -- 2020-09-18 Update Joel Brobecker
2020-09-19  1:37 ` Simon Marchi
2020-09-19 19:42   ` Joel Brobecker
2020-09-19 23:58     ` Simon Marchi
2020-09-19  7:41 ` Eli Zaretskii
2020-09-19 19:48   ` Joel Brobecker
2020-09-21 16:26     ` Eli Zaretskii
2020-09-26 17:39       ` Joel Brobecker
2020-09-28  9:30         ` Eli Zaretskii
2020-09-28 20:11           ` Joel Brobecker
2020-10-09 19:53             ` [pushed/gdb-10-branch] gnulib: fix stat/fstat build errors on old Windows version or using old MinGW Joel Brobecker
2020-09-20  1:03 ` GDB 10.1 release -- 2020-09-18 Update Simon Marchi
2020-09-20  6:09   ` Eli Zaretskii
2020-09-21 19:54 ` Simon Marchi
2020-09-23 13:39   ` Tom Tromey
2020-09-23 14:00     ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).