+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
/* 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
#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
fi
AC_CHECK_DECLS(strnlen)
+AC_CHECK_FUNCS(lstat readlink)
# Check for getexecname function.
if test -n "${with_target_subdir}"; then
#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. */