[PATCH v8 05/19] gas: use common code for object attribute v1 & v2 parsing

Jan Beulich jbeulich@suse.com
Fri Aug 8 11:58:03 GMT 2025


On 15.07.2025 13:39, Matthieu Longo wrote:
> Since the previous patch added all the code to be able to parse both
> OAv1 and OAv2 directives, this patch switches OAv1 to use this common
> code.
> Additionally to the common code in obj-elf.c, the following backends
> using a custom object attribute directive were impacted.
>   - ARC
>   - Arm
>   - m68k
>   - PowerPC
>   - RISC-V
>   - TI C6X
> A parsing test for Arm had to be adapted to the error messages of the
> new parser.
> 
> The gas and ld test suites were successfully run for the following
> backends: S390, ARC, Arm, CSky, m68k, msp430, PowerPC, TI C6X, RISC-V,
> AArch64, MIPS, SPARC.
> ---
>  gas/config/obj-elf-attr.c           | 116 ----------------------------
>  gas/config/obj-elf-attr.h           |   5 --
>  gas/config/obj-elf.c                |   5 --
>  gas/config/tc-arc.c                 |   2 +-
>  gas/config/tc-arm.c                 |   2 +-
>  gas/config/tc-m68k.c                |   2 +-
>  gas/config/tc-ppc.c                 |   2 +-
>  gas/config/tc-riscv.c               |   2 +-
>  gas/config/tc-tic6x.c               |   2 +-
>  gas/testsuite/gas/arm/attr-syntax.d |   6 +-
>  10 files changed, 11 insertions(+), 133 deletions(-)

Such a diffstat is close to being okay all by itself. There's just one part
I don't understand:

> --- a/gas/testsuite/gas/arm/attr-syntax.d
> +++ b/gas/testsuite/gas/arm/attr-syntax.d
> @@ -1,4 +1,8 @@
>  #source: attr-syntax.s
>  #notarget: *-*-pe
>  #as:
> -#error: :1: Error: Attribute name not recognised: made_up_tag.*:3: Error: expected <tag> , <value>.*:5: Error: expected <tag> , <value>

This looks odd, and so do ...

> +#error: \A[^\n]*\.s: Assembler messages:\n
> +#error: [^\n]*\.s:[0-9]+: Error: unknown identifier 'made_up_tag'\n
> +#error: [^\n]*\.s:[0-9]+: Error: could not parse attribute tag\n
> +#error: [^\n]*\.s:[0-9]+: Error: unexpected comma before parameter 1\n
> +#error: [^\n]*\.s:[0-9]+: Error: missing comma after parameter 1

... all the trailing \n here. Would this better be converted to the more
common #error_output: form?

Jan


More information about the Binutils mailing list