[Bazel] Fix build after ObjCopy move.

Differential Revision: https://reviews.llvm.org/D120039
This commit is contained in:
Adrian Kuegel 2022-02-17 13:02:14 +01:00
parent e993b20c04
commit e7d65fca7e
2 changed files with 40 additions and 22 deletions

View File

@ -786,6 +786,27 @@ cc_library(
],
)
cc_library(
name = "ObjCopy",
srcs = glob([
"lib/ObjCopy/**/*.cpp",
"lib/ObjCopy/**/*.h",
]),
hdrs = glob([
"include/llvm/ObjCopy/**/*.h",
]),
copts = llvm_copts,
includes = ["lib/ObjCopy"],
deps = [
":MC",
":Object",
":ObjectYAML",
":Support",
":Target",
":intrinsics_impl_gen",
],
)
cc_library(
name = "Object",
srcs = glob([
@ -2432,22 +2453,6 @@ cc_library(
],
)
# FIXME: This library should use `textual_hdrs` instead of `hdrs` as we don't
# want to parse or build modules for them (and haven't duplicated the necessary
# dependencies), but unfortunately that doesn't work with
# `strip_include_prefix`: https://github.com/bazelbuild/bazel/issues/12424
#
# For now, we simply disable features that might rely on the headers parsing.
cc_library(
name = "llvm-objcopy-headers",
hdrs = glob(["tools/llvm-objcopy/**/*.h"]),
features = [
"-parse_headers",
"-header_modules",
],
strip_include_prefix = "tools/llvm-objcopy",
)
cc_library(
name = "MCA",
srcs = glob([
@ -3337,17 +3342,15 @@ cc_binary(
cc_binary(
name = "llvm-objcopy",
srcs = glob([
"tools/llvm-objcopy/**/*.cpp",
# Note that we redundantly include the headers here to allow files to
# include same-directory headers in addition to including headers via
# the `llvm-objcopy-headers` rule's stripped include prefix.
"tools/llvm-objcopy/**/*.h",
"tools/llvm-objcopy/*.cpp",
"tools/llvm-objcopy/*.h",
]),
copts = llvm_copts,
stamp = 0,
deps = [
":BinaryFormat",
":MC",
":ObjCopy",
":Object",
":ObjectYAML",
":Option",
@ -3355,7 +3358,6 @@ cc_binary(
":Target",
":llvm-bitcode-strip-opts",
":llvm-installnametool-opts",
":llvm-objcopy-headers",
":llvm-objcopy-opts",
":llvm-strip-opts",
],

View File

@ -411,6 +411,22 @@ cc_test(
],
)
cc_test(
name = "objcopy_tests",
srcs = glob(
["ObjCopy/*.cpp"],
allow_empty = False,
),
deps = [
"//llvm:ObjCopy",
"//llvm:Object",
"//llvm:ObjectYAML",
"//llvm:TestingSupport",
"//llvm:gtest",
"//llvm:gtest_main",
],
)
cc_test(
name = "object_tests",
size = "small",