[PATCH v11 23/25] gnu directives: gas/readelf tests for gnu attributes v2

Matthieu Longo matthieu.longo@arm.com
Wed Jan 14 16:36:50 GMT 2026


On 09/01/2026 09:19, Jan Beulich wrote:
> On 31.12.2025 00:05, Matthieu Longo wrote:
>> --- /dev/null
>> +++ b/gas/testsuite/gas/gnu-attributes/oav2-interleaved-subsections.d
>> @@ -0,0 +1,34 @@
>> +# name: GNU attributes v2: correct context switching between interleaved subsections
>> +# target: [supports_oa_v2]
>> +# readelf: -A
>> +
>> +Subsections:
>> + - Name:	  foo_1
>> +   Scope:	  private
>> +   Length:	  20
>> +   Comprehension: optional
>> +   Encoding:	  ULEB128
>> +   Values:
>> +    Tag_unknown_1:	1 \(0x1\)
>> +    Tag_unknown_2:	0 \(0x0\)
>> +    Tag_unknown_3:	0 \(0x0\)
>> +    Tag_unknown_4:	0 \(0x0\)
>> +
>> + - Name:	  gnu_abi
>> +   Scope:	  public
>> +   Length:	  18
>> +   Comprehension: required
>> +   Encoding:	  ULEB128
>> +   Values:
>> +    Tag_unknown_1:	1 \(0x1\)
>> +    Tag_unknown_2:	1 \(0x1\)
>> +
>> + - Name:	  gnu_feature_and_bits
>> +   Scope:	  public
>> +   Length:	  33
>> +   Comprehension: optional
>> +   Encoding:	  ULEB128
>> +   Values:
>> +    Tag_unknown_0:	1 \(0x1\)
>> +    Tag_unknown_1:	0 \(0x0\)
>> +    Tag_unknown_2:	1 \(0x1\)
> 
> Similar remark here (applicable elsewhere as well): This looks to be a verbatim
> copy of readelf output, just with backslashes added as needed. I don't think it
> needs to be as tight for the purpose of the test. E.g. the secondary (hex)
> printing of numbers could be matched by .* instead. Whether e.g. the precise
> values for Length: are a required part of the test I can't tell. The exact way
> blank padding is effected also doesn't look to be relevant for the test.
> 
> Jan

Is the below what you meant ?

  - Name:[	 ]+gnu_abi
    Scope:[	 ]+public
    Length:[	 ]+18
    Comprehension:[	 ]+required
    Encoding:[	 ]+ULEB128
    Values:
     Tag_unknown_1:[	 ]+1 .*
     Tag_unknown_2:[	 ]+1 .*


Regarding the length, it is part of the tests. It allowed me in the past to detect some bugs, so I would prefer to keep it.
Regarding the hex, it could in theory be different if one day we decide to support LEB128. But happy to replace it by .* for now.
Regarding the whitespaces, it seems to me that this change is making the tests less readable. It would also argue that it is more difficult to maintain as I usually append the new output of readelf to the file, and try to rework the minimum.

Matthieu


More information about the Binutils mailing list