diff options
author | ak <ak@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-23 05:33:51 +0000 |
---|---|---|
committer | ak <ak@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-23 05:33:51 +0000 |
commit | f18bad3324ef4d6e39219a4ec94b0a59cbcbb010 (patch) | |
tree | 50e055bbea281c232261eb1e07af42e60ab3a165 /gcc/lto-streamer.c | |
parent | aa5c56571d44e75a4ac0d2824131e011cd38a7c2 (diff) | |
download | gcc-f18bad3324ef4d6e39219a4ec94b0a59cbcbb010.tar.gz |
gcc:
2010-07-10 Andi Kleen <ak@linux.intel.com>
PR lto/44992
* lto-opts.c (lto_write_options): Add NULL file_data argument to
lto_get_section_name.
* lto-section-out.c (lto_destroy_simple_output_block): Likewise.
* lto-streamer-out.c (produce_asm): Likewise.
(copy_function): Likewise.
(produce_symtab): Likewise.
(produce_asm_for_decls): Likewise.
* lto-streamer.c (lto_get_section_name): Add file_data argument.
Rewrite to add random postfix to LTO sections.
* lto-streamer.h (lto_file_decl_data): Add next, id, resolutions.
(lto_get_section_name): Add file_data argument to prototype.
lto:
2010-07-10 Andi Kleen <ak@linux.intel.com>
PR lto/44992
* lto.c: Include splay-tree.h
(lto_resolution_read): Change to walk file_ids tree and parse
extra file_id in resolution file.
(lto_section_with_id): Add.
(create_subid_section_table): Add.
(lwstate): Add.
(lto_create_files_from_ids): Add.
(lto_file_read): Change to handle sub file ids and create list
of file_datas. Add output argument for count.
(get_section_data): Pass file_data to lto_get_section_name.
(lto_flatten_file): Add.
(read_cgraph_and_symbols): Handle linked lists of file_datas.
lto-plugin:
2010-07-10 Andi Kleen <ak@linux.intel.com>
PR lto/44992
* lto-plugin.c (sym_aux): Add.
(plugin_symtab): Remove slots. Add aux and id.
(parse_table_entry): Change to use aux instead of slots.
(LTO_SECTION_PREFIX): Add.
(translate): Improve buffer allocation. Change to append
symbols to existing out buffer.
(get_section): Remove.
(process_symtab): Add.
(free_2): Free symtab->aux.
(write_resolution): Handle aux instead of slots.
Print sub id to resolution file.
(claim_file_handler): Clear lto_file. Replace get_symtab/translate
calls with call to process_symtab.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162443 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer.c')
-rw-r--r-- | gcc/lto-streamer.c | 70 |
1 files changed, 29 insertions, 41 deletions
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c index 406096015f4..0536bb97b25 100644 --- a/gcc/lto-streamer.c +++ b/gcc/lto-streamer.c @@ -133,57 +133,45 @@ lto_bitmap_free (bitmap b) /* Get a section name for a particular type or name. The NAME field - is only used if SECTION_TYPE is LTO_section_function_body or - LTO_static_initializer. For all others it is ignored. The callee - of this function is responcible to free the returned name. */ + is only used if SECTION_TYPE is LTO_section_function_body. For all + others it is ignored. The callee of this function is responsible + to free the returned name. */ char * -lto_get_section_name (int section_type, const char *name) +lto_get_section_name (int section_type, const char *name, struct lto_file_decl_data *f) { - switch (section_type) + const char *add; + char post[32]; + const char *sep; + + if (section_type == LTO_section_function_body) { - case LTO_section_function_body: gcc_assert (name != NULL); if (name[0] == '*') name++; - return concat (LTO_SECTION_NAME_PREFIX, name, NULL); - - case LTO_section_static_initializer: - return concat (LTO_SECTION_NAME_PREFIX, ".statics", NULL); - - case LTO_section_symtab: - return concat (LTO_SECTION_NAME_PREFIX, ".symtab", NULL); - - case LTO_section_decls: - return concat (LTO_SECTION_NAME_PREFIX, ".decls", NULL); - - case LTO_section_cgraph: - return concat (LTO_SECTION_NAME_PREFIX, ".cgraph", NULL); - - case LTO_section_varpool: - return concat (LTO_SECTION_NAME_PREFIX, ".vars", NULL); - - case LTO_section_refs: - return concat (LTO_SECTION_NAME_PREFIX, ".refs", NULL); - - case LTO_section_jump_functions: - return concat (LTO_SECTION_NAME_PREFIX, ".jmpfuncs", NULL); - - case LTO_section_ipa_pure_const: - return concat (LTO_SECTION_NAME_PREFIX, ".pureconst", NULL); - - case LTO_section_ipa_reference: - return concat (LTO_SECTION_NAME_PREFIX, ".reference", NULL); + add = name; + sep = ""; + } + else if (section_type < LTO_N_SECTION_TYPES) + { + add = lto_section_name[section_type]; + sep = "."; + } + else + internal_error ("bytecode stream: unexpected LTO section %s", name); - case LTO_section_opts: - return concat (LTO_SECTION_NAME_PREFIX, ".opts", NULL); + /* Make the section name unique so that ld -r combining sections + doesn't confuse the reader with merged sections. - case LTO_section_cgraph_opt_sum: - return concat (LTO_SECTION_NAME_PREFIX, ".cgraphopt", NULL); + For options don't add a ID, the option reader cannot deal with them + and merging should be ok here. - default: - internal_error ("bytecode stream: unexpected LTO section %s", name); - } + XXX: use crc64 to minimize collisions? */ + if (section_type == LTO_section_opts) + strcpy (post, ""); + else + sprintf (post, ".%x", f ? f->id : crc32_string(0, get_random_seed (false))); + return concat (LTO_SECTION_NAME_PREFIX, sep, add, post, NULL); } |