%{fuse-linker-plugin: \
-plugin %(linker_plugin_file) \
-plugin-opt=%(lto_wrapper) \
+ -plugin-opt=%(lto_gcc) \
-plugin-opt=-fresolution=%u.res \
%{static|static-libgcc:-plugin-opt=-pass-through=%(lto_libgcc)} \
%{static:-plugin-opt=-pass-through=-lc} \
+ %{O*:-plugin-opt=-O%*} \
+ %{w:-plugin-opt=-w} \
+ %{f*:-plugin-opt=-f%*} \
+ %{m*:-plugin-opt=-m%*} \
+ %{v:-plugin-opt=-v} \
} \
- %{flto} %{fwhopr*} %l " LINK_PIE_SPEC \
+ %{flto} %{fwhopr} %l " LINK_PIE_SPEC \
"%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
%{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
/* Name with which this program was invoked. */
static const char *programname;
+
+/* This is the common prefix we use to make temp file names.
+ It is chosen once for each run of this program.
+ It is substituted into a spec by %g or %j.
+ Thus, all temp file names contain this prefix.
+ In practice, all temp file names start with this prefix.
+
+ This prefix comes from the envvar TMPDIR if it is defined;
+ otherwise, from the P_tmpdir macro if that is defined;
+ otherwise, in /usr/tmp or /tmp;
+ or finally the current directory if all else fails. */
+
+static const char *temp_filename;
+
+/* Length of the prefix. */
+
+static int temp_filename_length;
\f
/* Allocate the argument vector. */
if (strcmp (arg, "-o") == 0)
have_o_argbuf_index = argbuf_index;
if (delete_always || delete_failure)
- {
- const char *p;
- /* If the temporary file we should delete is specified as
- part of a joined argument extract the filename. */
- if (arg[0] == '-'
- && (p = strrchr (arg, '=')))
- arg = p + 1;
- record_temp_file (arg, delete_always, delete_failure);
- }
+ record_temp_file (temp_filename, delete_always, delete_failure);
}
\f
/* Load specs from a file name named FILENAME, replacing occurrences of
/* Record the names of temporary files we tell compilers to write,
and delete them at the end of the run. */
-/* This is the common prefix we use to make temp file names.
- It is chosen once for each run of this program.
- It is substituted into a spec by %g or %j.
- Thus, all temp file names contain this prefix.
- In practice, all temp file names start with this prefix.
-
- This prefix comes from the envvar TMPDIR if it is defined;
- otherwise, from the P_tmpdir macro if that is defined;
- otherwise, in /usr/tmp or /tmp;
- or finally the current directory if all else fails. */
-
-static const char *temp_filename;
-
-/* Length of the prefix. */
-
-static int temp_filename_length;
-
/* Define the list of temporary files to delete. */
struct temp_file
for (j = commands[i].argv; *j; j++)
{
const char *p;
+ fprintf (stderr, " \"");
for (p = *j; *p; ++p)
- if (!ISALNUM ((unsigned char) *p)
- && *p != '_' && *p != '/' && *p != '-' && *p != '.')
- break;
- if (*p || !*j)
{
- fprintf (stderr, " \"");
- for (p = *j; *p; ++p)
- {
- if (*p == '"' || *p == '\\' || *p == '$')
- fputc ('\\', stderr);
- fputc (*p, stderr);
- }
- fputc ('"', stderr);
+ if (*p == '"' || *p == '\\' || *p == '$')
+ fputc ('\\', stderr);
+ fputc (*p, stderr);
}
- else
- fprintf (stderr, " %s", *j);
+ fputc ('"', stderr);
}
}
else
if (arguments_file_name)
free (arguments_file_name);
arguments_file_name = NULL;
-
- if (resolution_file)
- {
- free (resolution_file);
- resolution_file = NULL;
- }
}
/* Writes the relocations to disk. */
unsigned int i;
FILE *f;
+ check (resolution_file, LDPL_FATAL, "resolution file not specified");
f = fopen (resolution_file, "w");
check (f, LDPL_FATAL, "could not open file");
all_symbols_read_handler (void)
{
unsigned i;
- unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 2 + 1;
+ unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 1;
char **lto_argv;
const char **lto_arg_ptr;
if (num_claimed_files == 0)
lto_arg_ptr = (const char **) lto_argv;
assert (lto_wrapper_argv);
- resolution_file = make_temp_file ("");
-
write_resolution ();
free_1 ();
for (i = 0; i < lto_wrapper_num_args; i++)
*lto_arg_ptr++ = lto_wrapper_argv[i];
- *lto_arg_ptr++ = "-fresolution";
- *lto_arg_ptr++ = resolution_file;
-
for (i = 0; i < num_claimed_files; i++)
{
struct plugin_file_info *info = &claimed_files[i];
check (t == 0, LDPL_FATAL, "could not unlink arguments file");
}
- if (resolution_file)
- {
- t = unlink (resolution_file);
- check (t == 0, LDPL_FATAL, "could not unlink resolution file");
- }
-
for (i = 0; i < num_output_files; i++)
{
t = unlink (output_files[i]);
else
{
int size;
+ char *opt = xstrdup (option);
lto_wrapper_num_args += 1;
size = lto_wrapper_num_args * sizeof (char *);
lto_wrapper_argv = (char **) xrealloc (lto_wrapper_argv, size);
- lto_wrapper_argv[lto_wrapper_num_args - 1] = xstrdup(option);
+ lto_wrapper_argv[lto_wrapper_num_args - 1] = opt;
+ if (strncmp (option, "-fresolution=", sizeof ("-fresolution=") - 1) == 0)
+ resolution_file = opt + sizeof ("-fresolution=") - 1;
}
}