aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-02-25 11:36:31 -0800
committerDylan Baker <dylan@pnwbakers.com>2020-02-27 16:35:02 -0800
commit654f427759d5aa3be55d8929b18c17a2b8fcac69 (patch)
tree9674ab5e7276344a6f1b1c5e9028744633a00ef3 /mesonbuild/environment.py
parent771b0d3ffbc7b034b436d4ad27be7d0a1da6b3cd (diff)
downloadmeson-654f427759d5aa3be55d8929b18c17a2b8fcac69.zip
meson-654f427759d5aa3be55d8929b18c17a2b8fcac69.tar.gz
meson-654f427759d5aa3be55d8929b18c17a2b8fcac69.tar.bz2
compilers/linkers: Add a representation for wasm-ld
Emscripten does have a stand alone linker, wasm-ld. This patch adds the linker, adds detection for the linker, and removes the IsLinkerMixin for emscripten. This is a little more correct, and makes the code a lot cleaner and more robust.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 46bbea0..9e30f47 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -58,6 +58,7 @@ from .linkers import (
XilinkDynamicLinker,
CudaLinker,
VisualStudioLikeLinkerMixin,
+ WASMDynamicLinker,
)
from functools import lru_cache
from .compilers import (
@@ -957,9 +958,18 @@ class Environment:
if 'Emscripten' in out:
cls = EmscriptenCCompiler if lang == 'c' else EmscriptenCPPCompiler
self.coredata.add_lang_args(cls.language, cls, for_machine, self)
+ # emcc cannot be queried to get the version out of it (it
+ # ignores -Wl,--version and doesn't have an alternative).
+ # Further, wasm-id *is* lld and will return `LLD X.Y.Z` if you
+ # call `wasm-ld --version`, but a special version of lld that
+ # takes different options.
+ p, o, _ = Popen_safe(['wasm-ld', '--version'])
+ linker = WASMDynamicLinker(
+ compiler, for_machine, cls.LINKER_PREFIX,
+ [], version=search_version(o))
return cls(
ccache + compiler, version, for_machine, is_cross, info,
- exe_wrap, full_version=full_version)
+ exe_wrap, linker=linker, full_version=full_version)
if 'armclang' in out:
# The compiler version is not present in the first line of output,