Only split linker args with D compilers. Closes:
@@ -568,6 +568,9 @@ class CompilerArgs(collections.abc.MutableSequence):
return True
return False
+ def need_to_split_linker_args(self):
+ return isinstance(self.compiler, Compiler) and self.compiler.get_language() == 'd'
+
def to_native(self, copy: bool = False) -> T.List[str]:
# Check if we need to add --start/end-group for circular dependencies
# between static libraries, and for recursively searching for symbols
@@ -577,6 +580,10 @@ class CompilerArgs(collections.abc.MutableSequence):
new = self.copy()
else:
new = self
+ # 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
+ split_linker_args = self.need_to_split_linker_args()
# This covers all ld.bfd, ld.gold, ld.gold, and xild on Linux, which
# all act like (or are) gnu ld
# TODO: this could probably be added to the DynamicLinker instead
@@ -590,10 +597,7 @@ class CompilerArgs(collections.abc.MutableSequence):
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
+ elif split_linker_args and '-soname' in each:
is_soname = True
continue
if not each.startswith(('-Wl,-l', '-l')) and not each.endswith('.a') and \
