Do not use -soname when linking with GCC for mingw/cygwin

GNU LD does not use soname when linking a PE/COFF binary, so it makes no
difference, but it breaks when using the llvm linker (lld), which does
not support the soname flag when building PE/COFF binaries for Windows.

Fix #3179
pull/3157/merge
Marvin Scholz 7 years ago committed by Nirbheek Chauhan
parent eadaf92794
commit 5e45f4c621
  1. 6
      mesonbuild/compilers/compilers.py

@ -944,9 +944,11 @@ def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, i
sostr = '' sostr = ''
else: else:
sostr = '.' + soversion sostr = '.' + soversion
if gcc_type in (GCC_STANDARD, GCC_MINGW, GCC_CYGWIN): if gcc_type == GCC_STANDARD:
# Might not be correct for mingw but seems to work.
return ['-Wl,-soname,%s%s.%s%s' % (prefix, shlib_name, suffix, sostr)] return ['-Wl,-soname,%s%s.%s%s' % (prefix, shlib_name, suffix, sostr)]
elif gcc_type in (GCC_MINGW, GCC_CYGWIN):
# For PE/COFF the soname argument has no effect with GNU LD
return []
elif gcc_type == GCC_OSX: elif gcc_type == GCC_OSX:
if is_shared_module: if is_shared_module:
return [] return []

Loading…
Cancel
Save