diff --git a/build/macosx/cross-mozconfig.common b/build/macosx/cross-mozconfig.common index 4c528822c020..636171a59f02 100644 --- a/build/macosx/cross-mozconfig.common +++ b/build/macosx/cross-mozconfig.common @@ -24,7 +24,6 @@ CROSS_PRIVATE_FRAMEWORKS=$CROSS_SYSROOT/System/Library/PrivateFrameworks export CC="$topsrcdir/clang/bin/clang" export CXX="$topsrcdir/clang/bin/clang++" export LLVMCONFIG=$topsrcdir/clang/bin/llvm-config -export LDFLAGS="-Wl,-syslibroot,$CROSS_SYSROOT" export BINDGEN_CFLAGS="-isysroot $CROSS_SYSROOT" export DSYMUTIL=$topsrcdir/build/macosx/llvm-dsymutil mk_add_options "export REAL_DSYMUTIL=$topsrcdir/llvm-dsymutil/bin/dsymutil" diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index 5b073bbe23a5..8c307ff5fa50 100755 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -1892,7 +1892,21 @@ def select_linker(linker, c_compiler, developer_options, enable_gold, set_config('LINKER_KIND', select_linker.KIND) -add_old_configure_assignment('LINKER_LDFLAGS', select_linker.LINKER_FLAG) + + +@depends_if(select_linker, macos_sdk) +def linker_ldflags(linker, macos_sdk): + flags = list(linker.LINKER_FLAG or []) + if macos_sdk: + if linker.KIND == 'ld64': + flags.append('-Wl,-syslibroot,%s' % macos_sdk) + else: + flags.append('-Wl,--sysroot=%s' % macos_sdk) + + return flags + + +add_old_configure_assignment('LINKER_LDFLAGS', linker_ldflags) # There's a wrinkle with MinGW: linker configuration is not enabled, so