aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2018-07-26 12:13:14 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2018-07-26 12:13:14 +0000
commit14ad4d704f7c300307349f8a126667925183487d (patch)
tree2ed49df7c6193dcb1395b26386f0cda4a3c03605 /libiberty
parentb5e320cbfa5f184911335c7b49a073ee0d15ea01 (diff)
Add linker_output as prefix for LTO temps (PR lto/86548).
2018-07-26 Martin Liska <mliska@suse.cz> PR lto/86548 * lto-wrapper.c: Add linker_output as prefix for ltrans_output_file. 2018-07-26 Martin Liska <mliska@suse.cz> PR lto/86548 * libiberty.h (make_temp_file_with_prefix): New function. 2018-07-26 Martin Liska <mliska@suse.cz> PR lto/86548 * make-temp-file.c (TEMP_FILE): Remove leading 'cc'. (make_temp_file): Call make_temp_file_with_prefix with first argument set to NULL. (make_temp_file_with_prefix): Support also prefix. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262999 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog8
-rw-r--r--libiberty/make-temp-file.c24
2 files changed, 26 insertions, 6 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 398d0306d8c..dc5d9971f68 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,11 @@
+2018-07-26 Martin Liska <mliska@suse.cz>
+
+ PR lto/86548
+ * make-temp-file.c (TEMP_FILE): Remove leading 'cc'.
+ (make_temp_file): Call make_temp_file_with_prefix with
+ first argument set to NULL.
+ (make_temp_file_with_prefix): Support also prefix.
+
2018-07-19 Eli Zaretskii <eliz@gnu.org>
* simple-object-elf.c (ENOTSUP): If not defined by errno.h, redirect
diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c
index 89faed7f09e..21b05457542 100644
--- a/libiberty/make-temp-file.c
+++ b/libiberty/make-temp-file.c
@@ -56,7 +56,7 @@ extern int mkstemps (char *, int);
/* Name of temporary file.
mktemp requires 6 trailing X's. */
-#define TEMP_FILE "ccXXXXXX"
+#define TEMP_FILE "XXXXXX"
#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1)
#if !defined(_WIN32) || defined(__CYGWIN__)
@@ -181,25 +181,31 @@ string is @code{malloc}ed, and the temporary file has been created.
*/
char *
-make_temp_file (const char *suffix)
+make_temp_file_with_prefix (const char *prefix, const char *suffix)
{
const char *base = choose_tmpdir ();
char *temp_filename;
- int base_len, suffix_len;
+ int base_len, suffix_len, prefix_len;
int fd;
+ if (prefix == 0)
+ prefix = "cc";
+
if (suffix == 0)
suffix = "";
base_len = strlen (base);
+ prefix_len = strlen (prefix);
suffix_len = strlen (suffix);
temp_filename = XNEWVEC (char, base_len
+ TEMP_FILE_LEN
- + suffix_len + 1);
+ + suffix_len
+ + prefix_len + 1);
strcpy (temp_filename, base);
- strcpy (temp_filename + base_len, TEMP_FILE);
- strcpy (temp_filename + base_len + TEMP_FILE_LEN, suffix);
+ strcpy (temp_filename + base_len, prefix);
+ strcpy (temp_filename + base_len + prefix_len, TEMP_FILE);
+ strcpy (temp_filename + base_len + prefix_len + TEMP_FILE_LEN, suffix);
fd = mkstemps (temp_filename, suffix_len);
/* Mkstemps failed. It may be EPERM, ENOSPC etc. */
@@ -214,3 +220,9 @@ make_temp_file (const char *suffix)
abort ();
return temp_filename;
}
+
+char *
+make_temp_file (const char *suffix)
+{
+ return make_temp_file_with_prefix (NULL, suffix);
+}