[PATCH 2/4] gas: sframe: i386: have the backend specify the RA too
Jan Beulich
jbeulich@suse.com
Tue May 13 14:59:35 GMT 2025
On 13.05.2025 16:54, Jens Remus wrote:
> On 13.05.2025 14:57, Jan Beulich wrote:
>> On 11.05.2025 09:35, Indu Bhagat wrote:
>>> --- a/gas/config/tc-i386.h
>>> +++ b/gas/config/tc-i386.h
>>> @@ -462,6 +462,12 @@ extern unsigned int x86_sframe_cfa_sp_reg;
>>> extern unsigned int x86_sframe_cfa_fp_reg;
>>> #define SFRAME_CFA_FP_REG x86_sframe_cfa_fp_reg
>>>
>>> +/* The return address DWARF register number for SFrame purposes. Although for
>>> + AMD64, RA tracking is disabled, specific constructs, like for indicating
>>> + the _start function, may use it. */
>>> +extern unsigned int x86_sframe_cfa_ra_reg;
>>> +#define SFRAME_CFA_RA_REG x86_sframe_cfa_ra_reg
>>
>> Why is it, btw, that this needs a variable which never changes? IOW why
>> not simply
>>
>> #define SFRAME_CFA_RA_REG REG_<whatever>
>>
>> ? Same actually goes for x86_sframe_cfa_{fp,sp}_reg as well.
>
> I do have an experimental patch on top of my S390 series that
> temporarily changes sframe_cfa_ra_reg (defined to s390_sframe_cfa_ra_reg
> on S390) to represent .cfi_return_column in SFrame on S390.
>
> Either all targets need to define sframe_cfa_ra_reg so that it can serve
> as a lvalue or I need to guard this S390-specific code with TC_S390. So
> far I had been doing the latter, as x86-64 did not define
> sframe_cfa_ra_reg at all, which this series would change.
Sure, if there is a need for it to be usable as lvalue, that's okay-ish.
I'd still prefer it to not require a variable on targets where such
isn't needed, or as a 2nd best option have that variable be "const" on
targets where it never changes. Such does not just (normally) produce
better code, but also serves kind of a doc purpose (as to the intentions
with such variables / values).
Jan
More information about the Binutils
mailing list