From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83129 invoked by alias); 28 May 2019 17:33:23 -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 82917 invoked by uid 89); 28 May 2019 17:33:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,KAM_SHORT,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 May 2019 17:33:21 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 889A0C057E3F; Tue, 28 May 2019 17:33:17 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-2.rdu2.redhat.com [10.10.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6A905C241; Tue, 28 May 2019 17:33:14 +0000 (UTC) Subject: Re: V2 [PATCH] i386: Insert ENDBR for NOTE_INSN_DELETED_LABEL only if needed To: Jakub Jelinek , "H.J. Lu" Cc: GCC Patches , Uros Bizjak , Jan Hubicka , =?UTF-8?B?5YiY6KKL6byg?= References: <20190215041332.24720-1-hjl.tools@gmail.com> <20190216150211.GA13329@gmail.com> <20190528085725.GF19695@tucnak> <20190528151620.GM19695@tucnak> <20190528154820.GN19695@tucnak> From: Jeff Law Openpgp: preference=signencrypt Message-ID: <3e7c65bd-7008-000d-56ee-e72a2395a548@redhat.com> Date: Tue, 28 May 2019 17:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190528154820.GN19695@tucnak> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg01849.txt.bz2 On 5/28/19 9:48 AM, Jakub Jelinek wrote: > On Tue, May 28, 2019 at 08:30:59AM -0700, H.J. Lu wrote: >>> We shouldn't generate ENDBR in that case, nothing can goto to bar (otherwise >>> it would remain a normal label, not a deleted label). >>> >> >> But return value of func () may be used with indirect jump. > > No, it may be used say to print that address, but computed goto can't be > used to jump from one function to a different function, see > https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html > "You may not use this mechanism to jump to code in a different function. > If you do that, totally unpredictable things happen." Right. We disallowed this case some time ago IIRC. It's essentially undefined behavior. I would even claim that in a CET world that we *want* a CET fault if something tried to use the deleted label as a jump target and thus an ENDBR is undesirable. > > NOTE_INSN_DELETED_LABEL is not guaranteed to be followed by any sensible > code, the only reason it is kept is that there is or might be something > referencing the label and so you want to emit the label somewhere in the > function, but don't care much where in the function. Exactly. Jeff