diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel --- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel @@ -2,6 +2,7 @@ # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +load("@bazel_skylib//lib:selects.bzl", "selects") load(":template_rule.bzl", "template_rule") load(":tblgen.bzl", "gentbl") load(":config.bzl", "llvm_config_defines") @@ -25,6 +26,24 @@ "$(STACK_FRAME_UNLIMITED)", ] +config_setting( + name = "x86_32", + constraint_values = ["@platforms//cpu/cpu:x86_32"], +) + +config_setting( + name = "x86_64", + constraint_values = ["@platforms//cpu/cpu:x86_64"], +) + +selects.config_setting_group( + name = "any_x86", + match_any = [ + ":x86_32", + ":x86_64", + ], +) + enum_targets_gen( name = "targets_def_gen", src = "include/llvm/Config/Targets.def.in", @@ -2326,8 +2345,6 @@ name = "Exegesis", srcs = glob([ "tools/llvm-exegesis/lib/*.cpp", - "tools/llvm-exegesis/lib/X86/*.cpp", - "tools/llvm-exegesis/lib/X86/*.h", # We have to include these headers here as well as in the `hdrs` below # to allow the `.cpp` files to use file-relative-inclusion to find @@ -2335,7 +2352,13 @@ # `tools/llvm-exegesis/lib` with the `strip_includes_prefix` of this # library. This mixture appears to be incompatible with header modules. "tools/llvm-exegesis/lib/*.h", - ]), + ]) + select({ + ":any_x86": glob([ + "tools/llvm-exegesis/lib/X86/*.cpp", + "tools/llvm-exegesis/lib/X86/*.h", + ]), + "//conditions:default": [], + }), hdrs = glob(["tools/llvm-exegesis/lib/*.h"]), copts = llvm_copts + ["-DHAVE_LIBPFM=1"], defines = ["LLVM_EXEGESIS_INITIALIZE_NATIVE_TARGET=InitializeX86ExegesisTarget"],