This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Improve handling of missing LTO input sections


On Sat, Oct 2, 2010 at 11:24 PM, Andi Kleen <andi@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Avoid some segfaults in this case and replace one assert with
> a clearer error message.
>
> Passes bootstrap and test on x86-64-linux.
>
> Ok to commit?

Ok.

Thanks,
Richard.

> gcc/
>
> 2010-10-02 ?Andi Kleen <ak@linux.intel.com>
>
> ? ? ? ?* lto-cgraph.c (input_cgraph): Check for missing sections.
>
> gcc/lto/
>
> 2010-10-02 ?Andi Kleen <ak@linux.intel.com>
>
> ? ? ? ?* lto.c (lto_file_finalize): Replace gcc_assert for missing section
> ? ? ? ?with fatal_error.
> ---
> ?gcc/lto-cgraph.c | ? ?6 ++++++
> ?gcc/lto/lto.c ? ?| ? ?6 +++++-
> ?2 files changed, 11 insertions(+), 1 deletions(-)
>
> diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
> index b82fa73..b61e5d1 100644
> --- a/gcc/lto-cgraph.c
> +++ b/gcc/lto-cgraph.c
> @@ -1468,6 +1468,8 @@ input_cgraph (void)
>
> ? ? ? ib = lto_create_simple_input_block (file_data, LTO_section_cgraph,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&data, &len);
> + ? ? ?if (!ib)
> + ? ? ? fatal_error ("Cannot find LTO cgraph in %s\n", file_data->file_name);
> ? ? ? input_profile_summary (ib);
> ? ? ? file_data->cgraph_node_encoder = lto_cgraph_encoder_new ();
> ? ? ? nodes = input_cgraph_1 (file_data, ib);
> @@ -1476,12 +1478,16 @@ input_cgraph (void)
>
> ? ? ? ib = lto_create_simple_input_block (file_data, LTO_section_varpool,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&data, &len);
> + ? ? ?if (!ib)
> + ? ? ? fatal_error ("Cannot find LTO varpool in %s\n", file_data->file_name);
> ? ? ? varpool = input_varpool_1 (file_data, ib);
> ? ? ? lto_destroy_simple_input_block (file_data, LTO_section_varpool,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ib, data, len);
>
> ? ? ? ib = lto_create_simple_input_block (file_data, LTO_section_refs,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&data, &len);
> + ? ? ?if (!ib)
> + ? ? ? fatal_error("Cannot find LTO section refs in %s\n", file_data->file_name);
> ? ? ? input_refs (ib, nodes, varpool);
> ? ? ? lto_destroy_simple_input_block (file_data, LTO_section_refs,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ib, data, len);
> diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
> index e2fa975..2fbea73 100644
> --- a/gcc/lto/lto.c
> +++ b/gcc/lto/lto.c
> @@ -493,7 +493,11 @@ lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file)
> ? file_data->renaming_hash_table = lto_create_renaming_table ();
> ? file_data->file_name = file->filename;
> ? data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len);
> - ?gcc_assert (data != NULL);
> + ?if (data == NULL)
> + ? ?{
> + ? ? ?internal_error ("Cannot read LTO decls from %s", file_data->file_name);
> + ? ? ?return;
> + ? ?}
> ? lto_read_decls (file_data, data, file_data->resolutions);
> ? lto_free_section_data (file_data, LTO_section_decls, NULL, data, len);
> ?}
> --
> 1.7.1
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]