aboutsummaryrefslogtreecommitdiff
path: root/gcc
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 /gcc
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 'gcc')
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/lang.opt2
-rw-r--r--gcc/lto/lto-lang.c2
-rw-r--r--gcc/lto/lto.c10
4 files changed, 14 insertions, 6 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 3334de7..6cb9ff4 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2009-11-04 Richard Guenther <rguenther@suse.de>
Rafael Avila de Espindola <espindola@google.com>
diff --git a/gcc/lto/lang.opt b/gcc/lto/lang.opt
index f383d7c..a8b7916 100644
--- a/gcc/lto/lang.opt
+++ b/gcc/lto/lang.opt
@@ -36,7 +36,7 @@ fwpa
LTO Report Var(flag_wpa) Optimization
Run the link-time optimizer in whole program analysis (WPA) mode.
-resolution
+fresolution
LTO Separate
The resolution file
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index 04d4230..486338f 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -622,7 +622,7 @@ lto_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
switch (code)
{
- case OPT_resolution:
+ case OPT_fresolution:
resolution_file_name = arg;
result = 1;
break;
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index d8c49cf..323f6b3 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -284,6 +284,7 @@ lto_resolution_read (FILE *resolution, const char *file_name)
for (i = 0; i < num_symbols; i++)
{
+ int t;
unsigned index;
char r_str[27];
enum ld_plugin_symbol_resolution r;
@@ -291,7 +292,9 @@ lto_resolution_read (FILE *resolution, const char *file_name)
unsigned int lto_resolution_str_len =
sizeof (lto_resolution_str) / sizeof (char *);
- fscanf (resolution, "%u %26s", &index, r_str);
+ t = fscanf (resolution, "%u %26s %*[^\n]\n", &index, r_str);
+ if (t != 2)
+ internal_error ("Invalid line in the resolution file.");
if (index > max_index)
max_index = index;
@@ -303,9 +306,8 @@ lto_resolution_read (FILE *resolution, const char *file_name)
break;
}
}
- if (j >= lto_resolution_str_len)
- internal_error ("tried to read past the end of the linker resolution "
- "file");
+ if (j == lto_resolution_str_len)
+ internal_error ("Invalid resolution in the resolution file.");
VEC_safe_grow_cleared (ld_plugin_symbol_resolution_t, heap, ret,
index + 1);