diff --git a/build/moz.configure/flags.configure b/build/moz.configure/flags.configure index b67c2ab3c3a5..86f6befeb042 100644 --- a/build/moz.configure/flags.configure +++ b/build/moz.configure/flags.configure @@ -589,6 +589,20 @@ def host_cflags(base_cxxflags, compilation_flags, host_common_flags): return flags +@depends("HOST_LDFLAGS", linker_flags, host_linker_ldflags, host, host_c_compiler) +@imports(_from="mozbuild.shellutil", _import="split") +def host_ldflags(env_ldflags, linker_flags, host_linker_ldflags, host, compiler): + flags = split(env_ldflags[0]) + flags += host_linker_ldflags + if host.kernel == "WINNT" and compiler.type == "clang-cl": + if host.cpu == "x86": + flags += ["-MACHINE:X86"] + elif host.cpu == "x86_64": + flags += ["-MACHINE:X64"] + flags += linker_flags.host_ldflags + return flags + + # Please keep these last in this file. add_old_configure_assignment("_COMPILATION_ASFLAGS", asm_flags.asflags) add_old_configure_assignment("_COMPILATION_HOST_ASFLAGS", asm_flags.host_asflags) @@ -596,11 +610,11 @@ add_old_configure_assignment("_COMPILATION_LDFLAGS", linker_flags.ldflags) add_old_configure_assignment( "_COMPILATION_OPTIMIZE_LDFLAGS", linker_optimize_flags.ldflags ) -add_old_configure_assignment("_COMPILATION_HOST_LDFLAGS", linker_flags.host_ldflags) add_old_configure_assignment("_COMPILATION_CFLAGS", compilation_flags.cflags) add_old_configure_assignment("_COMPILATION_CXXFLAGS", compilation_flags.cxxflags) set_config("HOST_CFLAGS", host_cflags) set_config("HOST_CXXFLAGS", host_cflags) +set_config("HOST_LDFLAGS", host_ldflags) set_config("DSO_LDOPTS", dso_flags.ldopts) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index b62f8294a36a..9d2cce2091e0 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -22,6 +22,14 @@ option( ) +option( + env="HOST_LDFLAGS", + help="Extra flags for linking host object files.", + nargs=1, + default="", +) + + # Code optimization # ============================================================== @@ -2103,7 +2111,6 @@ linker_ldflags = linker_ldflags_tmpl(target) add_old_configure_assignment("LINKER_LDFLAGS", linker_ldflags) host_linker_ldflags = linker_ldflags_tmpl(host) -add_old_configure_assignment("HOST_LINKER_LDFLAGS", host_linker_ldflags) # There's a wrinkle with MinGW: linker configuration is not enabled, so diff --git a/build/mozconfig.no-compile b/build/mozconfig.no-compile index 5efb8e5db112..0b47d871f4b9 100644 --- a/build/mozconfig.no-compile +++ b/build/mozconfig.no-compile @@ -13,6 +13,7 @@ unset HOST_CC unset HOST_CXX unset HOST_CFLAGS unset HOST_CXXFLAGS +unset HOST_LDFLAGS unset LINKER unset RUSTFLAGS unset TOOLCHAIN_PREFIX diff --git a/js/src/old-configure.in b/js/src/old-configure.in index 5445338071d9..8d1240a870b5 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -22,7 +22,6 @@ CFLAGS="${CFLAGS=}" CPPFLAGS="${CPPFLAGS=}" CXXFLAGS="${CXXFLAGS=}" LDFLAGS="${LDFLAGS=}" -HOST_LDFLAGS="${HOST_LDFLAGS=}" dnl Propagate extra android flags dnl ============================= @@ -41,7 +40,6 @@ dnl ======================================================== W32API_VERSION=3.14 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS $PACK_REL_RELOC_FLAGS" -HOST_LDFLAGS="$HOST_LDFLAGS $HOST_LINKER_LDFLAGS" if test -z "$JS_STANDALONE"; then autoconfmk=autoconf-js.mk @@ -159,19 +157,6 @@ dnl ======================================================== case "$host" in *mingw*) HOST_BIN_SUFFIX=.exe - - case "${host_cpu}" in - i*86) - if test "$HOST_CC_TYPE" = clang-cl; then - HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86" - fi - ;; - x86_64) - if test "$HOST_CC_TYPE" = clang-cl; then - HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64" - fi - ;; - esac ;; esac @@ -384,10 +369,6 @@ LDFLAGS=`echo \ $LDFLAGS \ $_COMPILATION_LDFLAGS` -HOST_LDFLAGS=`echo \ - $HOST_LDFLAGS \ - $_COMPILATION_HOST_LDFLAGS` - OS_CFLAGS="$CFLAGS" OS_CXXFLAGS="$CXXFLAGS" OS_CPPFLAGS="$CPPFLAGS" @@ -400,7 +381,6 @@ AC_SUBST_LIST(OS_LDFLAGS) AC_SUBST(HOST_CC) AC_SUBST(HOST_CXX) AC_SUBST_LIST(HOST_CPPFLAGS) -AC_SUBST(HOST_LDFLAGS) AC_SUBST(HOST_BIN_SUFFIX) AC_SUBST(BIN_SUFFIX) diff --git a/old-configure.in b/old-configure.in index 1504da35570d..a72eaf9fcf5e 100644 --- a/old-configure.in +++ b/old-configure.in @@ -22,7 +22,6 @@ CFLAGS="${CFLAGS=}" CPPFLAGS="${CPPFLAGS=}" CXXFLAGS="${CXXFLAGS=}" LDFLAGS="${LDFLAGS=}" -HOST_LDFLAGS="${HOST_LDFLAGS=}" dnl Propagate extra android flags @@ -43,7 +42,6 @@ W32API_VERSION=3.14 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS $PACK_REL_RELOC_FLAGS" -HOST_LDFLAGS="$HOST_LDFLAGS $HOST_LINKER_LDFLAGS" dnl ======================================================== dnl Checks for compilers. @@ -163,19 +161,6 @@ dnl ======================================================== case "$host" in *mingw*) HOST_BIN_SUFFIX=.exe - - case "${host_cpu}" in - i*86) - if test "$HOST_CC_TYPE" = clang-cl; then - HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86" - fi - ;; - x86_64) - if test "$HOST_CC_TYPE" = clang-cl; then - HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64" - fi - ;; - esac ;; esac @@ -537,10 +522,6 @@ LDFLAGS=`echo \ $LDFLAGS \ $_COMPILATION_LDFLAGS` -HOST_LDFLAGS=`echo \ - $HOST_LDFLAGS \ - $_COMPILATION_HOST_LDFLAGS` - OS_CFLAGS="$CFLAGS" OS_CXXFLAGS="$CXXFLAGS" OS_CPPFLAGS="$CPPFLAGS" @@ -553,7 +534,6 @@ AC_SUBST_LIST(OS_LDFLAGS) AC_SUBST(HOST_CC) AC_SUBST(HOST_CXX) AC_SUBST_LIST(HOST_CPPFLAGS) -AC_SUBST(HOST_LDFLAGS) AC_SUBST(HOST_BIN_SUFFIX) AC_SUBST(BIN_SUFFIX)