[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
utils/bazel/llvm-project-overlay/llvm

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( cc_library(
name = "Object", name = "Object",
srcs = glob([ 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( cc_library(
name = "MCA", name = "MCA",
srcs = glob([ srcs = glob([
@ -3337,17 +3342,15 @@ cc_binary(
cc_binary( cc_binary(
name = "llvm-objcopy", name = "llvm-objcopy",
srcs = glob([ srcs = glob([
"tools/llvm-objcopy/**/*.cpp", "tools/llvm-objcopy/*.cpp",
# Note that we redundantly include the headers here to allow files to "tools/llvm-objcopy/*.h",
# include same-directory headers in addition to including headers via
# the `llvm-objcopy-headers` rule's stripped include prefix.
"tools/llvm-objcopy/**/*.h",
]), ]),
copts = llvm_copts, copts = llvm_copts,
stamp = 0, stamp = 0,
deps = [ deps = [
":BinaryFormat", ":BinaryFormat",
":MC", ":MC",
":ObjCopy",
":Object", ":Object",
":ObjectYAML", ":ObjectYAML",
":Option", ":Option",
@ -3355,7 +3358,6 @@ cc_binary(
":Target", ":Target",
":llvm-bitcode-strip-opts", ":llvm-bitcode-strip-opts",
":llvm-installnametool-opts", ":llvm-installnametool-opts",
":llvm-objcopy-headers",
":llvm-objcopy-opts", ":llvm-objcopy-opts",
":llvm-strip-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( cc_test(
name = "object_tests", name = "object_tests",
size = "small", size = "small",