public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH, V2] gas: gcfg: fix handling of non-local direct jmps in gcfg
Date: Thu, 28 Mar 2024 09:26:05 -0700	[thread overview]
Message-ID: <c5a78fd0-3ba4-4c77-b63a-c816d730b581@oracle.com> (raw)
In-Reply-To: <4d4ea89d-09b4-487d-8507-4a7ed3a6fdf4@suse.com>

On 3/28/24 03:10, Jan Beulich wrote:
> On 28.03.2024 08:59, Indu Bhagat wrote:
>> [Changes in V2]
>>    - Add function level comments for ginsn_direct_local_jump_p.
>>    - Add a jmp to locally defined label in the testcase to make it more
>>      complete.  Also, add a jmp to label defined in another function.
>>      The testcase now generates an additional warning (as expected):
>>      "Warning: GINSN: found unreachable code in func 'bar'"
> 
> For this - can't you simply omit the unreachable pair of insns?
> 

We do omit those instructions from GCFG and SCFI.  GAS does, however, 
warn for now. Do you mean skip this warning too?

> Other than that, looks plausible, so feel free to put in.
> 
>>    - Use formatting style consistent with other testcases.
>> [End of changes in V2]
> 
> As a minor remark, this entire section would better go ...
> 

Yes, I usually get rid of this before committing.  But I agree, its 
better put below after the separator.

>> The ginsn infrastructure in GAS includes the ability to create a GCFG
>> (ginsn CFG).  A GCFG is currently used for SCFI passes.
>>
>> This patch fixes the following invalid assumptions / code blocks:
>>   - The function ginsn_direct_local_jump_p () was erroneously _not_
>>     checking whether the symbol is locally defined (i.e., within the
>>     scope of the code block for which GCFG is desired).  Fix the code
>>     to do so.
>>   - Similarly, the GCFG creation code, in gcfg_build () itself had an
>>     assumption that a GINSN_TYPE_JUMP to a non-local symbol will not be
>>     seen.  The latter can indeed be seen, and in fact, needs to be treated
>>     the same way as an exit from the function in terms of control-flow.
>>
>> gas/
>>          * ginsn.c (ginsn_direct_local_jump_p): Check if the symbol
>> 	is local to the code block or function being assembled.
>>          (add_bb_at_ginsn): Remove buggy assumption.
>>          (frch_ginsn_data_append): Direct jmps do not disqualify a stream
>> 	of ginsns from GCFG creation.
>>
>> gas/testsuite/
>> 	* gas/scfi/x86_64/scfi-cfg-3.d: New test.
>> 	* gas/scfi/x86_64/scfi-cfg-3.l: New test.
>> 	* gas/scfi/x86_64/scfi-cfg-3.s: New test.
>> 	* gas/scfi/x86_64/scfi-x86-64.exp: Add new test.
>>
>> gas: gcfg: address review comments for local jump issue
>>
>> ChangeLog:
>> 	* gas/testsuite/gas/scfi/x86_64/scfi-cfg-3.d
>> 	* gas/testsuite/gas/scfi/x86_64/scfi-cfg-3.l
>> 	* gas/testsuite/gas/scfi/x86_64/scfi-cfg-3.s
>> ---
>>   gas/ginsn.c                                   | 47 +++++++++++--------
>>   gas/testsuite/gas/scfi/x86_64/scfi-cfg-3.d    | 32 +++++++++++++
>>   gas/testsuite/gas/scfi/x86_64/scfi-cfg-3.l    |  3 ++
>>   gas/testsuite/gas/scfi/x86_64/scfi-cfg-3.s    | 43 +++++++++++++++++
>>   gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp |  2 +
>>   5 files changed, 108 insertions(+), 19 deletions(-)
>>   create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-3.d
>>   create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-3.l
>>   create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-3.s
> 
> ... below here, perhaps with another --- separator. This way it's clear
> that the revlog isn't going to be part of the commit message.
> 
> Jan


  reply	other threads:[~2024-03-28 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28  7:59 Indu Bhagat
2024-03-28 10:10 ` Jan Beulich
2024-03-28 16:26   ` Indu Bhagat [this message]
2024-03-28 16:35     ` Jan Beulich
2024-03-28 23:03       ` Indu Bhagat

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=c5a78fd0-3ba4-4c77-b63a-c816d730b581@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.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).