[PATCH v11 23/25] gnu directives: gas/readelf tests for gnu attributes v2
Matthieu Longo
matthieu.longo@arm.com
Thu Jan 15 17:14:13 GMT 2026
On 15/01/2026 08:14, Jan Beulich wrote:
> On 14.01.2026 17:36, Matthieu Longo wrote:
>> 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.
>>
>> Is the below what you meant ?
>
> Almost. While ...
>
>> - Name:[ ]+gnu_abi
>> Scope:[ ]+public
>> Length:[ ]+18
>> Comprehension:[ ]+required
>> Encoding:[ ]+ULEB128
>> Values:
>
> ... up to here indentation may indeed matter (to match the dash-prefixed Name:),
> ...
>
>> Tag_unknown_1:[ ]+1 .*
>> Tag_unknown_2:[ ]+1 .*
>
> ... here it doesn't anymore, so would want to be
>
> [ ]+Tag_unknown_1:[ ]+1 .*
>
> or the easier
>
> +Tag_unknown_1:[ ]+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.
>
> Okay, thanks for clarifying.
>
>> 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.
>
> I understand that the use of [ ] hampers readability some. Yet that's imo a
> fair price to pay to keep the need for future changes down. After all at some
> point someone may want to make
>
> - Name: foo_1
> Scope: private
> Length: 20
> Comprehension: optional
> Encoding: ULEB128
>
> into reliably padded
>
> - Name: foo_1
> Scope: private
> Length: 20
> Comprehension: optional
> Encoding: ULEB128
>
> (arguably this may want doing right away, albeit it may end up a little tricky
> with translation). Such a change better wouldn't require to alter the
> expectations, imo at least (it would be a purely cosmetic change, without any
> effect on the data presented to the user).
>
> Jan
Fixed.
Matthieu
More information about the Binutils
mailing list