environment: correctly handle cpu value aarch64_be

Fixes #9191
pull/9193/head
Dylan Baker 3 years ago
parent 78f8a286d0
commit f073c3cfe1
  1. 8
      mesonbuild/environment.py
  2. 4
      unittests/internaltests.py

@ -314,6 +314,9 @@ def detect_cpu_family(compilers: CompilersDict) -> str:
trial = 'x86'
elif trial == 'arm64':
trial = 'aarch64'
elif trial.startswith('aarch64'):
# This can be `aarch64_be`
trial = 'aarch64'
elif trial.startswith('arm') or trial.startswith('earm'):
trial = 'arm'
elif trial.startswith(('powerpc64', 'ppc64')):
@ -373,10 +376,13 @@ def detect_cpu(compilers: CompilersDict) -> str:
# Same check as above for cpu_family
if any_compiler_has_define(compilers, '__i386__'):
trial = 'i686' # All 64 bit cpus have at least this level of x86 support.
elif trial == 'aarch64':
elif trial.startswith('aarch64'):
# Same check as above for cpu_family
if any_compiler_has_define(compilers, '__arm__'):
trial = 'arm'
else:
# for aarch64_be
trial = 'aarch64'
elif trial.startswith('earm'):
trial = 'arm'
elif trial == 'e2k':

@ -1465,6 +1465,8 @@ class InternalTests(unittest.TestCase):
('amd64', 'x86_64'),
('x64', 'x86_64'),
('i86pc', 'x86_64'), # Solaris
('aarch64', 'aarch64'),
('aarch64_be', 'aarch64'),
]
with mock.patch('mesonbuild.environment.any_compiler_has_define', mock.Mock(return_value=False)):
@ -1500,6 +1502,8 @@ class InternalTests(unittest.TestCase):
('mips64', 'mips64'),
('mips', 'mips'),
('mipsel', 'mips'),
('aarch64', 'aarch64'),
('aarch64_be', 'aarch64'),
]
with mock.patch('mesonbuild.environment.any_compiler_has_define', mock.Mock(return_value=False)):

Loading…
Cancel
Save