aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2018-12-03 23:50:48 -0800
committerCary Coutant <ccoutant@gmail.com>2018-12-03 23:50:48 -0800
commitf4238194a211a6a27598a7fdf9ad63f9b5d6fbaa (patch)
treecdf77d24f3ea44f4d671edc048f1a36205ef8c29 /gold/plugin.cc
parent314a80c41d52737c9cfdc80dc2f6f56e0d5cfd96 (diff)
downloadgdb-f4238194a211a6a27598a7fdf9ad63f9b5d6fbaa.zip
gdb-f4238194a211a6a27598a7fdf9ad63f9b5d6fbaa.tar.gz
gdb-f4238194a211a6a27598a7fdf9ad63f9b5d6fbaa.tar.bz2
Restore build on x86_64-w64-mingw32.
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.
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index 3415b91..70b83b4 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -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)