aboutsummaryrefslogtreecommitdiff
path: root/lto-plugin
diff options
context:
space:
mode:
authorRafael Avila de Espindola <espindola@google.com>2009-11-12 14:01:49 +0000
committerRafael Espindola <espindola@gcc.gnu.org>2009-11-12 14:01:49 +0000
commit06bd7f563b5358d34b592e9d630ad770c3ec15c2 (patch)
tree0bbaf16645e4e8605fd81ea4a413098ba0b198fe /lto-plugin
parent7248efd98d28eaf518caee2cceca0ec4cb076730 (diff)
downloadgcc-06bd7f563b5358d34b592e9d630ad770c3ec15c2.zip
gcc-06bd7f563b5358d34b592e9d630ad770c3ec15c2.tar.gz
gcc-06bd7f563b5358d34b592e9d630ad770c3ec15c2.tar.bz2
lto-plugin.c (write_resolution): Assume resolution_file is set.
2009-11-12 Rafael Avila de Espindola <espindola@google.com> * lto-plugin.c (write_resolution): Assume resolution_file is set. Print the symbol name. (all_symbols_read_handler): Create a resolution file. Pass it to gcc. (cleanup_handler): Remove the resolution file. (process_option): Drop the -resolution option. 2009-11-12 Rafael Avila de Espindola <espindola@google.com> * lang.opt (fresolution): Renamed from resolution. * lto-lang.c (lto_handle_option): Handle new option name. * lto.c (lto_resolution_read): Add more checks. Discard rest of line. From-SVN: r154118
Diffstat (limited to 'lto-plugin')
-rw-r--r--lto-plugin/ChangeLog9
-rw-r--r--lto-plugin/lto-plugin.c22
2 files changed, 22 insertions, 9 deletions
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index 27713ca..d95cf05 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,12 @@
+2009-11-12 Rafael Avila de Espindola <espindola@google.com>
+
+ * lto-plugin.c (write_resolution): Assume resolution_file is set.
+ Print the symbol name.
+ (all_symbols_read_handler): Create a resolution file.
+ Pass it to gcc.
+ (cleanup_handler): Remove the resolution file.
+ (process_option): Drop the -resolution option.
+
2009-11-05 Rafael Avila de Espindola <espindola@google.com>
* lto-plugin.c (temp_obj_dir_name): Remove.
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index e8e88cb..8cbafbc 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -310,9 +310,6 @@ write_resolution (void)
unsigned int i;
FILE *f;
- if (!resolution_file)
- return;
-
f = fopen (resolution_file, "w");
check (f, LDPL_FATAL, "could not open file");
@@ -334,7 +331,7 @@ write_resolution (void)
{
uint32_t slot = symtab->slots[j];
unsigned int resolution = syms[j].resolution;
- fprintf (f, "%d %s\n", slot, lto_resolution_str[resolution]);
+ fprintf (f, "%d %s %s\n", slot, lto_resolution_str[resolution], syms[j].name);
}
}
fclose (f);
@@ -452,7 +449,7 @@ static enum ld_plugin_status
all_symbols_read_handler (void)
{
unsigned i;
- unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 1;
+ unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 2 + 1;
char **lto_argv;
const char **lto_arg_ptr;
if (num_claimed_files == 0)
@@ -468,6 +465,8 @@ 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 ();
@@ -475,6 +474,9 @@ 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];
@@ -522,6 +524,12 @@ 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");
+ }
+
free_2 ();
return LDPS_OK;
}
@@ -613,10 +621,6 @@ process_option (const char *option)
debug = 1;
else if (strcmp (option, "-nop") == 0)
nop = 1;
- else if (!strncmp (option, "-resolution=", strlen("-resolution=")))
- {
- resolution_file = strdup (option + strlen("-resolution="));
- }
else if (!strncmp (option, "-pass-through=", strlen("-pass-through=")))
{
num_pass_through_items++;