diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-16 04:41:41 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-16 04:41:41 +0000 |
commit | d286588b498802ef740f5a5f7811cf6108cbbb86 (patch) | |
tree | 04eb53b2ba38d738a1c6ea562be92c9431cee008 /lto-plugin | |
parent | 79037a16e0df1368045c4d1aa939629cae186d5f (diff) | |
download | gcc-d286588b498802ef740f5a5f7811cf6108cbbb86.tar.gz |
2009-10-16 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 152888
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@152889 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'lto-plugin')
-rw-r--r-- | lto-plugin/ChangeLog | 11 | ||||
-rw-r--r-- | lto-plugin/lto-plugin.c | 30 |
2 files changed, 31 insertions, 10 deletions
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog index a68e3ff3343..c8616fa2938 100644 --- a/lto-plugin/ChangeLog +++ b/lto-plugin/ChangeLog @@ -1,3 +1,14 @@ +2009-10-15 Rafael Avila de Espindola <espindola@google.com> + + * lto-plugin.c (resolution_file): New. + (free_1): Update comment. + (free_2): Free resolution_file. + (write_resolution): Write resolution to specified file. Use the + syms array from the symbol table. + (all_symbols_read_handler): Delay call to free_1 past call to + write_resolution. + (process_option): Add a -resolution option. + 2009-10-13 Richard Guenther <rguenther@suse.de> * Makefile.am (liblto_plugin_la_LIBADD): Link against the diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c index 71b4961496c..ae484a9efab 100644 --- a/lto-plugin/lto-plugin.c +++ b/lto-plugin/lto-plugin.c @@ -97,6 +97,7 @@ static unsigned int num_pass_through_items; static bool debug; static bool nop; +static char *resolution_file = NULL; /* 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. @@ -228,7 +229,8 @@ translate (Elf_Data *symtab, struct plugin_symtab *out) out->slots = slots; } -/* Free all memory that is no longer needed at the beginning of all_symbols_read. */ +/* Free all memory that is no longer needed after writing the symbol + resolution. */ static void free_1 (void) @@ -275,6 +277,12 @@ free_2 (void) free (temp_obj_dir_name); temp_obj_dir_name = NULL; + + if (resolution_file) + { + free (resolution_file); + resolution_file = NULL; + } } /* Writes the relocations to disk. */ @@ -284,12 +292,12 @@ write_resolution (void) { unsigned int i; FILE *f; - /* FIXME: Disabled for now since we are not using the resolution file. */ - return; + if (!resolution_file) + return; - /* FIXME: This should be a temporary file. */ - f = fopen ("resolution", "w"); + f = fopen (resolution_file, "w"); + assert (f); fprintf (f, "%d\n", num_claimed_files); @@ -297,8 +305,7 @@ write_resolution (void) { struct plugin_file_info *info = &claimed_files[i]; struct plugin_symtab *symtab = &info->symtab; - struct ld_plugin_symbol *syms = calloc (symtab->nsyms, - sizeof (struct ld_plugin_symbol)); + struct ld_plugin_symbol *syms = symtab->syms; unsigned j; assert (syms); @@ -312,7 +319,6 @@ write_resolution (void) unsigned int resolution = syms[j].resolution; fprintf (f, "%d %s\n", slot, lto_resolution_str[resolution]); } - free (syms); } fclose (f); } @@ -434,8 +440,6 @@ all_symbols_read_handler (void) if (num_claimed_files == 0) return LDPS_OK; - free_1 (); - if (nop) { use_original_files (); @@ -448,6 +452,8 @@ all_symbols_read_handler (void) write_resolution (); + free_1 (); + for (i = 0; i < lto_wrapper_num_args; i++) *lto_arg_ptr++ = lto_wrapper_argv[i]; @@ -608,6 +614,10 @@ 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++; |