Merge pull request #6455 from makise-homura/elbrus_0.53.0

Elbrus support is broken in 0.53.0, so fixing it
pull/6538/head
Dylan Baker 5 years ago committed by GitHub
commit 3d60665885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      mesonbuild/compilers/c.py
  2. 15
      mesonbuild/compilers/cpp.py
  3. 2
      mesonbuild/compilers/fortran.py
  4. 13
      mesonbuild/compilers/mixins/elbrus.py
  5. 13
      mesonbuild/environment.py
  6. 4
      run_unittests.py

@ -231,10 +231,11 @@ class PGICCompiler(PGICompiler, CCompiler):
class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,
is_cross, info: 'MachineInfo', exe_wrapper=None, defines=None, **kwargs):
is_cross, info: 'MachineInfo', exe_wrapper=None,
defines=None, **kwargs):
GnuCCompiler.__init__(self, exelist, version, for_machine, is_cross,
info, exe_wrapper, defines, **kwargs)
ElbrusCompiler.__init__(self, defines)
ElbrusCompiler.__init__(self)
# It does support some various ISO standards and c/gnu 90, 9x, 1x in addition to those which GNU CC supports.
def get_options(self):

@ -325,7 +325,7 @@ class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler):
GnuCPPCompiler.__init__(self, exelist, version, for_machine,
is_cross, info, exe_wrapper, defines,
**kwargs)
ElbrusCompiler.__init__(self, defines)
ElbrusCompiler.__init__(self)
# It does not support c++/gnu++ 17 and 1z, but still does support 0x, 1y, and gnu++98.
def get_options(self):
@ -351,6 +351,19 @@ class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler):
extra_args=extra_args,
dependencies=dependencies)
# Elbrus C++ compiler does not support RTTI, so don't check for it.
def get_option_compile_args(self, options):
args = []
std = options['cpp_std']
if std.value != 'none':
args.append(self._find_best_cpp_std(std.value))
non_msvc_eh_options(options['cpp_eh'].value, args)
if options['cpp_debugstl'].value:
args.append('-D_GLIBCXX_DEBUG=1')
return args
class IntelCPPCompiler(IntelGnuLikeCompiler, CPPCompiler):
def __init__(self, exelist, version, for_machine: MachineChoice,

@ -215,7 +215,7 @@ class ElbrusFortranCompiler(GnuFortranCompiler, ElbrusCompiler):
GnuFortranCompiler.__init__(self, exelist, version, for_machine,
is_cross, info, exe_wrapper, defines,
**kwargs)
ElbrusCompiler.__init__(self, defines)
ElbrusCompiler.__init__(self)
class G95FortranCompiler(FortranCompiler):

@ -20,6 +20,7 @@ import subprocess
import re
from .gnu import GnuLikeCompiler
from .gnu import gnu_optimization_args
from ...mesonlib import Popen_safe
if T.TYPE_CHECKING:
@ -29,7 +30,7 @@ if T.TYPE_CHECKING:
class ElbrusCompiler(GnuLikeCompiler):
# Elbrus compiler is nearly like GCC, but does not support
# PCH, LTO, sanitizers and color output as of version 1.21.x.
def __init__(self, defines: T.Dict[str, str]):
def __init__(self):
super().__init__()
self.id = 'lcc'
self.base_options = ['b_pgo', 'b_coverage',
@ -70,3 +71,13 @@ class ElbrusCompiler(GnuLikeCompiler):
if line.lstrip().startswith('--sys_include'):
includes.append(re.sub(r'\s*\\$', '', re.sub(r'^\s*--sys_include\s*', '', line)))
return includes
def get_optimization_args(self, optimization_level: str) -> T.List[str]:
return gnu_optimization_args[optimization_level]
def get_pch_suffix(self) -> str:
# Actually it's not supported for now, but probably will be supported in future
return 'pch'
def openmp_flags(self) -> T.List[str]:
return ['-fopenmp']

@ -585,12 +585,20 @@ class Environment:
self.default_objc = ['cc', 'gcc']
self.default_objcpp = ['c++', 'g++']
self.default_cs = ['csc', 'mcs']
else:
if platform.machine().lower() == 'e2k':
# There are no objc or objc++ compilers for Elbrus,
# and there's no clang which can build binaries for host.
self.default_c = ['cc', 'gcc', 'lcc']
self.default_cpp = ['c++', 'g++', 'l++']
self.default_objc = []
self.default_objcpp = []
else:
self.default_c = ['cc', 'gcc', 'clang', 'pgcc', 'icc']
self.default_cpp = ['c++', 'g++', 'clang++', 'pgc++', 'icpc']
self.default_fortran = ['gfortran', 'flang', 'pgfortran', 'ifort', 'g95']
self.default_objc = ['cc', 'gcc', 'clang']
self.default_objcpp = ['c++', 'g++', 'clang++']
self.default_fortran = ['gfortran', 'flang', 'pgfortran', 'ifort', 'g95']
self.default_cs = ['mcs', 'csc']
self.default_d = ['ldc2', 'ldc', 'gdc', 'dmd']
self.default_java = ['javac']
@ -939,6 +947,7 @@ class Environment:
cls = GnuCCompiler if lang == 'c' else GnuCPPCompiler
linker = self._guess_nix_linker(compiler, cls, for_machine)
return cls(
ccache + compiler, version, for_machine, is_cross,
info, exe_wrap, defines, full_version=full_version,
@ -1258,7 +1267,7 @@ class Environment:
popen_exceptions[' '.join(compiler + arg)] = e
continue
version = search_version(out)
if 'Free Software Foundation' in out or ('e2k' in out and 'lcc' in out):
if 'Free Software Foundation' in out:
defines = self.get_gnu_compiler_defines(compiler)
if not defines:
popen_exceptions[' '.join(compiler)] = 'no pre-processor defines'

@ -2290,7 +2290,7 @@ class AllPlatformTests(BasePlatformTests):
ar = mesonbuild.linkers.ArLinker
lib = mesonbuild.linkers.VisualStudioLinker
langs = [('c', 'CC'), ('cpp', 'CXX')]
if not is_windows():
if not is_windows() and platform.machine().lower() != 'e2k':
langs += [('objc', 'OBJC'), ('objcpp', 'OBJCXX')]
testdir = os.path.join(self.unit_test_dir, '5 compiler detection')
env = get_fake_env(testdir, self.builddir, self.prefix)
@ -3087,6 +3087,8 @@ int main(int argc, char **argv) {
pass
try:
env.detect_fortran_compiler(MachineChoice.HOST)
if is_windows() or platform.machine().lower() != 'e2k':
# Elbrus Fortran compiler can't generate debug information
langs.append('fortran')
except EnvironmentException:
pass

Loading…
Cancel
Save