Restore build on x86_64-w64-mingw32.
authorAlexey Neyman <stilor@att.net>
Tue, 4 Dec 2018 07:50:48 +0000 (23:50 -0800)
committerCary Coutant <ccoutant@gmail.com>
Tue, 4 Dec 2018 07:50:48 +0000 (23:50 -0800)
gold/
PR gold/23594
* configure.ac: Add checks for link, mkdtemp.
* configure: Regenerate.
* config.in: Regenerate.
* plugin.cc (Plugin_recorder::init): Fall back to mktemp
if mkdtemp is not available.
(link_or_copy_file): Fall back to copy if link() is not available.

gold/ChangeLog
gold/config.in
gold/configure
gold/configure.ac
gold/plugin.cc

index f42e4863fd5f3cc565bea9187ad93851fd314db1..f0d3ef924351725069ea6f3fba284589f42036e0 100644 (file)
@@ -1,3 +1,13 @@
+2018-12-03  Alexey Neyman  <stilor@att.net>
+
+       PR gold/23594
+       * configure.ac: Add checks for link, mkdtemp.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+       * plugin.cc (Plugin_recorder::init): Fall back to mktemp
+       if mkdtemp is not available.
+       (link_or_copy_file): Fall back to copy if link() is not available.
+
 2018-12-02  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/23919
index 2b53d711855507b73e06db6ffe2657c9aed3f047..7bac34aab25fe53cef0bb7d5adc2c8cfa92ecc49 100644 (file)
 /* Define if your <locale.h> file defines LC_MESSAGES. */
 #undef HAVE_LC_MESSAGES
 
+/* Define to 1 if you have the `link' function. */
+#undef HAVE_LINK
+
 /* Define to 1 if you have the <locale.h> header file. */
 #undef HAVE_LOCALE_H
 
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the `mkdtemp' function. */
+#undef HAVE_MKDTEMP
+
 /* Define to 1 if you have the `mmap' function. */
 #undef HAVE_MMAP
 
index a57025bd0b61b7eee5bb8bfb0d91b10f03c6ec91..216af10f3e097ac6bf68007df89451b0cdb32108 100755 (executable)
@@ -7977,7 +7977,7 @@ fi
 
 done
 
-for ac_func in chsize mmap
+for ac_func in chsize mmap link
 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"
@@ -9866,7 +9866,7 @@ case "$ac_cv_search_dlopen" in
 esac
 
 
-for ac_func in mallinfo posix_fallocate fallocate readv sysconf times
+for ac_func in mallinfo posix_fallocate fallocate readv sysconf times mkdtemp
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
index d9a1869070ebecd6b365724f24d32bbb67485f56..6ab43b93596b5ccec1b71eb648fe3fbc0654c738 100644 (file)
@@ -529,7 +529,7 @@ LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
 AC_SUBST(LFS_CFLAGS)
 
 AC_CHECK_HEADERS(sys/mman.h)
-AC_CHECK_FUNCS(chsize mmap)
+AC_CHECK_FUNCS(chsize mmap link)
 AC_REPLACE_FUNCS(pread ftruncate ffsll)
 
 AC_CACHE_CHECK([mremap with MREMAP_MAYMOVE], [gold_cv_lib_mremap_maymove],
@@ -613,7 +613,7 @@ case "$ac_cv_search_dlopen" in
 esac
 AC_SUBST(DLOPEN_LIBS)
 
-AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times)
+AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times mkdtemp)
 AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem])
 
 # Use of ::std::tr1::unordered_map::rehash causes undefined symbols
index 3415b914ad679bbf93a7601ea83c6652c3918334..70b83b4713417b062acbe3da9f0b328bab47ddd3 100644 (file)
@@ -508,8 +508,20 @@ Plugin_recorder::init()
   // Create a temporary directory where we can stash the log and
   // copies of replacement files.
   char dir_template[] = "gold-recording-XXXXXX";
+#ifdef HAVE_MKDTEMP
   if (mkdtemp(dir_template) == NULL)
     return false;
+#else
+  if (mktemp(dir_template) == NULL)
+    return false;
+#if defined (_WIN32) && !defined (__CYGWIN32__)
+  if (mkdir(dir_template) != 0)
+    return false;
+#else
+  if (mkdir(dir_template, 0700) != 0)
+    return false;
+#endif
+#endif
 
   size_t len = strlen(dir_template) + 1;
   char* tempdir = new char[len];
@@ -562,8 +574,10 @@ link_or_copy_file(const char* inname, const char* outname)
 {
   static char buf[4096];
 
+#ifdef HAVE_LINK
   if (::link(inname, outname) == 0)
     return true;
+#endif
 
   int in = ::open(inname, O_RDONLY);
   if (in < 0)
This page took 0.037359 seconds and 4 git commands to generate.