|
|
@ -33,6 +33,8 @@ from ..linkers import ( |
|
|
|
CompCertDynamicLinker, |
|
|
|
CompCertDynamicLinker, |
|
|
|
C2000Linker, |
|
|
|
C2000Linker, |
|
|
|
C2000DynamicLinker, |
|
|
|
C2000DynamicLinker, |
|
|
|
|
|
|
|
TILinker, |
|
|
|
|
|
|
|
TIDynamicLinker, |
|
|
|
DLinker, |
|
|
|
DLinker, |
|
|
|
NAGDynamicLinker, |
|
|
|
NAGDynamicLinker, |
|
|
|
NvidiaHPC_DynamicLinker, |
|
|
|
NvidiaHPC_DynamicLinker, |
|
|
@ -68,6 +70,7 @@ from .c import ( |
|
|
|
Xc16CCompiler, |
|
|
|
Xc16CCompiler, |
|
|
|
CompCertCCompiler, |
|
|
|
CompCertCCompiler, |
|
|
|
C2000CCompiler, |
|
|
|
C2000CCompiler, |
|
|
|
|
|
|
|
TICCompiler, |
|
|
|
VisualStudioCCompiler, |
|
|
|
VisualStudioCCompiler, |
|
|
|
) |
|
|
|
) |
|
|
|
from .cpp import ( |
|
|
|
from .cpp import ( |
|
|
@ -87,6 +90,7 @@ from .cpp import ( |
|
|
|
PGICPPCompiler, |
|
|
|
PGICPPCompiler, |
|
|
|
CcrxCPPCompiler, |
|
|
|
CcrxCPPCompiler, |
|
|
|
C2000CPPCompiler, |
|
|
|
C2000CPPCompiler, |
|
|
|
|
|
|
|
TICPPCompiler, |
|
|
|
VisualStudioCPPCompiler, |
|
|
|
VisualStudioCPPCompiler, |
|
|
|
) |
|
|
|
) |
|
|
|
from .cs import MonoCompiler, VisualStudioCsCompiler |
|
|
|
from .cs import MonoCompiler, VisualStudioCsCompiler |
|
|
@ -295,9 +299,11 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker |
|
|
|
linkers = default_linkers |
|
|
|
linkers = default_linkers |
|
|
|
popen_exceptions = {} |
|
|
|
popen_exceptions = {} |
|
|
|
for linker in linkers: |
|
|
|
for linker in linkers: |
|
|
|
if not {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'}.isdisjoint(linker): |
|
|
|
linker_name = os.path.basename(linker[0]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if any(os.path.basename(x) in {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'} for x in linker): |
|
|
|
arg = '/?' |
|
|
|
arg = '/?' |
|
|
|
elif not {'ar2000', 'ar2000.exe'}.isdisjoint(linker): |
|
|
|
elif linker_name in {'ar2000', 'ar2000.exe', 'ar430', 'ar430.exe', 'armar', 'armar.exe'}: |
|
|
|
arg = '?' |
|
|
|
arg = '?' |
|
|
|
else: |
|
|
|
else: |
|
|
|
arg = '--version' |
|
|
|
arg = '--version' |
|
|
@ -312,7 +318,7 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker |
|
|
|
return VisualStudioLinker(linker, getattr(compiler, 'machine', None)) |
|
|
|
return VisualStudioLinker(linker, getattr(compiler, 'machine', None)) |
|
|
|
if 'ar-Error-Unknown switch: --version' in err: |
|
|
|
if 'ar-Error-Unknown switch: --version' in err: |
|
|
|
return PGIStaticLinker(linker) |
|
|
|
return PGIStaticLinker(linker) |
|
|
|
if p.returncode == 0 and ('armar' in linker or 'armar.exe' in linker): |
|
|
|
if p.returncode == 0 and 'armar' in linker_name: |
|
|
|
return ArmarLinker(linker) |
|
|
|
return ArmarLinker(linker) |
|
|
|
if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out: |
|
|
|
if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out: |
|
|
|
assert isinstance(compiler, DCompiler) |
|
|
|
assert isinstance(compiler, DCompiler) |
|
|
@ -323,12 +329,15 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker |
|
|
|
if 'GDC' in out and ' based on D ' in out: |
|
|
|
if 'GDC' in out and ' based on D ' in out: |
|
|
|
assert isinstance(compiler, DCompiler) |
|
|
|
assert isinstance(compiler, DCompiler) |
|
|
|
return DLinker(linker, compiler.arch) |
|
|
|
return DLinker(linker, compiler.arch) |
|
|
|
if err.startswith('Renesas') and ('rlink' in linker or 'rlink.exe' in linker): |
|
|
|
if err.startswith('Renesas') and 'rlink' in linker_name: |
|
|
|
return CcrxLinker(linker) |
|
|
|
return CcrxLinker(linker) |
|
|
|
if out.startswith('GNU ar') and ('xc16-ar' in linker or 'xc16-ar.exe' in linker): |
|
|
|
if out.startswith('GNU ar') and 'xc16-ar' in linker_name: |
|
|
|
return Xc16Linker(linker) |
|
|
|
return Xc16Linker(linker) |
|
|
|
if out.startswith('TMS320C2000') and ('ar2000' in linker or 'ar2000.exe' in linker): |
|
|
|
if 'Texas Instruments Incorporated' in out: |
|
|
|
return C2000Linker(linker) |
|
|
|
if 'ar2000' in linker_name: |
|
|
|
|
|
|
|
return C2000Linker(linker) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
return TILinker(linker) |
|
|
|
if out.startswith('The CompCert'): |
|
|
|
if out.startswith('The CompCert'): |
|
|
|
return CompCertLinker(linker) |
|
|
|
return CompCertLinker(linker) |
|
|
|
if p.returncode == 0: |
|
|
|
if p.returncode == 0: |
|
|
@ -397,7 +406,8 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin |
|
|
|
arg = '--version' |
|
|
|
arg = '--version' |
|
|
|
elif 'ccomp' in compiler_name: |
|
|
|
elif 'ccomp' in compiler_name: |
|
|
|
arg = '-version' |
|
|
|
arg = '-version' |
|
|
|
elif 'cl2000' in compiler_name: |
|
|
|
elif compiler_name in {'cl2000', 'cl2000.exe', 'cl430', 'cl430.exe', 'armcl', 'armcl.exe'}: |
|
|
|
|
|
|
|
# TI compiler |
|
|
|
arg = '-version' |
|
|
|
arg = '-version' |
|
|
|
elif compiler_name in {'icl', 'icl.exe'}: |
|
|
|
elif compiler_name in {'icl', 'icl.exe'}: |
|
|
|
# if you pass anything to icl you get stuck in a pager |
|
|
|
# if you pass anything to icl you get stuck in a pager |
|
|
@ -602,6 +612,20 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin |
|
|
|
return cls( |
|
|
|
return cls( |
|
|
|
ccache + compiler, version, for_machine, is_cross, info, |
|
|
|
ccache + compiler, version, for_machine, is_cross, info, |
|
|
|
exe_wrap, full_version=full_version, linker=l) |
|
|
|
exe_wrap, full_version=full_version, linker=l) |
|
|
|
|
|
|
|
if 'TMS320C2000 C/C++' in out or 'MSP430 C/C++' in out or 'TI ARM C/C++ Compiler' in out: |
|
|
|
|
|
|
|
lnk : T.Union[T.Type[C2000DynamicLinker], T.Type[TIDynamicLinker]] |
|
|
|
|
|
|
|
if 'TMS320C2000 C/C++' in out: |
|
|
|
|
|
|
|
cls = C2000CCompiler if lang == 'c' else C2000CPPCompiler |
|
|
|
|
|
|
|
lnk = C2000DynamicLinker |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
cls = TICCompiler if lang == 'c' else TICPPCompiler |
|
|
|
|
|
|
|
lnk = TIDynamicLinker |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
env.coredata.add_lang_args(cls.language, cls, for_machine, env) |
|
|
|
|
|
|
|
linker = lnk(compiler, for_machine, version=version) |
|
|
|
|
|
|
|
return cls( |
|
|
|
|
|
|
|
ccache + compiler, version, for_machine, is_cross, info, |
|
|
|
|
|
|
|
exe_wrap, full_version=full_version, linker=linker) |
|
|
|
if 'ARM' in out: |
|
|
|
if 'ARM' in out: |
|
|
|
cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler |
|
|
|
cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler |
|
|
|
env.coredata.add_lang_args(cls.language, cls, for_machine, env) |
|
|
|
env.coredata.add_lang_args(cls.language, cls, for_machine, env) |
|
|
@ -633,14 +657,6 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin |
|
|
|
ccache + compiler, version, for_machine, is_cross, info, |
|
|
|
ccache + compiler, version, for_machine, is_cross, info, |
|
|
|
exe_wrap, full_version=full_version, linker=linker) |
|
|
|
exe_wrap, full_version=full_version, linker=linker) |
|
|
|
|
|
|
|
|
|
|
|
if 'TMS320C2000 C/C++' in out: |
|
|
|
|
|
|
|
cls = C2000CCompiler if lang == 'c' else C2000CPPCompiler |
|
|
|
|
|
|
|
env.coredata.add_lang_args(cls.language, cls, for_machine, env) |
|
|
|
|
|
|
|
linker = C2000DynamicLinker(compiler, for_machine, version=version) |
|
|
|
|
|
|
|
return cls( |
|
|
|
|
|
|
|
ccache + compiler, version, for_machine, is_cross, info, |
|
|
|
|
|
|
|
exe_wrap, full_version=full_version, linker=linker) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_handle_exceptions(popen_exceptions, compilers) |
|
|
|
_handle_exceptions(popen_exceptions, compilers) |
|
|
|
raise EnvironmentException(f'Unknown compiler {compilers}') |
|
|
|
raise EnvironmentException(f'Unknown compiler {compilers}') |
|
|
|
|
|
|
|
|
|
|
|