[PATCH,RFC 5/9] gas: add new command line option --scfi[=all,none]

Indu Bhagat indu.bhagat@oracle.com
Sat Sep 30 06:13:57 GMT 2023


On 9/28/23 07:04, Nick Clifton wrote:
> Hi Indu,
> 
>> When the command line option --scfi (default is --scfi=all) is passed to
>> the GNU assembler, it will synthesize DWARF call frame information (CFI)
>> for the assembly.
> 
>> Also document the option.
> 
> Please could you also add an entry in the gas/NEWS file about this new 
> feature.
> 

OK.

>> +# ifdef TARGET_USE_SCFI
>> +  fprintf (stream, _("\
>> +  --scfi=[all,none]      synthesize DWARF CFI for hand-written asm 
>> (not inline)\n\
>> +              (default --scfi=all)\n"));
>> +# endif
> 
> I was wondering how the code would detect inline assembler.
> Presumably it looks for the #NOAPP preprocessor directive ?

Yes.

> Or is the point of the comment in the above delta that the
> user should not use this new option in conjunction with actual
> compiled code ?  Either way I think that you need to extend
> the documentation to include describing what happens when
> compiled code and this option are used together.
> 

The intent was to convey to user that they must use:
   --scfi=all for hand-written asm,
   --scfi=inline if they have functions with inline asm.

I agree this is not currently reflected clearly in documentation. I will 
update it.

If --scfi=all is used for inline asm, this means SCFI machinery is being 
fed the compiler generated assembly. When --scfi=all is specified, most 
of the existing CFI directives are ignored.  Now, with using --scfi=all 
for inline asm, there is risk that SCFI machinery is not able to 
generate CFI, as compiler generated code may be "too complex" for SCFI 
to handle (like indirect jumps, jump table, DRAP register to realign 
stack etc, ...), and no CFI is synthesized (and the compiler generated 
CFI for the compiler generated asm also gets thrown away).

Hence the recommendation to use --scfi=inline for inline asm, where the 
assembler will not ignore the already existing CFI and will only 
generate CFI for the inline asm stubs.

> Also - I have not checked this yet - if this option is enabled
> and no CFI statements are generated (or maybe if an incomplete
> sequence is generated) - presumably because of badly written
> code - will there be an error message generated ?
> 

Yes, I intend to cover all cases where SCFI fails to synthesize CFI and 
issue an appropriate warning/error to user for each function.

Thanks
Indu






More information about the Binutils mailing list