public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Indu Bhagat <indu.bhagat@oracle.com>
Cc: "H.J. Lu" <hjl.tools@gmail.com>, Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] x86: adjust which Dwarf2 register numbers to use
Date: Fri, 16 Feb 2024 08:26:08 +0100	[thread overview]
Message-ID: <aedcf4c3-f6af-485e-9e1a-5e553b71e598@suse.com> (raw)
In-Reply-To: <15c6acc7-21f8-44bb-bf0d-97392f2fcd37@oracle.com>

On 15.02.2024 23:22, Indu Bhagat wrote:
> On 2/9/24 00:11, Jan Beulich wrote:
>> Consumers can't know which execution mode is in effect for a certain
>> piece of code; they can only go from object file properties. Hence which
>> register numbers to encode ought to depend solely on object file type.
>>
>> --- a/gas/config/tc-i386.c
>> +++ b/gas/config/tc-i386.c
>> @@ -5409,7 +5409,7 @@ ginsn_dw2_regnum (const reg_entry *ireg)
>>     if (ireg->reg_num == RegIP || ireg->reg_num == RegIZ)
>>       return GINSN_DW2_REGNUM_RSI_DUMMY;
>>   
>> -  dwarf_reg = ireg->dw2_regnum[flag_code >> 1];
>> +  dwarf_reg = ireg->dw2_regnum[object_64bit];
>>   
>>     if (dwarf_reg == Dw2Inval)
>>       {
>> @@ -17461,7 +17461,7 @@ tc_x86_parse_to_dw2regnum (expressionS *
>>         if ((addressT) exp->X_add_number < i386_regtab_size)
>>   	{
>>   	  exp->X_add_number = i386_regtab[exp->X_add_number]
>> -			      .dw2_regnum[flag_code >> 1];
>> +			      .dw2_regnum[object_64bit];
>>   	  if (exp->X_add_number != Dw2Inval)
>>   	    exp->X_op = O_constant;
>>   	}
> 
> On one hand, I see that the suggested code changes are making things 
> semantically clearer, I would like to understand:
> 
> 1. If there is a scenario where flag_code is CODE16_BIT / CODE32_BIT and 
> object_64bit equal to 1 is supported.  gcc passes --32 when using -m16 
> or -m32.

Well, gcc may never produce such input, but hand-written assembly can.

> 2. Irrespective of #1, shouldn't we then also use "if (object_64bit == 
> 1)" instead of "if (flag_code == CODE_64BIT)" in md_begin where we set 
> the value of x86_dwarf2_return_column etc ?

Good point, let me make a v2.

Jan

  reply	other threads:[~2024-02-16  7:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09  8:11 Jan Beulich
2024-02-15 22:22 ` Indu Bhagat
2024-02-16  7:26   ` Jan Beulich [this message]
2024-02-20 23:04     ` Indu Bhagat
2024-02-21  7:34       ` Jan Beulich

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=aedcf4c3-f6af-485e-9e1a-5e553b71e598@suse.com \
    --to=jbeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=indu.bhagat@oracle.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).