From d0172432a7eb95f1f5d16825d4440bc7e2da758f Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 10 Mar 2020 10:13:23 -0700 Subject: 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 --- mesonbuild/compilers/compilers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mesonbuild/compilers') 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 -- cgit v1.1