[PATCH v5 1/3] config/arm: avoid mcpu and march conflicts
Juraj Linkeš
juraj.linkes at pantheon.tech
Fri Feb 23 12:19:25 CET 2024
Other than the one point below,
Reviewed-by: Juraj Linkeš <juraj.linkes at pantheon.tech>
> diff --git a/config/arm/meson.build b/config/arm/meson.build
> index 36f21d2259..d05d54b564 100644
> --- a/config/arm/meson.build
> +++ b/config/arm/meson.build
<snip>
> @@ -695,13 +698,37 @@ if update_flags
>
> machine_args = [] # Clear previous machine args
>
> - # probe supported archs and their features
> + march_features = []
> + if part_number_config.has_key('march_features')
> + march_features += part_number_config['march_features']
> + endif
> + if soc_config.has_key('extra_march_features')
> + march_features += soc_config['extra_march_features']
> + endif
> +
> + candidate_mcpu = ''
> candidate_march = ''
> - if part_number_config.has_key('march')
> +
> + if part_number_config.has_key('mcpu') and
> + cc.has_argument('-mcpu=' + part_number_config['mcpu'])
> + candidate_mcpu = '-mcpu=' + part_number_config['mcpu']
> + foreach feature: march_features
> + if cc.has_argument('+'.join([candidate_mcpu, feature]))
> + candidate_mcpu = '+'.join([candidate_mcpu, feature])
> + else
> + warning('The compiler does not support feature @0@'
> + .format(feature))
> + endif
> + endforeach
> + machine_args += candidate_mcpu
> + elif part_number_config.has_key('march')
> + # probe supported archs and their features
> if part_number_config.get('force_march', false)
> - candidate_march = part_number_config['march']
> + if cc.has_argument('-march=' + part_number_config['march'])
> + candidate_march = part_number_config['march']
> + endif
The check was omitted here by design because aarch32 builds with some
compilers don't support -march=armv8-a alone, only with -mfpu= as
well.
> else
> - supported_marchs = ['armv8.6-a', 'armv8.5-a', 'armv8.4-a', 'armv8.3-a',
> + supported_marchs = ['armv9-a', '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
> @@ -717,32 +744,31 @@ if update_flags
> endif
> endforeach
> endif
> - if candidate_march == ''
> - error('No suitable armv8 march version found.')
> - endif
> +
> if candidate_march != part_number_config['march']
> - warning('Configuration march version is ' +
> - '@0@, but the compiler supports only @1 at .'
> - .format(part_number_config['march'], candidate_march))
> + warning('Configuration march version is @0@, not supported.'
> + .format(part_number_config['march']))
> + if candidate_march != ''
> + warning('Using march version @0 at .'.format(candidate_march))
> + endif
> endif
> - candidate_march = '-march=' + candidate_march
>
> - march_features = []
> - if part_number_config.has_key('march_features')
> - march_features += part_number_config['march_features']
> - endif
> - if soc_config.has_key('extra_march_features')
> - march_features += soc_config['extra_march_features']
> + if candidate_march != ''
> + candidate_march = '-march=' + candidate_march
> + foreach feature: march_features
> + if cc.has_argument('+'.join([candidate_march, feature]))
> + candidate_march = '+'.join([candidate_march, feature])
> + else
> + warning('The compiler does not support feature @0@'
> + .format(feature))
> + endif
> + endforeach
> + machine_args += candidate_march
> endif
> - foreach feature: march_features
> - if cc.has_argument('+'.join([candidate_march, feature]))
> - candidate_march = '+'.join([candidate_march, feature])
> - else
> - warning('The compiler does not support feature @0@'
> - .format(feature))
> - endif
> - endforeach
> - machine_args += candidate_march
> + endif
> +
> + if candidate_mcpu == '' and candidate_march == ''
> + error('No suitable ARM march/mcpu version found.')
> endif
>
> # apply supported compiler options
> --
> 2.25.1
>
More information about the dev
mailing list