This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix PR gdb/23558: Use system's 'getcwd' when cross-compiling GDB
- From: Sergio Durigan Junior <sergiodj at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 10 Sep 2018 17:53:10 -0000
- Subject: [binutils-gdb] Fix PR gdb/23558: Use system's 'getcwd' when cross-compiling GDB
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e2fc52e745757a11f7a4a256984cabbe5474f55a
commit e2fc52e745757a11f7a4a256984cabbe5474f55a
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Mon Sep 10 12:52:04 2018 -0400
Fix PR gdb/23558: Use system's 'getcwd' when cross-compiling GDB
This is a backport of a gnulib fix for the following bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=23558
The problem reported there is about the replacement of 'getcwd' when
cross-compiling GDB. With our current gnulib copy, the mechanism for
deciding whether to use the system's 'getcwd' or gnulib's version is
too simplistic and pessimistic, so when cross-compiling we always end
up using gnulib's version, which has a limitation: it cannot handle
the situation when the parent directory doesn't have read permissions.
The solution is to backport the following gnulib commit:
commit a96d2e67052c879b1bcc5bc461722beac75fc372
Author: Bruno Haible <bruno@clisp.org>
Date: Thu Aug 23 21:13:19 2018 +0200
getcwd: Add cross-compilation guesses.
gdb/ChangeLog:
2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/23555
PR gdb/23558
* gnulib/import/m4/getcwd-path-max.m4: Add cross-compilation
guesses.
Diff:
---
gdb/ChangeLog | 7 +++++++
gdb/gnulib/import/m4/getcwd-path-max.m4 | 20 ++++++++++++++++----
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b48b679..dc4346e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
+ PR gdb/23555
+ PR gdb/23558
+ * gnulib/import/m4/getcwd-path-max.m4: Add cross-compilation
+ guesses.
+
+2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
+
Revert:
2018-08-29 Sergio Durigan Junior <sergiodj@redhat.com>
diff --git a/gdb/gnulib/import/m4/getcwd-path-max.m4 b/gdb/gnulib/import/m4/getcwd-path-max.m4
index 2531ccf..90bbc77 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
+ ])
])
])