[v3] config/arm: update aarch32 build with gcc13

Message ID 20231025125714.132793-1-juraj.linkes@pantheon.tech (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v3] config/arm: update aarch32 build with gcc13 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-compile-arm64-testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Juraj Linkeš Oct. 25, 2023, 12:57 p.m. UTC
  The aarch32 with gcc13 fails with:

Compiler for C supports arguments -march=armv8-a: NO

../config/arm/meson.build:714:12: ERROR: Problem encountered: No
suitable armv8 march version found.

This is because we test -march=armv8-a alone (without the -mpfu option),
which is no longer supported in gcc13 aarch32 builds.

The most recent recommendation from the compiler team is to build with
-march=armv8-a+simd -mfpu=auto, which should work for compilers old and
new. The suggestion is to first check -march=armv8-a+simd and only then
check -mfpu=auto.

To address this, add a way to force the architecture (the value of
the -march option).

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 config/arm/meson.build | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)
  

Comments

Ruifeng Wang Oct. 26, 2023, 7:04 a.m. UTC | #1
> -----Original Message-----
> From: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Sent: Wednesday, October 25, 2023 8:57 PM
> To: thomas@monjalon.net; Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>;
> bruce.richardson@intel.com; Ruifeng Wang <Ruifeng.Wang@arm.com>
> Cc: dev@dpdk.org; Juraj Linkeš <juraj.linkes@pantheon.tech>
> Subject: [PATCH v3] config/arm: update aarch32 build with gcc13
> 
> The aarch32 with gcc13 fails with:
> 
> Compiler for C supports arguments -march=armv8-a: NO
> 
> ../config/arm/meson.build:714:12: ERROR: Problem encountered: No suitable armv8 march
> version found.
> 
> This is because we test -march=armv8-a alone (without the -mpfu option), which is no
> longer supported in gcc13 aarch32 builds.
> 
> The most recent recommendation from the compiler team is to build with -march=armv8-a+simd
> -mfpu=auto, which should work for compilers old and new. The suggestion is to first check
> -march=armv8-a+simd and only then check -mfpu=auto.
> 
> To address this, add a way to force the architecture (the value of the -march option).
> 
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  config/arm/meson.build | 40 +++++++++++++++++++++++-----------------
>  1 file changed, 23 insertions(+), 17 deletions(-)
> 
> diff --git a/config/arm/meson.build b/config/arm/meson.build index 3f22d8a2fc..c3f763764a
> 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -43,7 +43,9 @@ implementer_generic = {
>          },
>          'generic_aarch32': {
>              'march': 'armv8-a',
> -            'compiler_options': ['-mfpu=neon'],
> +            'force_march': true,
> +            'march_features': ['simd'],
> +            'compiler_options': ['-mfpu=auto'],
>              'flags': [
>                  ['RTE_ARCH_ARM_NEON_MEMCPY', false],
>                  ['RTE_ARCH_STRICT_ALIGN', true], @@ -695,21 +697,25 @@ if update_flags
>      # probe supported archs and their features
>      candidate_march = ''
>      if part_number_config.has_key('march')
> -        supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
> -                            'armv8.2-a', 'armv8.1-a', 'armv8-a']
> -        check_compiler_support = false
> -        foreach supported_march: supported_marchs
> -            if supported_march == part_number_config['march']
> -                # start checking from this version downwards
> -                check_compiler_support = true
> -            endif
> -            if (check_compiler_support and
> -                cc.has_argument('-march=' + supported_march))
> -                candidate_march = supported_march
> -                # highest supported march version found
> -                break
> -            endif
> -        endforeach
> +        if part_number_config.get('force_march', false)
> +            candidate_march = part_number_config['march']
> +        else
> +            supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
> +                                'armv8.2-a', 'armv8.1-a', 'armv8-a']
> +            check_compiler_support = false
> +            foreach supported_march: supported_marchs
> +                if supported_march == part_number_config['march']
> +                    # start checking from this version downwards
> +                    check_compiler_support = true
> +                endif
> +                if (check_compiler_support and
> +                    cc.has_argument('-march=' + supported_march))
> +                    candidate_march = supported_march
> +                    # highest supported march version found
> +                    break
> +                endif
> +            endforeach
> +        endif
>          if candidate_march == ''
>              error('No suitable armv8 march version found.')
>          endif
> @@ -741,7 +747,7 @@ if update_flags
>      # apply supported compiler options
>      if part_number_config.has_key('compiler_options')
>          foreach flag: part_number_config['compiler_options']
> -            if cc.has_argument(flag)
> +            if cc.has_multi_arguments(machine_args + [flag])
>                  machine_args += flag
>              else
>                  warning('Configuration compiler option ' +
> --
> 2.34.1

Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
  
Paul Szczepanek Nov. 1, 2023, 12:57 p.m. UTC | #2
On 25/10/2023 13:57, Juraj Linkeš wrote:
> The aarch32 with gcc13 fails with:
>
> Compiler for C supports arguments -march=armv8-a: NO
>
> ../config/arm/meson.build:714:12: ERROR: Problem encountered: No
> suitable armv8 march version found.
>
> This is because we test -march=armv8-a alone (without the -mpfu option),
> which is no longer supported in gcc13 aarch32 builds.
>
> The most recent recommendation from the compiler team is to build with
> -march=armv8-a+simd -mfpu=auto, which should work for compilers old and
> new. The suggestion is to first check -march=armv8-a+simd and only then
> check -mfpu=auto.
>
> To address this, add a way to force the architecture (the value of
> the -march option).
>
> Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>   config/arm/meson.build | 40 +++++++++++++++++++++++-----------------
>   1 file changed, 23 insertions(+), 17 deletions(-)
>
> diff --git a/config/arm/meson.build b/config/arm/meson.build
> index 3f22d8a2fc..c3f763764a 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
> @@ -43,7 +43,9 @@ implementer_generic = {
>           },
>           'generic_aarch32': {
>               'march': 'armv8-a',
> -            'compiler_options': ['-mfpu=neon'],
> +            'force_march': true,
> +            'march_features': ['simd'],
> +            'compiler_options': ['-mfpu=auto'],
>               'flags': [
>                   ['RTE_ARCH_ARM_NEON_MEMCPY', false],
>                   ['RTE_ARCH_STRICT_ALIGN', true],
> @@ -695,21 +697,25 @@ if update_flags
>       # probe supported archs and their features
>       candidate_march = ''
>       if part_number_config.has_key('march')
> -        supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
> -                            'armv8.2-a', 'armv8.1-a', 'armv8-a']
> -        check_compiler_support = false
> -        foreach supported_march: supported_marchs
> -            if supported_march == part_number_config['march']
> -                # start checking from this version downwards
> -                check_compiler_support = true
> -            endif
> -            if (check_compiler_support and
> -                cc.has_argument('-march=' + supported_march))
> -                candidate_march = supported_march
> -                # highest supported march version found
> -                break
> -            endif
> -        endforeach
> +        if part_number_config.get('force_march', false)
> +            candidate_march = part_number_config['march']
> +        else
> +            supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
> +                                'armv8.2-a', 'armv8.1-a', 'armv8-a']
> +            check_compiler_support = false
> +            foreach supported_march: supported_marchs
> +                if supported_march == part_number_config['march']
> +                    # start checking from this version downwards
> +                    check_compiler_support = true
> +                endif
> +                if (check_compiler_support and
> +                    cc.has_argument('-march=' + supported_march))
> +                    candidate_march = supported_march
> +                    # highest supported march version found
> +                    break
> +                endif
> +            endforeach
> +        endif
>           if candidate_march == ''
>               error('No suitable armv8 march version found.')
>           endif
> @@ -741,7 +747,7 @@ if update_flags
>       # apply supported compiler options
>       if part_number_config.has_key('compiler_options')
>           foreach flag: part_number_config['compiler_options']
> -            if cc.has_argument(flag)
> +            if cc.has_multi_arguments(machine_args + [flag])
>                   machine_args += flag
>               else
>                   warning('Configuration compiler option ' +


Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
  
Thomas Monjalon Nov. 6, 2023, 2:22 p.m. UTC | #3
01/11/2023 13:57, Paul Szczepanek:
> 
> On 25/10/2023 13:57, Juraj Linkeš wrote:
> > The aarch32 with gcc13 fails with:
> >
> > Compiler for C supports arguments -march=armv8-a: NO
> >
> > ../config/arm/meson.build:714:12: ERROR: Problem encountered: No
> > suitable armv8 march version found.
> >
> > This is because we test -march=armv8-a alone (without the -mpfu option),
> > which is no longer supported in gcc13 aarch32 builds.
> >
> > The most recent recommendation from the compiler team is to build with
> > -march=armv8-a+simd -mfpu=auto, which should work for compilers old and
> > new. The suggestion is to first check -march=armv8-a+simd and only then
> > check -mfpu=auto.
> >
> > To address this, add a way to force the architecture (the value of
> > the -march option).
> >
> > Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
> > ---
> >   config/arm/meson.build | 40 +++++++++++++++++++++++-----------------
> >   1 file changed, 23 insertions(+), 17 deletions(-)
> >
> > diff --git a/config/arm/meson.build b/config/arm/meson.build
> > index 3f22d8a2fc..c3f763764a 100644
> > --- a/config/arm/meson.build
> > +++ b/config/arm/meson.build
> > @@ -43,7 +43,9 @@ implementer_generic = {
> >           },
> >           'generic_aarch32': {
> >               'march': 'armv8-a',
> > -            'compiler_options': ['-mfpu=neon'],
> > +            'force_march': true,
> > +            'march_features': ['simd'],
> > +            'compiler_options': ['-mfpu=auto'],
> >               'flags': [
> >                   ['RTE_ARCH_ARM_NEON_MEMCPY', false],
> >                   ['RTE_ARCH_STRICT_ALIGN', true],
> > @@ -695,21 +697,25 @@ if update_flags
> >       # probe supported archs and their features
> >       candidate_march = ''
> >       if part_number_config.has_key('march')
> > -        supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
> > -                            'armv8.2-a', 'armv8.1-a', 'armv8-a']
> > -        check_compiler_support = false
> > -        foreach supported_march: supported_marchs
> > -            if supported_march == part_number_config['march']
> > -                # start checking from this version downwards
> > -                check_compiler_support = true
> > -            endif
> > -            if (check_compiler_support and
> > -                cc.has_argument('-march=' + supported_march))
> > -                candidate_march = supported_march
> > -                # highest supported march version found
> > -                break
> > -            endif
> > -        endforeach
> > +        if part_number_config.get('force_march', false)
> > +            candidate_march = part_number_config['march']
> > +        else
> > +            supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
> > +                                'armv8.2-a', 'armv8.1-a', 'armv8-a']
> > +            check_compiler_support = false
> > +            foreach supported_march: supported_marchs
> > +                if supported_march == part_number_config['march']
> > +                    # start checking from this version downwards
> > +                    check_compiler_support = true
> > +                endif
> > +                if (check_compiler_support and
> > +                    cc.has_argument('-march=' + supported_march))
> > +                    candidate_march = supported_march
> > +                    # highest supported march version found
> > +                    break
> > +                endif
> > +            endforeach
> > +        endif
> >           if candidate_march == ''
> >               error('No suitable armv8 march version found.')
> >           endif
> > @@ -741,7 +747,7 @@ if update_flags
> >       # apply supported compiler options
> >       if part_number_config.has_key('compiler_options')
> >           foreach flag: part_number_config['compiler_options']
> > -            if cc.has_argument(flag)
> > +            if cc.has_multi_arguments(machine_args + [flag])
> >                   machine_args += flag
> >               else
> >                   warning('Configuration compiler option ' +
> 
> 
> Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
> 
> 

Applied with Cc: stable@dpdk.org, thanks.
  

Patch

diff --git a/config/arm/meson.build b/config/arm/meson.build
index 3f22d8a2fc..c3f763764a 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -43,7 +43,9 @@  implementer_generic = {
         },
         'generic_aarch32': {
             'march': 'armv8-a',
-            'compiler_options': ['-mfpu=neon'],
+            'force_march': true,
+            'march_features': ['simd'],
+            'compiler_options': ['-mfpu=auto'],
             'flags': [
                 ['RTE_ARCH_ARM_NEON_MEMCPY', false],
                 ['RTE_ARCH_STRICT_ALIGN', true],
@@ -695,21 +697,25 @@  if update_flags
     # probe supported archs and their features
     candidate_march = ''
     if part_number_config.has_key('march')
-        supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
-                            'armv8.2-a', 'armv8.1-a', 'armv8-a']
-        check_compiler_support = false
-        foreach supported_march: supported_marchs
-            if supported_march == part_number_config['march']
-                # start checking from this version downwards
-                check_compiler_support = true
-            endif
-            if (check_compiler_support and
-                cc.has_argument('-march=' + supported_march))
-                candidate_march = supported_march
-                # highest supported march version found
-                break
-            endif
-        endforeach
+        if part_number_config.get('force_march', false)
+            candidate_march = part_number_config['march']
+        else
+            supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
+                                'armv8.2-a', 'armv8.1-a', 'armv8-a']
+            check_compiler_support = false
+            foreach supported_march: supported_marchs
+                if supported_march == part_number_config['march']
+                    # start checking from this version downwards
+                    check_compiler_support = true
+                endif
+                if (check_compiler_support and
+                    cc.has_argument('-march=' + supported_march))
+                    candidate_march = supported_march
+                    # highest supported march version found
+                    break
+                endif
+            endforeach
+        endif
         if candidate_march == ''
             error('No suitable armv8 march version found.')
         endif
@@ -741,7 +747,7 @@  if update_flags
     # apply supported compiler options
     if part_number_config.has_key('compiler_options')
         foreach flag: part_number_config['compiler_options']
-            if cc.has_argument(flag)
+            if cc.has_multi_arguments(machine_args + [flag])
                 machine_args += flag
             else
                 warning('Configuration compiler option ' +