[PATCH v12 25/25] gnu directives: bfd: generic tests for merge of gnu attributes v2

Matthieu Longo matthieu.longo@arm.com
Wed Jan 21 11:39:42 GMT 2026


On 21/01/2026 10:49, Jan Beulich wrote:
> On 16.01.2026 19:59, Matthieu Longo wrote:
>> --- /dev/null
>> +++ b/ld/testsuite/ld-attributes/ld-attributes.exp
>> @@ -0,0 +1,31 @@
>> +# Expect script for AARCH64 ELF tests related to GNU properties.
>> +# Copyright (C) 2025 Free Software Foundation, Inc.
>> +#
>> +# This file is part of the GNU Binutils.
>> +#
>> +# 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
>> +#
>> +
>> +set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
>> +
>> +foreach t $test_list {
>> +  # We need to strip the ".d", but can leave the dirname.
>> +  run_dump_test [file rootname $t] \
>> +    [list [list as "-I\$srcdir/\$subdir"]]
>> +}
>> diff --git a/ld/testsuite/ld-attributes/oav2-1-all-optional-1.s b/ld/testsuite/ld-attributes/oav2-1-all-optional-1.s
>> new file mode 100644
>> index 00000000000..5cda02a0d3f
>> --- /dev/null
>> +++ b/ld/testsuite/ld-attributes/oav2-1-all-optional-1.s
>> @@ -0,0 +1,15 @@
>> +	.gnu_subsection gnu_testing_ba_1_MERGE_AND, optional, uleb128
>> +	.gnu_attribute  0, 1
>> +	.gnu_attribute  1, 0
>> +
>> +	.gnu_subsection gnu_testing_ba_2_MERGE_AND, optional, uleb128
>> +	.gnu_attribute  0, 0
>> +	.gnu_attribute  1, 1
>> +
>> +	.gnu_subsection gnu_testing_ba_3_MERGE_ADD, optional, ntbs
>> +	.gnu_attribute  0, "hello"
>> +	.gnu_attribute  1, "world"
>> +
>> +	.gnu_subsection gnu_testing_ba_5_MERGE_ADD, optional, ntbs
>> +	.gnu_attribute  0, "hello"
>> +	.gnu_attribute  1, "world"
>> diff --git a/ld/testsuite/ld-attributes/oav2-1-all-optional-2.s b/ld/testsuite/ld-attributes/oav2-1-all-optional-2.s
>> new file mode 100644
>> index 00000000000..afe9334a34c
>> --- /dev/null
>> +++ b/ld/testsuite/ld-attributes/oav2-1-all-optional-2.s
>> @@ -0,0 +1,15 @@
>> +	.gnu_subsection gnu_testing_ba_1_MERGE_AND, optional, uleb128
>> +	.gnu_attribute  0, 1
>> +	.gnu_attribute  1, 1
>> +
>> +	.gnu_subsection gnu_testing_ba_2_MERGE_AND, optional, uleb128
>> +	.gnu_attribute  0, 1
>> +	.gnu_attribute  1, 1
>> +
>> +	.gnu_subsection gnu_testing_ba_4_MERGE_ADD, optional, ntbs
>> +	.gnu_attribute  0, "foo"
>> +	.gnu_attribute  1, "bar"
>> +
>> +	.gnu_subsection gnu_testing_ba_5_MERGE_ADD, optional, ntbs
>> +	.gnu_attribute  0, "foo"
>> +	.gnu_attribute  1, "bar"
>> diff --git a/ld/testsuite/ld-attributes/oav2-1-mismatch-subsec-props-with-all-optional-1.d b/ld/testsuite/ld-attributes/oav2-1-mismatch-subsec-props-with-all-optional-1.d
>> new file mode 100644
>> index 00000000000..672c5d3db14
>> --- /dev/null
>> +++ b/ld/testsuite/ld-attributes/oav2-1-mismatch-subsec-props-with-all-optional-1.d
>> @@ -0,0 +1,11 @@
>> +# name: Object Attributes v2: mismatch subsection properties with oav2-1-all-optional-1
>> +# target: [supports_oa_v2]
>> +# source: oav2-1-all-optional-1.s
>> +# source: oav2-1-mismatch-subsec-props-with-all-optional-1.s
>> +# ld: -shared
>> +#error: \A[^\n]*oav2-1-mismatch-subsec-props-with-all-optional-1\.o: error: mismatching properties of subsection 'gnu_testing_ba_1_MERGE_AND'
>> +#error: \n[^\n]*oav2-1-all-optional-1\.o: info: conflicting properties \(optional, .*\) lives here
> 
> There's a grammar issue with the error message itself: Either "property" or "live".
> 

Fixed.

> For this testcase itself the question again is whether the exact wording of this
> info: line is relevant for this test.
> 
> Okay with the error message fixed in whichever earlier patch, and expectations
> updated accordingly here. I'm not going to insist on further abbreviating the
> expectations.
> 
> Jan

Thank you.

Matthieu


More information about the Binutils mailing list