diff --git a/utils/bazel/.bazelrc b/utils/bazel/.bazelrc --- a/utils/bazel/.bazelrc +++ b/utils/bazel/.bazelrc @@ -22,6 +22,9 @@ # based on compilation_mode. build --strip=never +# Add layering check to all projects. +build --features=layering_check + ############################################################################### # Options to select different strategies for linking potential dependent # libraries. The default leaves it disabled. diff --git a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel @@ -10,6 +10,13 @@ cc_library( name = "mpfr_impl", + # Disable layering check when using mpfr_system. + features = select( + { + "//conditions:default": [], + "//libc:mpfr_system": ["-layering_check"], + }, + ), target_compatible_with = select({ "//conditions:default": [], "//libc:mpfr_disable": ["@platforms//:incompatible"], @@ -36,9 +43,9 @@ "//libc:__support_fputil_fp_bits", "//libc:__support_fputil_platform_defs", "//libc:libc_root", - "//libc/utils/MPFRWrapper:mpfr_impl", "//libc/test/UnitTest:LibcUnitTest", "//libc/test/UnitTest:fp_test_helpers", + "//libc/utils/MPFRWrapper:mpfr_impl", "//libc/utils/testutils:libc_test_utils", ], )