[PATCH v9 17/19] gnu directives: gas/readelf tests for gnu attributes v2
Matthieu Longo
matthieu.longo@arm.com
Fri Nov 7 17:17:36 GMT 2025
On 07/11/2025 09:51, Jan Beulich wrote:
> 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?
>
I think they are, as they should be executed on all platforms supporting
OAv2. The only reason why those are duplicated in AArch64 is because
AArch64 has an alias for the OAv2 directives. Otherwise, AArch64 test
suite should only contain additional tests for the existing "aeabi_"
subsections.
>> --- 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?
>
This filter is already there in gnu-attributes.exp at the top of the
file, but I agree, it might be better to move it inside supports_oa_v1()
and supports_oa_v2().
Added in the next revision.
>> --- /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.)
>
Removed since it was added in supports_oa_v1() and supports_oa_v2().
>> --- /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?
>
Used "#error_output" but only for
gas/testsuite/gas/gnu-attributes/oav2-failures-1.d
Others files contains only 2 lines, moving the error lines into a
separate file seems overkill for those cases, and does not improve the
readability.
> 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.
>
Removed the empty "#as:" and "#source:..." lines, even if I prefer
personally the test description as it was.
> For #name, I think gnu_attribute would better be prefixed by a dot.
> Then "directive" may perhaps be dropped.
>
Fixed.
> Finally it would be nice if style-wise things were uniform: Either a
> blank after the # everywhere, or nowhere.
>
> Jan
Fixed by adding a space.
Matthieu
More information about the Binutils
mailing list