diff options
author | Andrei Alexeyev <akari@taisei-project.org> | 2020-05-07 05:10:33 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-05-10 20:06:02 +0300 |
commit | c4960cefb00d62fe1ebd89e42a9b82ecfbc2443a (patch) | |
tree | 70304e1b5be96b90a008bf8a6fa6bccfd95a143d /mesonbuild/environment.py | |
parent | d298a00afb4286ce7dfae231c311500e0d3de728 (diff) | |
download | meson-c4960cefb00d62fe1ebd89e42a9b82ecfbc2443a.zip meson-c4960cefb00d62fe1ebd89e42a9b82ecfbc2443a.tar.gz meson-c4960cefb00d62fe1ebd89e42a9b82ecfbc2443a.tar.bz2 |
Improve Emscripten linker version detection
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 64efda6..4ced8e0 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -985,12 +985,15 @@ 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']) + + # emcc requires a file input in order to pass arguments to the + # linker. It'll exit with an error code, but still print the + # linker version. Old emcc versions ignore -Wl,--version completely, + # however. We'll report "unknown version" in that case. + with tempfile.NamedTemporaryFile(suffix='.c') as f: + cmd = compiler + [cls.LINKER_PREFIX + "--version", f.name] + _, o, _ = Popen_safe(cmd) + linker = WASMDynamicLinker( compiler, for_machine, cls.LINKER_PREFIX, [], version=search_version(o)) |