aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2019-12-16 11:31:24 -0800
committerDylan Baker <dylan@pnwbakers.com>2020-03-06 12:11:26 -0800
commitf404c679cf292e6a7cf3886cd94511602c1c09f9 (patch)
treec607aaa87fd91e712637577032907c9001c06168 /mesonbuild/compilers
parentc0fd20f164609b8c3be516b5be3d70a4b9ff6f49 (diff)
downloadmeson-f404c679cf292e6a7cf3886cd94511602c1c09f9.zip
meson-f404c679cf292e6a7cf3886cd94511602c1c09f9.tar.gz
meson-f404c679cf292e6a7cf3886cd94511602c1c09f9.tar.bz2
compilers/d: Fix get_allow_undefined_link_args on macOS
DMD and LDC are a real pain to use as linkers. On Unices they invoke the C compiler as the linker, just like meson does. This means we have to figure out what C compiler they're using and try to pass valid arguments to that compiler if the D compiler doesn't understand the linker arguments we want to pass. In this case that means gcc or clang. We can use-the -Xcc to pass arguments directly to the C compiler without dmd/ldc getting involved, so we'll use that.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/d.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
index 99889b0..5759f33 100644
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -395,6 +395,17 @@ class DmdLikeCompilerMixin:
soargs.append('-L=' + arg)
return soargs
+ def get_allow_undefined_link_args(self) -> T.List[str]:
+ args = self.linker.get_allow_undefined_args()
+ if self.info.is_darwin():
+ # On macOS we're passing these options to the C compiler, but
+ # they're linker options and need -Wl, so clang/gcc knows what to
+ # do with them. I'm assuming, but don't know for certain, that
+ # ldc/dmd do some kind of mapping internally for arguments they
+ # understand, but pass arguments they don't understand directly.
+ args = [a.replace('-L=', '-Xcc=-Wl,') for a in args]
+ return args
+
class DCompiler(Compiler):
mscrt_args = {