[PATCH v9 17/19] gnu directives: gas/readelf tests for gnu attributes v2

Jan Beulich jbeulich@suse.com
Fri Nov 7 09:51:16 GMT 2025


On 01.09.2025 18:56, Matthieu Longo wrote:
> These tests are a copy-paste of the generic parsing tests for AArch64.

Them truly being copy-and-paste (didn't check), are they actually useful?

> --- a/binutils/testsuite/lib/binutils-common.exp
> +++ b/binutils/testsuite/lib/binutils-common.exp
> @@ -507,6 +507,32 @@ proc gas_sframe_check {} {
>      return $check_as_sframe_result
>  }
>  
> +# Whether a target support Object Attributes v1
> +proc supports_oa_v1 {} {
> +    if { [istarget arc-*-*]
> +	 || [istarget arm*-*-*]
> +	 || [istarget csky*-*-*]
> +	 || [istarget m68*-*-*]
> +	 || [istarget mips*-*-*]
> +	 || [istarget msp*-*-*]
> +	 || [istarget powerpc*-*-*]
> +	 || [istarget riscv*-*-*]
> +	 || [istarget s390*-*-*]
> +	 || [istarget sparc*-*-*]
> +	 || [istarget tic6x*-*-*] } {
> +	return 1
> +    }
> +    return 0
> +}
> +
> +# Whether a target support Object Attributes v2
> +proc supports_oa_v2 {} {
> +    if {[istarget aarch64*-*-*]} {
> +	return 1
> +    }
> +    return 0
> +}

Should these perhaps include is_elf_format checks as well?

> --- /dev/null
> +++ b/gas/testsuite/gas/gnu-attributes/gnu-attributes.exp
> @@ -0,0 +1,25 @@
> +# 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.
> +
> +# Exclude non-aarch64-ELF targets.
> +if { ![is_elf_format] } {
> +    return
> +}

How does this exclude non-aarch64? (With the suggestion above, the extra
check here wouldn't be necessary anyway.)

> --- /dev/null
> +++ b/gas/testsuite/gas/gnu-attributes/oa-gnu-attribute-directive.d
> @@ -0,0 +1,6 @@
> +# name: GNU attributes v1/v2: no support for directive gnu_attribute
> +# notarget: [supports_oa_v1] [supports_oa_v2]
> +# source: oa-gnu-attribute-directive.s
> +# as:
> +#error: \A[^\n]+: Assembler messages:
> +#error: \n[^\n]+: Error: unknown pseudo-op: `\.gnu_attribute'\Z

The use of \A, \n, and \Z aren't overly nice, as they hamper readability
(the larger the set of expected messages, the worse). Thoughts towards
using #error_output: instead?

I'd also recommend to drop redundant lines - neither the empty "# as:"
nor the "# source:" line look to be needed, as they're only specifying
what is the default anyway.

For #name, I think gnu_attribute would better be prefixed by a dot.
Then "directive" may perhaps be dropped.

Finally it would be nice if style-wise things were uniform: Either a
blank after the # everywhere, or nowhere.

Jan


More information about the Binutils mailing list