[PATCH 09/12] objdump/readelf: adjust for SFRAME_VERSION_2

Indu Bhagat indu.bhagat@oracle.com
Thu Jun 29 06:41:54 GMT 2023


On 6/28/23 16:04, Hans-Peter Nilsson wrote:
> On Tue, 27 Jun 2023, Indu Bhagat via Binutils wrote:
>> Make adjustments to account for a new format version and its name.
>> Also shuffle some code to make it more readable and use the available
>> APIs rather than direct access.
>>
>> objdump/readelf will show the following message to the user if .sframe
>> section in SFRAME_VERSION_1 format is seen:
>>
>>   "No further information can be displayed.  SFrame version not
>>   supported."
>>
>> In other words, like the rest of the binutils, only the current SFrame
>> format version, i.e., SFRAME_VERSION_2 is supported by the textual dump
>> facilities.
> 
> A decision that IMHO is counter to binutils philosophy (AFAIU),
> unless version 1 is actually generated by nobody nowhere.
> 
> If there are object files out there generated with version 1,
> support should be kept, at the very least for inspection tools.
> 

SFrame Version 1 format definition had issues related to unaligned 
accesses. In most cases of when there are version 1 .sframe sections out 
there, those applications should ideally be rebuilt to switch to using 
SFRAME_VERSION_2.  When other assemblers and linkers begin to add 
support for SFrame format, SFRAME_VERSION_2 should be used as it is the 
latest - there is little incentive to implement SFRAME_VERSION_1 there.

The trouble with supporting both SFRAME_VERSION_1 and SFRAME_VERSION_2 
in readelf/objdump is that the abstraction sframe_func_desc_entry used 
in libsframe is the same as the binary representation defined in 
include/sframe.h. This means that to support two versions of SFrame FDE, 
libsframe will need to revisit some of its APIs and will be a bit of 
rejig. I tried to do some of this, but it looked very clunky to me.

The choice to keep libsframe's internal representation for SFrame FDE to 
be the same as the on-disk representation has the advantage that an 
unwinder does not need to do any copy operations at run time.  It could 
simply read the SFrame FDE from memory.

Thanks
Indu


More information about the Binutils mailing list