aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/linkers.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/linkers.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/linkers.py')
-rw-r--r--mesonbuild/linkers.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index 489525b..73cdeef 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -693,6 +693,35 @@ class LLVMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dyna
return []
+class WASMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker):
+
+ """Emscripten's wasm-ld."""
+
+ def __init__(self, *args, **kwargs):
+ super().__init__('ld.wasm', *args, **kwargs)
+
+ def thread_link_flags(self, env: 'Environment') -> T.List[str]:
+ args = ['-s', 'USE_PTHREADS=1']
+ count = env.coredata.compiler_options[self.for_machine]['{}_thread_count'.format(self.language)].value # type: int
+ if count:
+ args.extend(['-s', 'PTHREAD_POOL_SIZE={}'.format(count)])
+ return args
+
+ def get_allow_undefined_args(self) -> T.List[str]:
+ return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0']
+
+ def no_undefined_args(self) -> T.List[str]:
+ return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=1']
+
+ def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
+ suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
+ is_shared_module: bool) -> T.List[str]:
+ raise mesonlib.MesonException('{} does not support shared libraries.'.format(self.id))
+
+ def get_asneeded_args(self) -> T.List[str]:
+ return []
+
+
class CcrxDynamicLinker(DynamicLinker):
"""Linker for Renesis CCrx compiler."""