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

Jan Beulich jbeulich@suse.com
Fri May 2 13:58:29 GMT 2025


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.

> --- /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/.

Jan


More information about the Binutils mailing list