From dc5519d5f43f3f4ec9f1074ad8d335a51b87f06b Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Tue, 9 Jul 2024 23:53:18 -0700 Subject: [PATCH] Add implicit dependency to all targets --- libc/cmake/modules/LLVMLibCObjectRules.cmake | 10 +++++----- .../bazel/llvm-project-overlay/libc/BUILD.bazel | 16 +++++++--------- .../libc/libc_build_rules.bzl | 2 +- .../libc/test/libc_test_rules.bzl | 1 + 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake index 1f80e7f4e57c11..0b092e94ca8a19 100644 --- a/libc/cmake/modules/LLVMLibCObjectRules.cmake +++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake @@ -93,11 +93,11 @@ function(create_object_library fq_target_name) endif() endif() - if(fq_deps_list) - add_dependencies(${fq_target_name} ${fq_deps_list}) - # Add deps as link libraries to inherit interface compile and link options. - target_link_libraries(${fq_target_name} PUBLIC ${fq_deps_list}) - endif() + list(APPEND fq_deps_list libc.src.__support.macros.config) + list(REMOVE_DUPLICATES fq_deps_list) + add_dependencies(${fq_target_name} ${fq_deps_list}) + # Add deps as link libraries to inherit interface compile and link options. + target_link_libraries(${fq_target_name} PUBLIC ${fq_deps_list}) set_target_properties( ${fq_target_name} diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index 28cc040ff4bee9..7f9a114d957755 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -51,6 +51,13 @@ config_setting( flag_values = {":mpfr": "system"}, ) +################################## Base Config ################################# + +cc_library( + name = "__support_macros_config", + hdrs = ["src/__support/macros/config.h"], +) + ################################# Include Files ################################ libc_support_library( @@ -234,11 +241,6 @@ libc_support_library( ], ) -libc_support_library( - name = "__support_macros_config", - hdrs = ["src/__support/macros/config.h"], -) - libc_support_library( name = "__support_macros_attributes", hdrs = ["src/__support/macros/attributes.h"], @@ -252,7 +254,6 @@ libc_support_library( hdrs = ["src/__support/macros/optimization.h"], deps = [ ":__support_macros_attributes", - ":__support_macros_config", ":__support_macros_properties_compiler", ], ) @@ -260,9 +261,6 @@ libc_support_library( libc_support_library( name = "__support_macros_sanitizer", hdrs = ["src/__support/macros/sanitizer.h"], - deps = [ - ":__support_macros_config", - ], ) libc_support_library( diff --git a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl index ec3714407cb914..cc732effb243e1 100644 --- a/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl +++ b/utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl @@ -43,7 +43,7 @@ def _libc_library(name, hidden, copts = [], deps = [], local_defines = [], **kwa name = name, copts = copts + libc_common_copts(), local_defines = local_defines + LIBC_CONFIGURE_OPTIONS, - deps = deps, + deps = deps + ["//libc:__support_macros_config"], linkstatic = 1, **kwargs ) diff --git a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl index ae24a41c60418b..1da0a24b7791a7 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl +++ b/utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl @@ -34,6 +34,7 @@ def libc_test(name, srcs, libc_function_deps = [], copts = [], deps = [], local_ local_defines = local_defines + LIBC_CONFIGURE_OPTIONS, deps = [libc_internal_target(d) for d in all_function_deps] + [ "//libc/test/UnitTest:LibcUnitTest", + "//libc:__support_macros_config", ] + deps, features = ["-link_llvmlibc"], # Do not link libllvmlibc.a copts = copts + libc_common_copts(),