diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2021-07-14 22:45:13 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-07-14 22:53:04 +0200 |
commit | d5535065bc1559968ee76a1c08b05ebe5e636c4d (patch) | |
tree | 4d96db3a55e098fcbbd1fd844717580ca6bb5aa2 | |
parent | c7a0c5cde4284d5c4fdd0bdf249f95144daad5a6 (diff) | |
download | meson-d5535065bc1559968ee76a1c08b05ebe5e636c4d.zip meson-d5535065bc1559968ee76a1c08b05ebe5e636c4d.tar.gz meson-d5535065bc1559968ee76a1c08b05ebe5e636c4d.tar.bz2 |
do not add SONAME to shared modules
For an ELF targets, shared_module() builds a module with SONAME field
(using -Wl,-soname argument). This is wrong: only the shared_library()
needs SONAME, while shared_module() does not. Moreover, tools such as
debian's dpkg-shlibdeps use presence of SONAME field as an indicator
that this is shared library as opposed to shared module (e.g., for the
module it is okay to have unresolved symbols which are imported from
the executable which loads the module, while a library should have all
symbols resolved).
This was in fact already the behavior on Darwin; extend it to ELF
targets as well.
Fixes: #8746
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 11 | ||||
-rw-r--r-- | mesonbuild/linkers/linkers.py | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 44e5228..fdaa040 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2757,11 +2757,12 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) commands += linker.get_std_shared_lib_link_args() # All shared libraries are PIC commands += linker.get_pic_args() - # Add -Wl,-soname arguments on Linux, -install_name on OS X - commands += linker.get_soname_args( - self.environment, target.prefix, target.name, target.suffix, - target.soversion, target.darwin_versions, - isinstance(target, build.SharedModule)) + if not isinstance(target, build.SharedModule): + # Add -Wl,-soname arguments on Linux, -install_name on OS X + commands += linker.get_soname_args( + self.environment, target.prefix, target.name, target.suffix, + target.soversion, target.darwin_versions, + isinstance(target, build.SharedModule)) # This is only visited when building for Windows using either GCC or Visual Studio if target.vs_module_defs and hasattr(linker, 'gen_vs_module_defs_args'): commands += linker.gen_vs_module_defs_args(target.vs_module_defs.rel_to_builddir(self.build_to_src)) diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py index c26edda..0aa4105 100644 --- a/mesonbuild/linkers/linkers.py +++ b/mesonbuild/linkers/linkers.py @@ -751,8 +751,6 @@ class AppleDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): 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]: - if is_shared_module: - return [] install_name = ['@rpath/', prefix, shlib_name] if soversion is not None: install_name.append('.' + soversion) |