aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2017-09-22 13:38:10 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-09-22 13:38:10 +0000
commit8c2ea6b20a48d626d3dae78ac177affb7f67e182 (patch)
tree45668dec72f6f6dbdf72fb967ca86b70695798e0
parent4d6e2f33a437fc6ead8218bf5f0e2cdb3e834d9e (diff)
downloadgcc-8c2ea6b20a48d626d3dae78ac177affb7f67e182.zip
gcc-8c2ea6b20a48d626d3dae78ac177affb7f67e182.tar.gz
gcc-8c2ea6b20a48d626d3dae78ac177affb7f67e182.tar.bz2
re PR sanitizer/77631 (no symbols in backtrace shown by ASan when debug info is split)
PR sanitizer/77631 * configure.ac: Check for lstat and readlink. * elf.c (lstat, readlink): Provide dummy versions if real versions are not available. * configure, config.h.in: Rebuild. From-SVN: r253095
-rw-r--r--libbacktrace/ChangeLog8
-rw-r--r--libbacktrace/config.h.in6
-rwxr-xr-xlibbacktrace/configure13
-rw-r--r--libbacktrace/configure.ac1
-rw-r--r--libbacktrace/elf.c29
5 files changed, 57 insertions, 0 deletions
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index d611a1f..ed99678 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,11 @@
+2017-09-22 Ian Lance Taylor <iant@golang.org>
+
+ PR sanitizer/77631
+ * configure.ac: Check for lstat and readlink.
+ * elf.c (lstat, readlink): Provide dummy versions if real versions
+ are not available.
+ * configure, config.h.in: Rebuild.
+
2017-09-21 Ian Lance Taylor <iant@google.com>
PR go/82284
diff --git a/libbacktrace/config.h.in b/libbacktrace/config.h.in
index 9fc7715..1c38e8e 100644
--- a/libbacktrace/config.h.in
+++ b/libbacktrace/config.h.in
@@ -37,9 +37,15 @@
/* Define if AIX loadquery is available. */
#undef HAVE_LOADQUERY
+/* Define to 1 if you have the `lstat' function. */
+#undef HAVE_LSTAT
+
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the `readlink' function. */
+#undef HAVE_READLINK
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 3ef9331..660a778 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -12708,6 +12708,19 @@ cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRNLEN $ac_have_decl
_ACEOF
+for ac_func in lstat readlink
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
# Check for getexecname function.
if test -n "${with_target_subdir}"; then
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 97e6e96..c88122d 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -373,6 +373,7 @@ if test "$have_fcntl" = "yes"; then
fi
AC_CHECK_DECLS(strnlen)
+AC_CHECK_FUNCS(lstat readlink)
# Check for getexecname function.
if test -n "${with_target_subdir}"; then
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index eb7d303..fac4686 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -75,6 +75,35 @@ xstrnlen (const char *s, size_t maxlen)
#endif
+#ifndef HAVE_LSTAT
+
+/* Dummy version of lstat for systems that don't have it. */
+
+static int
+xlstat (const char *path ATTRIBUTE_UNUSED, struct stat *st ATTRIBUTE_UNUSED)
+{
+ return -1;
+}
+
+#define lstat xlstat
+
+#endif
+
+#ifndef HAVE_READLINK
+
+/* Dummy version of readlink for systems that don't have it. */
+
+static ssize_t
+xreadlink (const char *path ATTRIBUTE_UNUSED, char *buf ATTRIBUTE_UNUSED,
+ size_t bufsz ATTRIBUTE_UNUSED)
+{
+ return -1;
+}
+
+#define readlink xreadlink
+
+#endif
+
#ifndef HAVE_DL_ITERATE_PHDR
/* Dummy version of dl_iterate_phdr for systems that don't have it. */