From: Sergio Durigan Junior Date: Tue, 4 Sep 2018 17:51:46 +0000 (+0200) Subject: fix incorrect gnulib getcwd replacement when cross-compiling GDB X-Git-Tag: gdb-8.2-release~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f30171bf98082846a725c1d116650d0c8998564c;p=thirdparty%2Fbinutils-gdb.git fix incorrect gnulib getcwd replacement when cross-compiling GDB 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 ): PR gdb/23558 * gnulib/import/m4/getcwd-path-max.m4: Add handling of Hurd, Linux and kFreeBSD platforms. * gnulib/configure: Regenerate. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cf3171d6bcd..7bf4edf3f4e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2018-09-04 Sergio Durigan Junior + + 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 * dwarf2read.c (dwarf2_add_field): Set the TYPE_LENGTH of the diff --git a/gdb/gnulib/configure b/gdb/gnulib/configure index 55a59b92eb8..a152abcb762 100644 --- a/gdb/gnulib/configure +++ b/gdb/gnulib/configure @@ -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. */ diff --git a/gdb/gnulib/import/m4/getcwd-path-max.m4 b/gdb/gnulib/import/m4/getcwd-path-max.m4 index 2531ccff65c..90bbc77dea1 100644 --- a/gdb/gnulib/import/m4/getcwd-path-max.m4 +++ b/gdb/gnulib/import/m4/getcwd-path-max.m4 @@ -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 + ]) ]) ])