From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92291 invoked by alias); 16 Aug 2019 08:55:54 -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 92283 invoked by uid 89); 16 Aug 2019 08:55:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=symbol_table X-HELO: mail-lf1-f65.google.com Received: from mail-lf1-f65.google.com (HELO mail-lf1-f65.google.com) (209.85.167.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Aug 2019 08:55:44 +0000 Received: by mail-lf1-f65.google.com with SMTP id j17so3563172lfp.3 for ; Fri, 16 Aug 2019 01:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=rO6/I/JgaClaJcJyk7oQc6qJ0bAxRLtxpT3Nq7ngEHw=; b=ms1k1extA2gZClZqYmGW5OHgAUyukVyzyPCJMkB+Zmbp2XE7J2INDgKz7y/KvDuLCt AQiJzeyhLHKlcQMvMwhmueaOfh+Tz/5SuE9sZFuW1sLyz22o5slTGxzfOHPzZo5XhLWA 0D5TLojtoNWa/lOh8tMQK2rzlye0UkrsHfcyRqX7KtQCG2VGYkNJr+3fvTJ2llcUKBir QGUgMFJV92czVlebQLcFhcDZU9Y3X7Ir2TfT0OMQdhGrU00mrJPlekgvU4Lt9O4ZPJoQ Oa3AHVY7+AiVAoIJOvoQa+UT6toNNzRLmi2/LmLn1+fs4r6vKpnfrsvq58tGskhrOJ5B g1fg== MIME-Version: 1.0 References: <55b4acda-9673-557b-5819-50bff07fa095@suse.cz> <20190815143341.m4t76ewfi4zn3ayl@kam.mff.cuni.cz> In-Reply-To: <20190815143341.m4t76ewfi4zn3ayl@kam.mff.cuni.cz> From: Richard Biener Date: Fri, 16 Aug 2019 09:11:00 -0000 Message-ID: Subject: Re: [PATCH] Prevent LTO section collision for a symbol name starting with '*'. To: Jan Hubicka Cc: =?UTF-8?Q?Martin_Li=C5=A1ka?= , GCC Patches Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg01153.txt.bz2 On Thu, Aug 15, 2019 at 4:33 PM Jan Hubicka wrote: > > > On Fri, Aug 9, 2019 at 3:57 PM Martin Li=C5=A1ka wrote: > > > > > > Hi. > > > > > > The patch is about prevention of LTO section name clashing. > > > Now we have a situation where body of 2 functions is streamed > > > into the same ELF section. Then we'll end up with smashed data. > > > > > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > > > > > Ready to be installed? > > > > I think the comment should mention why we skip a leading '*' > > at all. IIRC this is some target mangling applied to DECL_ASSEMBLER_NA= ME? > DECL_ASSEMBLER_NAME works in a way that if it starts with "*" > it is copied verbatim to the linker ouptut. If it is w/o "*" > then user_label_prefix is applied first, see > symbol_table::assembler_names_equal_p > > So if we skip "*" one can definitly construct testcases of different > function names ending up in same section especially when > user_label_prefix is non-empty, like on Windows I think it is "_". > > > And section names cannot contain '*'? Or do we need to actually > > indentify '*fn' and 'fn' as the same? For the testcase what is the cla= shing > > symbol? Can't we have many so that using "0" always is broken as well? > > We may have duplicate symbols during the compile time->WPA streaming > since we do not do lto-symtab at compile time and user can use asm names > that way. This is not limited to extern inlines, so it would be nice to > make this work reliably. I also plan support for keeping multiple > function bodies defined for one symbol in cases it is necessary (glibc > checking, when optimization flags are mismatches) for WPA->ltrans > streaming. > > I was always considering option to simply use node->order ids to stream > sections. Because of way node->order is merged we area always able to > recover the ID. Heh, that sounds like a nice idea indeed. > > It is however kind of nice to see actual names in the objdump > of the LTO .o files. I would not mind that much to see this go and it > would also save bit of space since symbol names can be long. > > Honza > > > > Richard. > > > > > Thanks, > > > Martin > > > > > > gcc/ChangeLog: > > > > > > 2019-08-09 Martin Liska > > > > > > PR lto/91393 > > > PR lto/88220 > > > * lto-streamer.c (lto_get_section_name): Replace '*' leading > > > character with '0'. > > > > > > gcc/testsuite/ChangeLog: > > > > > > 2019-08-09 Martin Liska > > > > > > PR lto/91393 > > > PR lto/88220 > > > * gcc.dg/lto/pr91393_0.c: New test. > > > --- > > > gcc/lto-streamer.c | 15 ++++++++++++--- > > > gcc/testsuite/gcc.dg/lto/pr91393_0.c | 11 +++++++++++ > > > 2 files changed, 23 insertions(+), 3 deletions(-) > > > create mode 100644 gcc/testsuite/gcc.dg/lto/pr91393_0.c > > > > > >