mirror of git://gcc.gnu.org/git/gcc.git
re PR lto/43857 (-fresolution causes an ICE)
2010-05-07 Richard Guenther <rguenther@suse.de> * gcc.c (LINK_COMMAND_SPEC): Provide a resolution file to the linker plugin. (store_arg): Queue temp_filename for deletion instead of the whole argument. lto/ PR lto/43857 PR lto/43371 * lang.opt (fresolution): Change to ... (fresolution=): ... this. * lto-lang.c (lto_handle_option): Adjust. lto-plugin/ * lto-plugin.c (free_2): Do not free resolution_file. (write_resolution): Check that we were passed a resolution file. (all_symbols_read_handler): Adjust. (cleanup_handler): Do not remove the resolution file. (process_option): Handle -fresolution=. From-SVN: r159159
This commit is contained in:
parent
40bb78ad24
commit
5cd0e96b0e
|
@ -1,3 +1,10 @@
|
||||||
|
2010-05-07 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
* gcc.c (LINK_COMMAND_SPEC): Provide a resolution file to
|
||||||
|
the linker plugin.
|
||||||
|
(store_arg): Queue temp_filename for deletion instead of
|
||||||
|
the whole argument.
|
||||||
|
|
||||||
2010-05-07 Richard Guenther <rguenther@suse.de>
|
2010-05-07 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
* lto-wrapper.c (DUMPBASE_SUFFIX): Define.
|
* lto-wrapper.c (DUMPBASE_SUFFIX): Define.
|
||||||
|
|
37
gcc/gcc.c
37
gcc/gcc.c
|
@ -782,6 +782,7 @@ proper position among the other output files. */
|
||||||
-plugin %(linker_plugin_file) \
|
-plugin %(linker_plugin_file) \
|
||||||
-plugin-opt=%(lto_wrapper) \
|
-plugin-opt=%(lto_wrapper) \
|
||||||
-plugin-opt=%(lto_gcc) \
|
-plugin-opt=%(lto_gcc) \
|
||||||
|
-plugin-opt=-fresolution=%u.res \
|
||||||
%{static|static-libgcc:-plugin-opt=-pass-through=%(lto_libgcc)} \
|
%{static|static-libgcc:-plugin-opt=-pass-through=%(lto_libgcc)} \
|
||||||
%{static:-plugin-opt=-pass-through=-lc} \
|
%{static:-plugin-opt=-pass-through=-lc} \
|
||||||
%{O*:-plugin-opt=-O%*} \
|
%{O*:-plugin-opt=-O%*} \
|
||||||
|
@ -2044,6 +2045,23 @@ static int signal_count;
|
||||||
/* Name with which this program was invoked. */
|
/* Name with which this program was invoked. */
|
||||||
|
|
||||||
static const char *programname;
|
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;
|
||||||
|
|
||||||
/* Allocate the argument vector. */
|
/* Allocate the argument vector. */
|
||||||
|
|
||||||
|
@ -2081,7 +2099,7 @@ store_arg (const char *arg, int delete_always, int delete_failure)
|
||||||
if (strcmp (arg, "-o") == 0)
|
if (strcmp (arg, "-o") == 0)
|
||||||
have_o_argbuf_index = argbuf_index;
|
have_o_argbuf_index = argbuf_index;
|
||||||
if (delete_always || delete_failure)
|
if (delete_always || delete_failure)
|
||||||
record_temp_file (arg, delete_always, delete_failure);
|
record_temp_file (temp_filename, delete_always, delete_failure);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load specs from a file name named FILENAME, replacing occurrences of
|
/* Load specs from a file name named FILENAME, replacing occurrences of
|
||||||
|
@ -2384,23 +2402,6 @@ read_specs (const char *filename, int main_p)
|
||||||
/* Record the names of temporary files we tell compilers to write,
|
/* Record the names of temporary files we tell compilers to write,
|
||||||
and delete them at the end of the run. */
|
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. */
|
/* Define the list of temporary files to delete. */
|
||||||
|
|
||||||
struct temp_file
|
struct temp_file
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2010-05-07 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR lto/43857
|
||||||
|
PR lto/43371
|
||||||
|
* lang.opt (fresolution): Change to ...
|
||||||
|
(fresolution=): ... this.
|
||||||
|
* lto-lang.c (lto_handle_option): Adjust.
|
||||||
|
|
||||||
2010-05-07 Richard Guenther <rguenther@suse.de>
|
2010-05-07 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
* lto.c (DUMPBASE_SUFFIX): Remove.
|
* lto.c (DUMPBASE_SUFFIX): Remove.
|
||||||
|
|
|
@ -36,8 +36,8 @@ fwpa
|
||||||
LTO Report Var(flag_wpa) Optimization
|
LTO Report Var(flag_wpa) Optimization
|
||||||
Run the link-time optimizer in whole program analysis (WPA) mode.
|
Run the link-time optimizer in whole program analysis (WPA) mode.
|
||||||
|
|
||||||
fresolution
|
fresolution=
|
||||||
LTO Separate
|
LTO Joined
|
||||||
The resolution file
|
The resolution file
|
||||||
|
|
||||||
; This comment is to ensure we retain the blank line above.
|
; This comment is to ensure we retain the blank line above.
|
||||||
|
|
|
@ -624,7 +624,7 @@ lto_handle_option (size_t scode, const char *arg,
|
||||||
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case OPT_fresolution:
|
case OPT_fresolution_:
|
||||||
resolution_file_name = arg;
|
resolution_file_name = arg;
|
||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2010-05-07 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
* lto-plugin.c (free_2): Do not free resolution_file.
|
||||||
|
(write_resolution): Check that we were passed a resolution file.
|
||||||
|
(all_symbols_read_handler): Adjust.
|
||||||
|
(cleanup_handler): Do not remove the resolution file.
|
||||||
|
(process_option): Handle -fresolution=.
|
||||||
|
|
||||||
2010-05-04 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
2010-05-04 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||||
|
|
||||||
PR other/43620
|
PR other/43620
|
||||||
|
|
|
@ -294,12 +294,6 @@ free_2 (void)
|
||||||
if (arguments_file_name)
|
if (arguments_file_name)
|
||||||
free (arguments_file_name);
|
free (arguments_file_name);
|
||||||
arguments_file_name = NULL;
|
arguments_file_name = NULL;
|
||||||
|
|
||||||
if (resolution_file)
|
|
||||||
{
|
|
||||||
free (resolution_file);
|
|
||||||
resolution_file = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Writes the relocations to disk. */
|
/* Writes the relocations to disk. */
|
||||||
|
@ -310,6 +304,7 @@ write_resolution (void)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
|
check (resolution_file, LDPL_FATAL, "resolution file not specified");
|
||||||
f = fopen (resolution_file, "w");
|
f = fopen (resolution_file, "w");
|
||||||
check (f, LDPL_FATAL, "could not open file");
|
check (f, LDPL_FATAL, "could not open file");
|
||||||
|
|
||||||
|
@ -467,7 +462,7 @@ static enum ld_plugin_status
|
||||||
all_symbols_read_handler (void)
|
all_symbols_read_handler (void)
|
||||||
{
|
{
|
||||||
unsigned i;
|
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;
|
char **lto_argv;
|
||||||
const char **lto_arg_ptr;
|
const char **lto_arg_ptr;
|
||||||
if (num_claimed_files == 0)
|
if (num_claimed_files == 0)
|
||||||
|
@ -483,8 +478,6 @@ all_symbols_read_handler (void)
|
||||||
lto_arg_ptr = (const char **) lto_argv;
|
lto_arg_ptr = (const char **) lto_argv;
|
||||||
assert (lto_wrapper_argv);
|
assert (lto_wrapper_argv);
|
||||||
|
|
||||||
resolution_file = make_temp_file ("");
|
|
||||||
|
|
||||||
write_resolution ();
|
write_resolution ();
|
||||||
|
|
||||||
free_1 ();
|
free_1 ();
|
||||||
|
@ -492,9 +485,6 @@ all_symbols_read_handler (void)
|
||||||
for (i = 0; i < lto_wrapper_num_args; i++)
|
for (i = 0; i < lto_wrapper_num_args; i++)
|
||||||
*lto_arg_ptr++ = lto_wrapper_argv[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++)
|
for (i = 0; i < num_claimed_files; i++)
|
||||||
{
|
{
|
||||||
struct plugin_file_info *info = &claimed_files[i];
|
struct plugin_file_info *info = &claimed_files[i];
|
||||||
|
@ -543,12 +533,6 @@ cleanup_handler (void)
|
||||||
check (t == 0, LDPL_FATAL, "could not unlink arguments file");
|
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++)
|
for (i = 0; i < num_output_files; i++)
|
||||||
{
|
{
|
||||||
t = unlink (output_files[i]);
|
t = unlink (output_files[i]);
|
||||||
|
@ -657,10 +641,13 @@ process_option (const char *option)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
|
char *opt = xstrdup (option);
|
||||||
lto_wrapper_num_args += 1;
|
lto_wrapper_num_args += 1;
|
||||||
size = lto_wrapper_num_args * sizeof (char *);
|
size = lto_wrapper_num_args * sizeof (char *);
|
||||||
lto_wrapper_argv = (char **) xrealloc (lto_wrapper_argv, size);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue