This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto][patch] Add a -nop option to the linker plugin
- From: Rafael Espindola <espindola at google dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: Diego Novillo <dnovillo at google dot com>
- Date: Mon, 8 Dec 2008 13:48:20 +0000
- Subject: [lto][patch] Add a -nop option to the linker plugin
This patch adds a -nop option to the plugin. With this option the
plugin just uses the original files, instead of running wpa. This is
useful for trying to find if a problem is on wpa or in the plugin
itself.
2008-12-08 Rafael Avila de Espindola <espindola@google.com>
* lto-plugin.c (nop): New.
(use_original_files): New.
(all_symbols_read_handler): Call use_original_files if nop is true.
(process_option): Parse the -nop option.
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index 16171a0..1b6d211 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -94,6 +94,7 @@ static char **lto_wrapper_argv;
static int lto_wrapper_num_args;
static int debug;
+static int nop;
/* Parse an entry of the IL symbol table. The data to be parsed is pointed
by P and the result is written in ENTRY. The slot number is stored in SLOT.
@@ -396,6 +397,17 @@ exec_lto_wrapper (char *const argv[])
}
}
+static void
+use_original_files (void)
+{
+ unsigned i;
+ for (i = 0; i < num_claimed_files; i++)
+ {
+ struct plugin_file_info *info = &claimed_files[i];
+ add_input_file (info->name);
+ }
+}
+
/* Called by the linker once all symbols have been read. */
@@ -409,12 +421,18 @@ all_symbols_read_handler (void)
if (num_claimed_files == 0)
return LDPS_OK;
+ free_1 ();
+
+ if (nop)
+ {
+ use_original_files ();
+ return LDPS_OK;
+ }
+
lto_argv = (char **) calloc (sizeof (char *), num_lto_args);
lto_arg_ptr = (const char **) lto_argv;
assert (lto_wrapper_argv);
- free_1 ();
-
write_resolution ();
for (i = 0; i < lto_wrapper_num_args; i++)
@@ -558,6 +576,8 @@ process_option (const char *option)
{
if (strcmp (option, "-debug") == 0)
debug = 1;
+ else if (strcmp (option, "-nop") == 0)
+ nop = 1;
else
{
int size;