diff --git a/build/moz.configure/flags.configure b/build/moz.configure/flags.configure index c1cfdbf5d6e1..302e799975be 100644 --- a/build/moz.configure/flags.configure +++ b/build/moz.configure/flags.configure @@ -12,7 +12,7 @@ check_and_add_flag("-fno-sized-deallocation", compiler=cxx_compiler) check_and_add_flag("-fno-aligned-new", compiler=cxx_compiler) -with only_when(building_with_gnu_cc): +with only_when(building_with_gnu_compatible_cc): with only_when(~developer_options): add_flag("-ffunction-sections") add_flag("-fdata-sections") @@ -185,12 +185,12 @@ def file_prefix_map_flags(path_remapping, path_remappings, compiler): set_config("MOZ_FILE_PREFIX_MAP_FLAGS", file_prefix_map_flags) -@depends(developer_options, when=building_with_gnu_cc) +@depends(developer_options, when=building_with_gnu_compatible_cc) def check_build_id_uuid(developer_options): return developer_options -@depends(developer_options, when=building_with_gnu_cc) +@depends(developer_options, when=building_with_gnu_compatible_cc) def check_build_id_sha1(developer_options): return not developer_options @@ -200,28 +200,28 @@ check_and_add_flag("-pipe", when=building_with_gcc) check_and_add_linker_flag("-Wl,--build-id=uuid", when=check_build_id_uuid) check_and_add_linker_flag("-Wl,--build-id=sha1", when=check_build_id_sha1) -check_and_add_asm_flag("-Wa,--noexecstack", when=building_with_gnu_cc) -check_and_add_linker_flag("-Wl,-z,noexecstack", when=building_with_gnu_cc) -check_and_add_linker_flag("-Wl,-z,text", when=building_with_gnu_cc) -check_and_add_linker_flag("-Wl,-z,relro", when=building_with_gnu_cc) -check_and_add_linker_flag("-Wl,-z,now", when=building_with_gnu_cc) -check_and_add_linker_flag("-Wl,-z,nocopyreloc", when=building_with_gnu_cc) +check_and_add_asm_flag("-Wa,--noexecstack", when=building_with_gnu_compatible_cc) +check_and_add_linker_flag("-Wl,-z,noexecstack", when=building_with_gnu_compatible_cc) +check_and_add_linker_flag("-Wl,-z,text", when=building_with_gnu_compatible_cc) +check_and_add_linker_flag("-Wl,-z,relro", when=building_with_gnu_compatible_cc) +check_and_add_linker_flag("-Wl,-z,now", when=building_with_gnu_compatible_cc) +check_and_add_linker_flag("-Wl,-z,nocopyreloc", when=building_with_gnu_compatible_cc) check_and_add_linker_optimize_flag("-Wl,-dead_strip", when=target_is_darwin & ~dtrace) have_linker_support_ignore_unresolved = try_link( flags=["-Wl,--ignore-unresolved-symbol,environ"], check_msg="for --ignore-unresolved-symbol option to the linker", - when=building_with_gnu_cc & gcc_use_gnu_ld, + when=building_with_gnu_compatible_cc & gcc_use_gnu_ld, ) add_old_configure_assignment( "HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED", have_linker_support_ignore_unresolved ) -@depends("--enable-address-sanitizer", building_with_gnu_cc) -def check_Bsymbolic(enable_asan, building_with_gnu_cc): - return enable_asan and building_with_gnu_cc +@depends("--enable-address-sanitizer", building_with_gnu_compatible_cc) +def check_Bsymbolic(enable_asan, building_with_gnu_compatible_cc): + return enable_asan and building_with_gnu_compatible_cc # ASan assumes no symbols are being interposed, and when that happens, diff --git a/build/moz.configure/libraries.configure b/build/moz.configure/libraries.configure index 450ecdd51f78..3c3c713a40f0 100644 --- a/build/moz.configure/libraries.configure +++ b/build/moz.configure/libraries.configure @@ -14,7 +14,7 @@ def check_clock_monotonic_support(lib=None, when=None): check_msg += f" in {lib}" flags.append(f"-l{lib}") - check_when = building_with_gnu_cc + check_when = building_with_gnu_compatible_cc if when is not None: check_when &= when @@ -49,7 +49,7 @@ have_res_ninit = try_link( body="int foo = res_ninit(&_res);", check_msg="for res_ninit()", flags=depends(when=building_linux)(["-D_BSD_SOURCE=1"]), - when=building_with_gnu_cc & ~target_is_netbsd & ~target_is_openbsd, + when=building_with_gnu_compatible_cc & ~target_is_netbsd & ~target_is_openbsd, ) set_define("HAVE_RES_NINIT", have_res_ninit) @@ -59,7 +59,7 @@ set_define("HAVE_RES_NINIT", have_res_ninit) # We don't want to link against libm or libpthread on Darwin since # they both are just symlinks to libSystem and explicitly linking # against libSystem causes issues when debugging (see bug 299601). -with only_when(building_with_gnu_cc): +with only_when(building_with_gnu_compatible_cc): dladdr_check = check_symbol_in_libs([None, "dl"], symbol="dladdr") set_define( "HAVE_DLADDR", depends(dladdr_check)(lambda check: "1" if check.found else "0") @@ -77,13 +77,15 @@ set_config( "C_R_LIBS", ["-lc_r"], when=check_symbol_in_lib( - "c_r", symbol="gethostbyname_r", when=building_with_gnu_cc + "c_r", symbol="gethostbyname_r", when=building_with_gnu_compatible_cc ), ) set_config( "SOCKET_LIBS", ["-lsocket"], - when=check_symbol_in_lib("socket", symbol="socket", when=building_with_gnu_cc), + when=check_symbol_in_lib( + "socket", symbol="socket", when=building_with_gnu_compatible_cc + ), ) moz_use_pthreads = ( @@ -91,7 +93,7 @@ moz_use_pthreads = ( | check_symbol_in_libs( [None, "pthread"], symbol="pthread_create", - when=building_with_gnu_cc & ~target_is_darwin, + when=building_with_gnu_compatible_cc & ~target_is_darwin, ).found ) @@ -116,7 +118,7 @@ with only_when(moz_use_pthreads): set_config("MOZ_USE_PTHREADS", True) -with only_when(building_with_gnu_cc): +with only_when(building_with_gnu_compatible_cc): @template def check_std_atomic_requirements(flag=None, when=None): diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index ae22179716df..9e9ae2657803 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -1724,7 +1724,9 @@ host_windows_abi = windows_abi(host, host_c_compiler) # Generic compiler-based conditions. building_with_gcc = depends(c_compiler)(lambda info: info.type == "gcc") -building_with_gnu_cc = depends(c_compiler)(lambda info: info.type != "clang-cl") +building_with_gnu_compatible_cc = depends(c_compiler)( + lambda info: info.type != "clang-cl" +) @depends(cxx_compiler, ccache_prefix) diff --git a/js/moz.configure b/js/moz.configure index 05fcae57ee52..591ec3f3b13a 100644 --- a/js/moz.configure +++ b/js/moz.configure @@ -1471,7 +1471,7 @@ with only_when(compile_environment & depends(target.os)(lambda os: os != "WINNT" includes=["langinfo.h"], body="char* cs = nl_langinfo(CODESET);", check_msg="for nl_langinfo and CODESET", - when=building_with_gnu_cc, + when=building_with_gnu_compatible_cc, ), )