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

Message ID 20230921095916.344076-1-juraj.linkes@pantheon.tech (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v1] 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/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing fail Testing issues
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Juraj Linkeš Sept. 21, 2023, 9:59 a.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 without the -mpfu option, which
is required for aarch32 build with gcc13.

On top of that, the most recent recommendation from the compiler team to
build with -march=armv8-a+simd -mfpu=auto.

We can address this by first testing compiler options and only test the
march after that (coupled with supported options). This doesn't fully
work though, as just -march=armv8 in not enough to be accepted with
-mfpu=auto. To address this other issue, add the force_march parameter
to part number config which will force the configured march to be used,
even if the compiler doesn't support the particular combination of march
and other compiler options, such as mfpu. This then allows the check to
proceed to the -march=armv8-a+simd -mfpu=auto, which is valid.

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

Patch

diff --git a/config/arm/meson.build b/config/arm/meson.build
index 3f22d8a2fc..0b42d74876 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],
@@ -692,6 +694,19 @@  if update_flags
 
     machine_args = [] # Clear previous machine args
 
+    # test supported compiler options
+    compiler_options = []
+    if part_number_config.has_key('compiler_options')
+        foreach flag: part_number_config['compiler_options']
+            if cc.has_argument(flag)
+                compiler_options += flag
+            else
+                warning('Configuration compiler option ' +
+                        '@0@ isn\'t supported.'.format(flag))
+            endif
+        endforeach
+    endif
+
     # probe supported archs and their features
     candidate_march = ''
     if part_number_config.has_key('march')
@@ -704,14 +719,18 @@  if update_flags
                 check_compiler_support = true
             endif
             if (check_compiler_support and
-                cc.has_argument('-march=' + supported_march))
+                cc.has_multi_arguments('-march=' + supported_march, compiler_options))
                 candidate_march = supported_march
                 # highest supported march version found
                 break
             endif
         endforeach
         if candidate_march == ''
-            error('No suitable armv8 march version found.')
+            if part_number_config.get('force_march', false)
+                candidate_march = part_number_config['march']
+            else
+                error('No suitable armv8 march version found.')
+            endif
         endif
         if candidate_march != part_number_config['march']
             warning('Configuration march version is ' +
@@ -728,27 +747,16 @@  if update_flags
             march_features += soc_config['extra_march_features']
         endif
         foreach feature: march_features
-            if cc.has_argument('+'.join([candidate_march, feature]))
+            if cc.has_multi_arguments('+'.join([candidate_march, feature]), compiler_options)
                 candidate_march = '+'.join([candidate_march, feature])
             else
                 warning('The compiler does not support feature @0@'
                     .format(feature))
             endif
         endforeach
-        machine_args += candidate_march
     endif
 
-    # apply supported compiler options
-    if part_number_config.has_key('compiler_options')
-        foreach flag: part_number_config['compiler_options']
-            if cc.has_argument(flag)
-                machine_args += flag
-            else
-                warning('Configuration compiler option ' +
-                        '@0@ isn\'t supported.'.format(flag))
-            endif
-        endforeach
-    endif
+    machine_args += [candidate_march] + compiler_options
 
     # apply flags
     foreach flag: dpdk_flags