[PATCH v11 22/25] gnu directives: add support for .gnu_attribute and .gnu_subsection in OAv2 context

Matthieu Longo matthieu.longo@arm.com
Tue Jan 13 13:38:41 GMT 2026


On 08/01/2026 15:53, Jan Beulich wrote:
> On 31.12.2025 00:05, Matthieu Longo wrote:
>> --- a/gas/doc/as.texi
>> +++ b/gas/doc/as.texi
>> @@ -4597,6 +4597,7 @@ Some machine configurations provide additional directives.
>>   * Func::                        @code{.func}
>>   * Global::                      @code{.global @var{symbol}}, @code{.globl @var{symbol}}
>>   @ifset ELF
>> +* Gnu_subsection::              @code{.gnu_subsection @var{name}, @var{comprehension}, @var{encoding}}
>>   * Gnu_attribute::               @code{.gnu_attribute @var{tag},@var{value}}
>>   * Hidden::                      @code{.hidden @var{names}}
>>   @end ifset
> 
> This looks like it is meant to be sorted alphabetically, so your addition
> wants moving down by a line.
> 
>> @@ -5744,9 +5745,48 @@ partial programs.  You may need the HPPA-only @code{.EXPORT} directive as well.
>>   @end ifset
>>   
>>   @ifset ELF
>> +@node Gnu_subsection
>> +@section @code{.gnu_subsection @var{name}, @var{comprehension}, @var{encoding}}
>> +Create or switch the current object attributes subsection to @var{name} for This
>> +file.  Valid values for @var{name} are following the pattern @code{[a-zA-Z0-9_]+}.
>> +
>> +The subsection property @var{comprehension} determines how a program processing
>> +the attributes handles attributes that it does not recognize (perhaps because
>> +the object file was generated by a different version of the toolchain).  A
>> +subsection that is marked @code{optional} can be skipped if it is not
>> +understood.  A subsection marked @code{required} implies that information
>> +conveyed by the attribute is required for correct processing of the object file;
>> +a fatal diagnostic must be generated if a tool does not recognize either the tag
>> +or the value associated with it.
>> +
>> +@var{encoding} specifies the expected encoding of the attributes recorded in the
>> +subsection.  Currently supported values are @code{ULEB128}/@code{uleb128} and
>> +@code{NTBS}/@code{ntbs} (null-terminated byte string).
>> +
>> +On the first declaration of a subsection, both @var{comprehension} and
>> +@var{encoding} are mandatory parameters. However, on subsequent declarations,
>> +none of the parameters is required. If they are still specified, their values
>> +will be matched against the ones from the first declaration. Any mismatch will
>> +be reported as an error.
>> +
>> +This directive is only available for Object Attributes v2.
>> +
>> +@xref{Object Attributes}.
>> +
>>   @node Gnu_attribute
>>   @section @code{.gnu_attribute @var{tag},@var{value}}
>> -Record a @sc{gnu} object attribute for this file.  @xref{Object Attributes}.
>> +
>> +For Object Attributes v1, record a @sc{gnu} object attribute with the pair
>> +@var{tag}, @var{value} for this file.
>> +
>> +For Object Attributes v2, record an object attribute with the pair @var{tag},
>> +@var{value} in the current subsection for this file.
>> +
>> +@var{tag} can either be an integer value, or a known named key. @var{value} can
>> +either be an integer or a string. For Object Attribute v2, the expected value
>> +type depends on the type set on the subsection.
>> +
>> +@xref{Object Attributes}.
>>   
>>   @node Hidden
>>   @section @code{.hidden @var{names}}
> 
> Same here, Gnu_subsection wants to live between Gnu_attribute and Hidden.
> 
> Okay with that adjustment.
> 
> Jan

Fixed.

Matthieu


More information about the Binutils mailing list