aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-03-10 10:13:23 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-03-11 09:27:10 -0700
commitd0172432a7eb95f1f5d16825d4440bc7e2da758f (patch)
tree927a6060cec2c1c29bccbef9da4002382ad0dbc7 /mesonbuild/compilers/compilers.py
parent92e80d54e531dbf89b8cb74b2e54ee6f8f9f896b (diff)
downloadmeson-d0172432a7eb95f1f5d16825d4440bc7e2da758f.zip
meson-d0172432a7eb95f1f5d16825d4440bc7e2da758f.tar.gz
meson-d0172432a7eb95f1f5d16825d4440bc7e2da758f.tar.bz2
compilers: Don't put split soname args in start groups
Some compilers that act as linker drivers (dmd and ldc) need to split arguments that GCC combines with , (ie, -Wl,-foo,bar -> -L=-foo -L=bar). As such we need to detect that the previous argument contained -soname, and not wrap that in a --start-group/--end-group This modifies the shared library test to demonstrate the problem, with a test case. Fixes #6359
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 436b09d..03c7a6f 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -569,7 +569,17 @@ class CompilerArgs(collections.abc.MutableSequence):
isinstance(self.compiler.linker, (GnuLikeDynamicLinkerMixin, SolarisDynamicLinker))):
group_start = -1
group_end = -1
+ is_soname = False
for i, each in enumerate(new):
+ if is_soname:
+ is_soname = False
+ continue
+ elif '-soname' in each:
+ # To proxy these arguments with D you need to split the
+ # arguments, thus you get `-L=-soname -L=lib.so` we don't
+ # want to put the lib in a link -roup
+ is_soname = True
+ continue
if not each.startswith(('-Wl,-l', '-l')) and not each.endswith('.a') and \
not soregex.match(each):
continue