From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17823 invoked by alias); 29 Oct 2019 11:31:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 17804 invoked by uid 89); 29 Oct 2019 11:31:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=get_create, sk:ipa_pro, *name, sk:IDENTIF X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 29 Oct 2019 11:31:49 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 4D650B02C; Tue, 29 Oct 2019 11:31:47 +0000 (UTC) Subject: Re: [PATCH] Prevent LTO section collision for a symbol name starting with '*'. From: =?UTF-8?Q?Martin_Li=c5=a1ka?= To: Jan Hubicka Cc: Richard Biener , GCC Patches References: <20190815143341.m4t76ewfi4zn3ayl@kam.mff.cuni.cz> <7c27efd6-e9dd-ac4f-ebaf-6626a226bb61@suse.cz> <1d1856dc-6e42-89ad-85ee-519b1a691afd@suse.cz> <20190823143728.favozczljnminl4d@kam.mff.cuni.cz> <20190823150502.l4dnv3fxzsfhro4g@kam.mff.cuni.cz> <20190823223622.yq2upqnvpm574qws@kam.mff.cuni.cz> <68650f0d-1472-ba6a-0530-19ed3a011321@suse.cz> <289c7087-008d-1921-fe78-80a3e1abd986@suse.cz> <20190909143343.2tf2tc3mvnhwcqur@kam.mff.cuni.cz> <6e297b4b-3086-fa84-6fce-a5ced89694bb@suse.cz> <0540de65-bb95-53dd-3d18-625637d921fc@suse.cz> <711bbcb5-122a-25f3-d869-1b39ba796ad4@suse.cz> X-Pep-Version: 2.0 Message-ID: <3e7f782f-58a3-c3d8-5f98-7bd84fc51b55@suse.cz> Date: Tue, 29 Oct 2019 11:34:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <711bbcb5-122a-25f3-d869-1b39ba796ad4@suse.cz> Content-Type: multipart/mixed; boundary="------------56F1822DEC48023B4B62962C" X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg02038.txt.bz2 This is a multi-part message in MIME format. --------------56F1822DEC48023B4B62962C Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 1182 On 10/22/19 1:09 PM, Martin Li=C5=A1ka wrote: > @Honza: PING^1 >=20 > On 9/18/19 12:14 PM, Martin Li=C5=A1ka wrote: >> On 9/11/19 1:38 PM, Martin Li=C5=A1ka wrote: >>> The inline_clone manipulation happens in cgraph_node::find_replacement = where >>> we manipulate the clone_of. >> >> I fixed that but there's a similar situation which goes other way around: >> >> cgraph_node * >> cgraph_node::get_create (tree decl) >> { >> cgraph_node *first_clone =3D cgraph_node::get (decl); >> >> if (first_clone && !first_clone->global.inlined_to) >> return first_clone; >> >> cgraph_node *node =3D cgraph_node::create (decl); >> if (first_clone) >> { >> first_clone->clone_of =3D node; >> >> Here we come up with a new parent and this->clone_of is set to the paren= t. >> We ought to come cgraph_node::order here, but I don't like. >> Right now cgraph_node::order is a way how one can identify a node in IPA= dumps. >> >> The patch is breaking that. I'm not sure we want the patch right now. >> Martin >> >=20 Ok, I've got a version that is working right. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin --------------56F1822DEC48023B4B62962C Content-Type: text/x-patch; charset=UTF-8; name="0001-Use-symtab_node-order-in-LTO-sections-with-body.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0001-Use-symtab_node-order-in-LTO-sections-with-body.patch" Content-length: 20412 =46rom 04b80f0bceba93bb43c0c1cb378b431a297232d2 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 26 Aug 2019 11:59:23 +0200 Subject: [PATCH] Use symtab_node::order in LTO sections with body. --- gcc/cgraph.c | 14 ++++++++++---- gcc/cgraphclones.c | 5 +++++ gcc/ipa-fnsummary.c | 2 +- gcc/ipa-hsa.c | 2 +- gcc/ipa-icf.c | 2 +- gcc/ipa-prop.c | 6 ++++-- gcc/ipa-sra.c | 2 +- gcc/lto-cgraph.c | 13 +++++-------- gcc/lto-opts.c | 2 +- gcc/lto-section-in.c | 12 +++++++----- gcc/lto-section-out.c | 2 +- gcc/lto-streamer-in.c | 4 ++-- gcc/lto-streamer-out.c | 21 ++++++++++++--------- gcc/lto-streamer.c | 9 +++++++-- gcc/lto-streamer.h | 10 +++++++--- gcc/lto/lto-common.c | 13 +++++++------ gcc/testsuite/gcc.dg/lto/pr91393_0.c | 11 +++++++++++ gcc/varpool.c | 7 ++++--- 18 files changed, 87 insertions(+), 50 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/lto/pr91393_0.c diff --git a/gcc/cgraph.c b/gcc/cgraph.c index d47d4128b1c..34333b9377a 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -547,6 +547,7 @@ cgraph_node::get_create (tree decl) { first_clone->clone_of =3D node; node->clones =3D first_clone; + node->order =3D first_clone->order; symtab->symtab_prevail_in_asm_name_hash (node); node->decl->decl_with_vis.symtab_node =3D node; if (dump_file) @@ -3546,12 +3547,17 @@ cgraph_node::get_untransformed_body (void) struct lto_in_decl_state *decl_state =3D lto_get_function_in_decl_state (file_data, decl); =20 + cgraph_node *origin =3D this; + while (origin->clone_of) + origin =3D origin->clone_of; + + int stream_order =3D origin->order - file_data->order_base; data =3D lto_get_section_data (file_data, LTO_section_function_body, - name, &len, decl_state->compressed); + name, stream_order, &len, + decl_state->compressed); if (!data) - fatal_error (input_location, "%s: section %s is missing", - file_data->file_name, - name); + fatal_error (input_location, "%s: section %s.%d is missing", + file_data->file_name, name, stream_order); =20 gcc_assert (DECL_STRUCT_FUNCTION (decl) =3D=3D NULL); =20 diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index 087b5a26280..5b92fc1da53 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -670,6 +670,11 @@ cgraph_node::find_replacement (void) n->clone_of =3D next_inline_clone; n =3D n->next_sibling_clone; } + + /* Update order in order to be able to find a LTO section + with function body. */ + replacement->order =3D order; + return replacement; } else diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c index 0d38e42546d..4fb141ff107 100644 --- a/gcc/ipa-fnsummary.c +++ b/gcc/ipa-fnsummary.c @@ -3714,7 +3714,7 @@ ipa_fn_summary_read (void) size_t len; const char *data =3D lto_get_section_data (file_data, LTO_section_ipa_fn_summary, - NULL, &len); + NULL, 0, &len); if (data) inline_read_section (file_data, data, len); else diff --git a/gcc/ipa-hsa.c b/gcc/ipa-hsa.c index 8af1d734d85..c9739fa6135 100644 --- a/gcc/ipa-hsa.c +++ b/gcc/ipa-hsa.c @@ -278,7 +278,7 @@ ipa_hsa_read_summary (void) { size_t len; const char *data =3D lto_get_section_data (file_data, LTO_section_ip= a_hsa, - NULL, &len); + NULL, 0, &len); =20 if (data) ipa_hsa_read_section (file_data, data, len); diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 066288d04ba..6e79047d56a 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -2387,7 +2387,7 @@ sem_item_optimizer::read_summary (void) { size_t len; const char *data =3D lto_get_section_data (file_data, - LTO_section_ipa_icf, NULL, &len); + LTO_section_ipa_icf, NULL, 0, &len); =20 if (data) read_section (file_data, data, len); diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 0dd73561419..b18590dd552 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -4618,7 +4618,9 @@ ipa_prop_read_jump_functions (void) while ((file_data =3D file_data_vec[j++])) { size_t len; - const char *data =3D lto_get_section_data (file_data, LTO_section_ju= mp_functions, NULL, &len); + const char *data =3D lto_get_section_data (file_data, + LTO_section_jump_functions, + NULL, 0, &len); =20 if (data) ipa_prop_read_section (file_data, data, len); @@ -4863,7 +4865,7 @@ ipcp_read_transformation_summaries (void) size_t len; const char *data =3D lto_get_section_data (file_data, LTO_section_ipcp_transform, - NULL, &len); + NULL, 0, &len); if (data) read_replacements_section (file_data, data, len); } diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c index 836db401588..bec030b6963 100644 --- a/gcc/ipa-sra.c +++ b/gcc/ipa-sra.c @@ -2813,7 +2813,7 @@ ipa_sra_read_summary (void) { size_t len; const char *data =3D lto_get_section_data (file_data, LTO_section_ip= a_sra, - NULL, &len); + NULL, 0, &len); if (data) isra_read_summary_section (file_data, data, len); } diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 147975ba869..ee2191f91d7 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -49,9 +49,6 @@ static void input_cgraph_opt_summary (vec = nodes); /* Number of LDPR values known to GCC. */ #define LDPR_NUM_KNOWN (LDPR_PREVAILING_DEF_IRONLY_EXP + 1) =20 -/* All node orders are ofsetted by ORDER_BASE. */ -static int order_base; - /* Cgraph streaming is organized as set of record whose type is indicated by a tag. */ enum LTO_symtab_tags @@ -1218,7 +1215,7 @@ input_node (struct lto_file_decl_data *file_data, int i, count; tree group; const char *section; - order =3D streamer_read_hwi (ib) + order_base; + order =3D streamer_read_hwi (ib) + file_data->order_base; clone_ref =3D streamer_read_hwi (ib); =20 decl_index =3D streamer_read_uhwi (ib); @@ -1337,7 +1334,7 @@ input_varpool_node (struct lto_file_decl_data *file_d= ata, tree group; const char *section; =20 - order =3D streamer_read_hwi (ib) + order_base; + order =3D streamer_read_hwi (ib) + file_data->order_base; decl_index =3D streamer_read_uhwi (ib); var_decl =3D lto_file_decl_data_get_var_decl (file_data, decl_index); =20 @@ -1504,7 +1501,7 @@ input_cgraph_1 (struct lto_file_decl_data *file_data, unsigned i; =20 tag =3D streamer_read_enum (ib, LTO_symtab_tags, LTO_symtab_last_tag); - order_base =3D symtab->order; + file_data->order_base =3D symtab->order; while (tag) { if (tag =3D=3D LTO_symtab_edge) @@ -1529,7 +1526,7 @@ input_cgraph_1 (struct lto_file_decl_data *file_data, tag =3D streamer_read_enum (ib, LTO_symtab_tags, LTO_symtab_last_tag= ); } =20 - lto_input_toplevel_asms (file_data, order_base); + lto_input_toplevel_asms (file_data, file_data->order_base); =20 /* AUX pointers should be all non-zero for function nodes read from the = stream. */ if (flag_checking) @@ -2039,7 +2036,7 @@ input_cgraph_opt_summary (vec nodes) size_t len; const char *data =3D lto_get_section_data (file_data, LTO_section_cgraph_opt_sum, NULL, - &len); + 0, &len); =20 if (data) input_cgraph_opt_section (file_data, data, len, nodes); diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c index 0e9f24e1189..99c6fe53923 100644 --- a/gcc/lto-opts.c +++ b/gcc/lto-opts.c @@ -65,7 +65,7 @@ lto_write_options (void) char *args; bool first_p =3D true; =20 - section_name =3D lto_get_section_name (LTO_section_opts, NULL, NULL); + section_name =3D lto_get_section_name (LTO_section_opts, NULL, 0, NULL); lto_begin_section (section_name, false); =20 obstack_init (&temporary_obstack); diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c index 60f111f3f28..664f61ede7d 100644 --- a/gcc/lto-section-in.c +++ b/gcc/lto-section-in.c @@ -131,10 +131,11 @@ struct lto_data_header const char * lto_get_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, - const char *name, + const char *name, int order, size_t *len, bool decompress) { - const char *data =3D (get_section_f) (file_data, section_type, name, len= ); + const char *data =3D (get_section_f) (file_data, section_type, name, ord= er, + len); const size_t header_length =3D sizeof (struct lto_data_header); struct lto_data_header *header; struct lto_buffer buffer; @@ -177,10 +178,10 @@ lto_get_section_data (struct lto_file_decl_data *file= _data, const char * lto_get_raw_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, - const char *name, + const char *name, int order, size_t *len) { - return (get_section_f) (file_data, section_type, name, len); + return (get_section_f) (file_data, section_type, name, order, len); } =20 /* Free the data found from the above call. The first three @@ -235,7 +236,8 @@ lto_create_simple_input_block (struct lto_file_decl_dat= a *file_data, enum lto_section_type section_type, const char **datar, size_t *len) { - const char *data =3D lto_get_section_data (file_data, section_type, NULL= , len); + const char *data =3D lto_get_section_data (file_data, section_type, NULL= , 0, + len); const struct lto_simple_header * header =3D (const struct lto_simple_header *) data; =20 diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c index 7ae102164ef..69fb8b7cffa 100644 --- a/gcc/lto-section-out.c +++ b/gcc/lto-section-out.c @@ -278,7 +278,7 @@ lto_destroy_simple_output_block (struct lto_simple_outp= ut_block *ob) char *section_name; struct lto_simple_header header; =20 - section_name =3D lto_get_section_name (ob->section_type, NULL, NULL); + section_name =3D lto_get_section_name (ob->section_type, NULL, 0, NULL); lto_begin_section (section_name, !flag_wpa); free (section_name); =20 diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 32b5d5fa50c..07fdb77ce66 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1563,7 +1563,7 @@ lto_input_toplevel_asms (struct lto_file_decl_data *f= ile_data, int order_base) { size_t len; const char *data =3D lto_get_section_data (file_data, LTO_section_asm, - NULL, &len); + NULL, 0, &len); const struct lto_simple_header_with_strings *header =3D (const struct lto_simple_header_with_strings *) data; int string_offset; @@ -1602,7 +1602,7 @@ lto_input_mode_table (struct lto_file_decl_data *file= _data) { size_t len; const char *data =3D lto_get_section_data (file_data, LTO_section_mode_t= able, - NULL, &len); + NULL, 0, &len); if (! data) { internal_error ("cannot read LTO mode table from %s", diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 3ecadddec52..cf45cc3af64 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -1972,10 +1972,12 @@ produce_asm (struct output_block *ob, tree fn) if (section_type =3D=3D LTO_section_function_body) { const char *name =3D IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fn)); - section_name =3D lto_get_section_name (section_type, name, NULL); + section_name =3D lto_get_section_name (section_type, name, + symtab_node::get (fn)->order, + NULL); } else - section_name =3D lto_get_section_name (section_type, NULL, NULL); + section_name =3D lto_get_section_name (section_type, NULL, 0, NULL); =20 lto_begin_section (section_name, !flag_wpa); free (section_name); @@ -2278,7 +2280,7 @@ lto_output_toplevel_asms (void) =20 streamer_write_string_cst (ob, ob->main_stream, NULL_TREE); =20 - section_name =3D lto_get_section_name (LTO_section_asm, NULL, NULL); + section_name =3D lto_get_section_name (LTO_section_asm, NULL, 0, NULL); lto_begin_section (section_name, !flag_wpa); free (section_name); =20 @@ -2311,7 +2313,7 @@ copy_function_or_variable (struct symtab_node *node) size_t len; const char *name =3D IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (function)); char *section_name =3D - lto_get_section_name (LTO_section_function_body, name, NULL); + lto_get_section_name (LTO_section_function_body, name, node->order, NU= LL); size_t i, j; struct lto_in_decl_state *in_state; struct lto_out_decl_state *out_state =3D lto_get_out_decl_state (); @@ -2325,7 +2327,8 @@ copy_function_or_variable (struct symtab_node *node) name =3D lto_get_decl_name_mapping (file_data, name); =20 data =3D lto_get_raw_section_data (file_data, LTO_section_function_body, - name, &len); + name, node->order - file_data->order_base, + &len); gcc_assert (data); =20 /* Do a bit copy of the function body. */ @@ -2410,7 +2413,7 @@ produce_lto_section () /* Stream LTO meta section. */ output_block *ob =3D create_output_block (LTO_section_lto); =20 - char * section_name =3D lto_get_section_name (LTO_section_lto, NULL, NUL= L); + char * section_name =3D lto_get_section_name (LTO_section_lto, NULL, 0, = NULL); lto_begin_section (section_name, false); free (section_name); =20 @@ -2784,7 +2787,7 @@ static void produce_symtab (struct output_block *ob) { struct streamer_tree_cache_d *cache =3D ob->writer_cache; - char *section_name =3D lto_get_section_name (LTO_section_symtab, NULL, N= ULL); + char *section_name =3D lto_get_section_name (LTO_section_symtab, NULL, 0= , NULL); lto_symtab_encoder_t encoder =3D ob->decl_state->symtab_node_encoder; lto_symtab_encoder_iterator lsei; =20 @@ -2884,7 +2887,7 @@ lto_write_mode_table (void) streamer_write_bitpack (&bp); =20 char *section_name - =3D lto_get_section_name (LTO_section_mode_table, NULL, NULL); + =3D lto_get_section_name (LTO_section_mode_table, NULL, 0, NULL); lto_begin_section (section_name, !flag_wpa); free (section_name); =20 @@ -2928,7 +2931,7 @@ produce_asm_for_decls (void) =20 memset (&header, 0, sizeof (struct lto_decl_header)); =20 - section_name =3D lto_get_section_name (LTO_section_decls, NULL, NULL); + section_name =3D lto_get_section_name (LTO_section_decls, NULL, 0, NULL); lto_begin_section (section_name, !flag_wpa); free (section_name); =20 diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c index bd0126faebb..2ad979fdf34 100644 --- a/gcc/lto-streamer.c +++ b/gcc/lto-streamer.c @@ -114,7 +114,8 @@ lto_tag_name (enum LTO_tags tag) to free the returned name. */ =20 char * -lto_get_section_name (int section_type, const char *name, struct lto_file_= decl_data *f) +lto_get_section_name (int section_type, const char *name, + int node_order, struct lto_file_decl_data *f) { const char *add; char post[32]; @@ -125,7 +126,11 @@ lto_get_section_name (int section_type, const char *na= me, struct lto_file_decl_d gcc_assert (name !=3D NULL); if (name[0] =3D=3D '*') name++; - add =3D name; + + char *buffer =3D (char *)xmalloc (strlen (name) + 32); + sprintf (buffer, "%s.%d", name, node_order); + + add =3D buffer; sep =3D ""; } else if (section_type < LTO_N_SECTION_TYPES) diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 3e4308aab15..a138f333341 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -283,6 +283,7 @@ lto_file_decl_data_num_ ## name ## s (struct lto_file_d= ecl_data *data) \ typedef const char* (lto_get_section_data_f) (struct lto_file_decl_data *, enum lto_section_type, const char *, + int, size_t *); =20 /* Return the data found from the above call. The first three @@ -623,6 +624,8 @@ struct GTY(()) lto_file_decl_data =20 /* Read LTO section. */ lto_section lto_section_header; + + int order_base; }; =20 typedef struct lto_file_decl_data *lto_file_decl_data_ptr; @@ -789,11 +792,11 @@ extern void lto_set_in_hooks (struct lto_file_decl_da= ta **, extern struct lto_file_decl_data **lto_get_file_decl_data (void); extern const char *lto_get_section_data (struct lto_file_decl_data *, enum lto_section_type, - const char *, size_t *, + const char *, int, size_t *, bool decompress =3D false); extern const char *lto_get_raw_section_data (struct lto_file_decl_data *, enum lto_section_type, - const char *, size_t *); + const char *, int, size_t *); extern void lto_free_section_data (struct lto_file_decl_data *, enum lto_section_type, const char *, const char *, size_t, @@ -857,7 +860,8 @@ extern void lto_append_block (struct lto_output_stream = *); extern bool lto_stream_offload_p; =20 extern const char *lto_tag_name (enum LTO_tags); -extern char *lto_get_section_name (int, const char *, struct lto_file_decl= _data *); +extern char *lto_get_section_name (int, const char *, int, + struct lto_file_decl_data *); extern void print_lto_report (const char *); extern void lto_streamer_init (void); extern bool gate_lto_out (void); diff --git a/gcc/lto/lto-common.c b/gcc/lto/lto-common.c index cdfc7b07719..21b1d44a9b5 100644 --- a/gcc/lto/lto-common.c +++ b/gcc/lto/lto-common.c @@ -2204,7 +2204,8 @@ lto_file_finalize (struct lto_file_decl_data *file_da= ta, lto_file *file, #endif =20 /* Read and verify LTO section. */ - data =3D lto_get_section_data (file_data, LTO_section_lto, NULL, &len, f= alse); + data =3D lto_get_section_data (file_data, LTO_section_lto, NULL, 0, &len, + false); if (data =3D=3D NULL) { fatal_error (input_location, "bytecode stream in file %qs generated " @@ -2217,7 +2218,7 @@ lto_file_finalize (struct lto_file_decl_data *file_da= ta, lto_file *file, file_data->lto_section_header.minor_version, file_data->file_name); =20 - data =3D lto_get_section_data (file_data, LTO_section_decls, NULL, &len); + data =3D lto_get_section_data (file_data, LTO_section_decls, NULL, 0, &l= en); if (data =3D=3D NULL) { internal_error ("cannot read % from %s", @@ -2396,15 +2397,15 @@ lto_read_section_data (struct lto_file_decl_data *f= ile_data, =20 static const char * get_section_data (struct lto_file_decl_data *file_data, - enum lto_section_type section_type, - const char *name, - size_t *len) + enum lto_section_type section_type, + const char *name, int order, + size_t *len) { htab_t section_hash_table =3D file_data->section_hash_table; struct lto_section_slot *f_slot; struct lto_section_slot s_slot; const char *section_name =3D lto_get_section_name (section_type, name, - file_data); + order, file_data); char *data =3D NULL; =20 *len =3D 0; diff --git a/gcc/testsuite/gcc.dg/lto/pr91393_0.c b/gcc/testsuite/gcc.dg/lt= o/pr91393_0.c new file mode 100644 index 00000000000..43b2426c86b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr91393_0.c @@ -0,0 +1,11 @@ +void __open_alias(int, ...) __asm__("open"); +void __open_alias(int flags, ...) {} +extern __inline __attribute__((__gnu_inline__)) int open() {} +struct { + void *func; +} a =3D {open}; + +int main() +{ + return 0; +} diff --git a/gcc/varpool.c b/gcc/varpool.c index 8e5a9372656..d4b83429c12 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -299,11 +299,12 @@ varpool_node::get_constructor (void) =3D lto_get_function_in_decl_state (file_data, decl); =20 data =3D lto_get_section_data (file_data, LTO_section_function_body, - name, &len, decl_state->compressed); + name, order - file_data->order_base, + &len, decl_state->compressed); if (!data) - fatal_error (input_location, "%s: section %s is missing", + fatal_error (input_location, "%s: section %s.%d is missing", file_data->file_name, - name); + name, order - file_data->order_base); =20 if (!quiet_flag) fprintf (stderr, " in:%s", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (de= cl))); --=20 2.23.0 --------------56F1822DEC48023B4B62962C Content-Type: application/pgp-keys; name="pEpkey.asc" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="pEpkey.asc" Content-length: 1881 -----BEGIN PGP PUBLIC KEY BLOCK-----=0A= =0A= mQENBF24BRcBCACnwGX2UUZQ8/uaAVSEMe7a/6K87GDH8z9ErnoTd7EtyAkEbrXj=0A= XlIQDA88MV+xZnmqrWJmFLflpHgJWkjcXMetmLIke0dmAlpcXmpnj/zJ/ilxBM8x=0A= qbT8sIrzjQNl5ogDEspvMKod5gWEB2lGpoSaT819m1KxddlEo+4rdbvL0UEQw5Tu=0A= t+8B3GbhoDUPKWSWG6ZePw20db3NTLwdYIYkMD9D/XzRVAiFupu3iU1XAUnDdgvr=0A= 4/VdcQ8tIe7tXN335q/KAAkCi+9QNJhIwvtnryqiDqQVR1j4HMrI0yYoklazm8ff=0A= DxiLBmMLvG2AeoYaJzR+NjGOUAlHTL4Ssr5JABEBAAG0Hk1hcnRpbiBMacWha2Eg=0A= PG1saXNrYUBzdXNlLmN6PokBVAQTAQgAPhYhBLbsYAiki2l3o2dKjR+2PtmiLRUs=0A= BQJduAUYAhsDBQkB4TOABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEB+2Ptmi=0A= LRUsn3wH/i0RXFHr+ONj3mnh0N13xUY43FDB9lxJgEKBui5VdG4/JAjjZSPPv1yC=0A= eKSHQfKNekVfTJ8zpTVYi4CpdSQnULX54WX8rcsdMAwTFWG3n9HKDN6OOuvv7MVd=0A= 0dkWU2U7nQTKyyZxyI9B03bbgvG1Euww3bWDcO92i7PSa5WtLQT+ynZ8bqZi3fqU=0A= s2qpjx2bOddDO93jiRhgnTXWUDa2OvtKtcgui3Y4uJVb21Hjk01vXrWcaQ8SXMbU=0A= 7bap+z31FoBpue+VZ5Q8FJy7PvQOiAO4seonl/DIqlqaGR7TrXtz73pgjVgMRLnW=0A= sncEQCDEMGVX2y7EaG46vf3SQuEdvdO5AQ0EXbgFFwEIAK1HSdqWr3IE4D0ID8j2=0A= huZGOSwVPiohhdR1byr7rFVqzh8vIwlwS4K3QFDyZv12spJWbA79+9bAndFeFkKe=0A= WGzv8IYfELVrnk/M8P7mJSagHDUA9ZOLMamGvav9FZSgiUe68aEm4F/U248jxnsa=0A= QuZtR2GULIoIA2VpDiEqsmcX41shDDaWYlWM7dc2aXU6TcLq1h6iRIIf1vPuRL7/=0A= KBrmIblngfkGCNUJQalASKQZleZ9mLZob5Qz6lLO96SFVe+s03ANY0DbibRBYC6z=0A= w049hhoq4p0mRmXxH5Dt7qdCvwOGIvLHpnl/JqYdOukW4dw0jAst/3xFyB6UdMWP=0A= i70AEQEAAYkBPAQYAQgAJhYhBLbsYAiki2l3o2dKjR+2PtmiLRUsBQJduAUXAhsM=0A= BQkB4TOAAAoJEB+2PtmiLRUsdv4H/2s4uD2Z1owBAIN/ypl+cr8VLNLFi1qv7HSV=0A= barSCfGht1fOxGi/Sy+ZVz/Kvqi591oht5QkYIsaWD+ZrdSOcBWo+/VYsHedmcja=0A= 9KB+Y9e+L0EGId0tNAPfiL2im6juACFFi5XCRJAUBxsKagfdp14jIQ26crXD9zVW=0A= spRqVVD7DSXUiRLpA7ku3rV/2DAuqG25t0nt01HNgRVEkkR6gZGnym+7M0tTFVEN=0A= Us1YmkOHZ0zVv+RjUzYEClK3YN0vF7NsyfN0YZAitxVrYkYAWMaowURB9gs3Htqt=0A= bN4ZIbZWHIP1abEG6IadPiZcmQlfxgPHxC4SWxF2/T1qbt3LvOs=3D=0A= =3DGdKU=0A= -----END PGP PUBLIC KEY BLOCK-----=0A= --------------56F1822DEC48023B4B62962C--