fix incorrect gnulib getcwd replacement when cross-compiling GDB
authorSergio Durigan Junior <sergiodj@redhat.com>
Tue, 4 Sep 2018 17:51:46 +0000 (19:51 +0200)
committerJoel Brobecker <brobecker@adacore.com>
Tue, 4 Sep 2018 18:00:50 +0000 (20:00 +0200)
This fixes a GDB crash observed on Android 8.0 when GDB was
cross-compiled. This patch is a backport of a patch pushed
upstream in gnulib.

gdb/ChangeLog (Sergio Durigan Junior  <sergiodj@redhat.com>):

        PR gdb/23558
        * gnulib/import/m4/getcwd-path-max.m4: Add handling of Hurd,
        Linux and kFreeBSD platforms.
        * gnulib/configure: Regenerate.

gdb/ChangeLog
gdb/gnulib/configure
gdb/gnulib/import/m4/getcwd-path-max.m4

index cf3171d..7bf4edf 100644 (file)
@@ -1,3 +1,10 @@
+2018-09-04  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       PR gdb/23558
+       * gnulib/import/m4/getcwd-path-max.m4: Add handling of Hurd,
+       Linux and kFreeBSD platforms.
+       * gnulib/configure: Regenerate.
+
 2018-08-31  Tom Tromey  <tom@tromey.com>
 
        * dwarf2read.c (dwarf2_add_field): Set the TYPE_LENGTH of the
index 55a59b9..a152abc 100644 (file)
@@ -16389,10 +16389,22 @@ else
   # Arrange for deletion of the temporary directory this test creates.
      ac_clean_files="$ac_clean_files confdir3"
           if test "$cross_compiling" = yes; then :
-  case "$host_os" in
-       aix*) gl_cv_func_getcwd_path_max='no, it has the AIX bug';;
-       *) gl_cv_func_getcwd_path_max=no;;
+  # Cross-compilation guesses:
+     case "$host_os" in
+       aix*) # On AIX, it has the AIX bug.
+         gl_cv_func_getcwd_path_max='no, it has the AIX bug' ;;
+       gnu*) # On Hurd, it is 'yes'.
+         gl_cv_func_getcwd_path_max=yes ;;
+       linux* | kfreebsd*)
+         # On older Linux+glibc it's 'no, but it is partly working',
+         # on newer Linux+glibc it's 'yes'.
+         # On Linux+musl libc, it's 'no, but it is partly working'.
+         # On kFreeBSD+glibc, it's 'no, but it is partly working'.
+         gl_cv_func_getcwd_path_max='no, but it is partly working' ;;
+       *) # If we don't know, assume the worst.
+         gl_cv_func_getcwd_path_max=no ;;
      esac
+
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
index 2531ccf..90bbc77 100644 (file)
@@ -209,9 +209,21 @@ main ()
      32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';;
      *) gl_cv_func_getcwd_path_max=no;;
      esac],
-    [case "$host_os" in
-       aix*) gl_cv_func_getcwd_path_max='no, it has the AIX bug';;
-       *) gl_cv_func_getcwd_path_max=no;;
-     esac])
+    [# Cross-compilation guesses:
+     case "$host_os" in
+       aix*) # On AIX, it has the AIX bug.
+         gl_cv_func_getcwd_path_max='no, it has the AIX bug' ;;
+       gnu*) # On Hurd, it is 'yes'.
+         gl_cv_func_getcwd_path_max=yes ;;
+       linux* | kfreebsd*)
+         # On older Linux+glibc it's 'no, but it is partly working',
+         # on newer Linux+glibc it's 'yes'.
+         # On Linux+musl libc, it's 'no, but it is partly working'.
+         # On kFreeBSD+glibc, it's 'no, but it is partly working'.
+         gl_cv_func_getcwd_path_max='no, but it is partly working' ;;
+       *) # If we don't know, assume the worst.
+         gl_cv_func_getcwd_path_max=no ;;
+     esac
+    ])
   ])
 ])