From: Jeff Law <law@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>, "H.J. Lu" <hjl.tools@gmail.com>
Cc: "GCC Patches" <gcc-patches@gcc.gnu.org>,
"Uros Bizjak" <ubizjak@gmail.com>, "Jan Hubicka" <hubicka@ucw.cz>,
刘袋鼠 <crazylht@gmail.com>
Subject: Re: V2 [PATCH] i386: Insert ENDBR for NOTE_INSN_DELETED_LABEL only if needed
Date: Tue, 28 May 2019 17:37:00 -0000 [thread overview]
Message-ID: <3e7c65bd-7008-000d-56ee-e72a2395a548@redhat.com> (raw)
In-Reply-To: <20190528154820.GN19695@tucnak>
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
next prev parent reply other threads:[~2019-05-28 17:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-15 4:13 H.J. Lu
2019-02-16 15:02 ` V2 " H.J. Lu
2019-05-21 21:48 ` PING^1: " H.J. Lu
2019-05-28 7:21 ` Uros Bizjak
2019-05-28 9:22 ` Jakub Jelinek
2019-05-28 15:16 ` H.J. Lu
2019-05-28 15:31 ` Jakub Jelinek
2019-05-28 15:34 ` H.J. Lu
2019-05-28 16:11 ` Jakub Jelinek
2019-05-28 17:37 ` Jeff Law [this message]
2019-05-31 17:39 ` [PATCH] Don't insert ENDBR after NOTE_INSN_DELETED_LABEL H.J. Lu
2019-05-31 18:03 ` Jakub Jelinek
2019-05-31 18:26 ` H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3e7c65bd-7008-000d-56ee-e72a2395a548@redhat.com \
--to=law@redhat.com \
--cc=crazylht@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=hubicka@ucw.cz \
--cc=jakub@redhat.com \
--cc=ubizjak@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).