summaryrefslogtreecommitdiff
path: root/lto-plugin
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-07 15:53:40 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-07 15:53:40 +0000
commiteb4ef3d174e02aef6597790662ecfceed210cbb1 (patch)
tree29dabebed4129e0cb07c2120a2171cf6005fa4b9 /lto-plugin
parentfa60f42b454d2f8e591d9cf767ac00821dbf2ee2 (diff)
downloadgcc-eb4ef3d174e02aef6597790662ecfceed210cbb1.tar.gz
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=. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159159 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'lto-plugin')
-rw-r--r--lto-plugin/ChangeLog8
-rw-r--r--lto-plugin/lto-plugin.c25
2 files changed, 14 insertions, 19 deletions
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index 338f58ce332..df771284e67 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -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>
PR other/43620
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index d0266ffee6c..cb785c428a8 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -294,12 +294,6 @@ free_2 (void)
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. */
@@ -310,6 +304,7 @@ write_resolution (void)
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");
@@ -467,7 +462,7 @@ static enum ld_plugin_status
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)
@@ -483,8 +478,6 @@ all_symbols_read_handler (void)
lto_arg_ptr = (const char **) lto_argv;
assert (lto_wrapper_argv);
- resolution_file = make_temp_file ("");
-
write_resolution ();
free_1 ();
@@ -492,9 +485,6 @@ all_symbols_read_handler (void)
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];
@@ -543,12 +533,6 @@ cleanup_handler (void)
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]);
@@ -657,10 +641,13 @@ process_option (const char *option)
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;
}
}