[PATCH v2 25/28] gnu directives: gas tests: add generic tests for gnu attributes v2

Matthieu Longo matthieu.longo@arm.com
Thu May 8 15:07:32 GMT 2025


On 2025-05-07 17:22, Matthieu Longo wrote:
> On 2025-05-02 14:58, Jan Beulich wrote:
>> On 02.05.2025 12:32, Matthieu Longo wrote:
>>> --- /dev/null
>>> +++ b/gas/testsuite/gas/all/gnu-attributes/ba-1.s
>>> @@ -0,0 +1,31 @@
>>> +.set ATTR_TYPE_uleb128,   0
>>> +.set ATTR_TYPE_asciz,     1
>>> +
>>> +.set SUBSEC_required,     0
>>> +.set SUBSEC_optional,     1
>>> +
>>> +.gnu_subsection foo_1, 1, ATTR_TYPE_uleb128
>>> +
>>> +.set Tag_Feature_foo,     2
>>> +.set Tag_Feature_bar,     3
>>> +
>>> +.gnu_attribute  Tag_Feature_bar, 1
>>> +.gnu_attribute  0, 1
>>> +.gnu_attribute  1, 1
>>> +.gnu_attribute  Tag_Feature_foo, 1
>>> +
>>> +.gnu_subsection gnu_foo_1, 1, ATTR_TYPE_uleb128
>>> +.gnu_attribute  Tag_Feature_bar, 1
>>> +.gnu_attribute  Tag_Feature_foo, 'A'
>>> +
>>> +.gnu_subsection gnu_foo_2, 0, ATTR_TYPE_asciz
>>> +.gnu_attribute  4, ""
>>> +.gnu_attribute  2, "TEST2"
>>> +
>>> +.gnu_subsection gnu_foo_3, required, ntbs
>>> +.gnu_attribute  4, "TEST"
>>> +
>>> +.gnu_subsection gnu-testing_foo-MERGE-AND, optional, ULEB128
>>> +.gnu_attribute  GNUTestTag_0, 0
>>> +.gnu_attribute  GNUTestTag_1, 1
>>> +.gnu_attribute  2, 1
>>
>> Please can you avoid putting directives at the very start of a line? Gas
>> presently accepts such, but formally only labels may go there. And you
>> want these tests to be "generic", i.e. potentially usable by any target.
>>
> 
> Fixed in the next revision.
> 
>>> --- /dev/null
>>> +++ b/gas/testsuite/gas/all/gnu-attributes/gnu-attributes.exp
>>> @@ -0,0 +1,24 @@
>>> +# Copyright (C) 2025 Free Software Foundation, Inc.
>>> +
>>> +# This program is free software; you can redistribute it and/or modify
>>> +# it under the terms of the GNU General Public License as published by
>>> +# the Free Software Foundation; either version 3 of the License, or
>>> +# (at your option) any later version.
>>> +#
>>> +# This program is distributed in the hope that it will be useful,
>>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>> +# GNU General Public License for more details.
>>> +#
>>> +# You should have received a copy of the GNU General Public License
>>> +# along with this program; if not, write to the Free Software
>>> +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 
>>> 02110-1301, USA.
>>> +
>>> +#
>>> +# Generic tests for GNU attributes v2
>>> +#
>>> +
>>> +# For now, only AArch64 backend supports object attributes v2.
>>> +if {[istarget aarch64*-*-*]} {
>>> +  run_dump_tests [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
>>> +}
>>
>> Seeing this, I question all/gnu-attributes/ as a proper place for putting
>> these. Imo that would better be simply gnu-attributes/.
> 
> Subdirectories at the root seem to be all target-specific, which mean 
> that only all/ contains generic tests.
> 
> The fact that this is only supported on AArch64 for now does not change 
> that OAv2 could be used by any other backend in the future.
> It would also be nice to add generic tests for OAv1 here, not only the 
> ones for OAv2.
> 
> Matthieu.
> 
>>
>> Jan
> 

After a second look at the directory structure, it seems that there are 
cfi and cfi-sframe for instance that are not targets.
In the next revision, I moved the gnu-attributes directory into 
gas/testsuite/gas.

Matthieu.


More information about the Binutils mailing list