This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto-plugin][patch] Do nothing if no file has IR
- 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: Thu, 4 Dec 2008 16:48:13 +0000
- Subject: [lto-plugin][patch] Do nothing if no file has IR
If a plugin is passed to ld and no file has IR, the plugin should do nothing.
2008-12-04 Rafael Avila de Espindola <espindola@google.com>
* lto-plugin.c (all_symbols_read_handler): Do nothing if
num_claimed_files is 0.
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
commit f108b08516c3fe0853e0d62a58a6566d84080fc7
Author: Rafael Espindola <espindola@google.com>
Date: Thu Dec 4 14:54:41 2008 +0000
do nothing if we have no IR files
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index db3ee18..bb91002 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -392,8 +392,13 @@ all_symbols_read_handler (void)
{
unsigned i;
unsigned num_lto_args = num_claimed_files + lto_wrapper_num_args + 1;
- char **lto_argv = (char **) calloc (sizeof (char *), num_lto_args);
- const char **lto_arg_ptr = (const char **) lto_argv;
+ char **lto_argv;
+ const char **lto_arg_ptr;
+ if (num_claimed_files == 0)
+ 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 ();