aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Delmerico <delmerico@google.com>2023-04-20 09:11:33 -0400
committerCherrypicker Worker <android-build-cherrypicker-worker@google.com>2023-05-22 19:26:51 +0000
commita92f0d7187a4f35c9679eda75612f5660ef688b7 (patch)
treed90f1dc229a6eb2e6a12a95487b1cfabe6716ec1
parente51200d82f04a1e762fcb6a7437559bee22095ae (diff)
downloadbazel-a92f0d7187a4f35c9679eda75612f5660ef688b7.tar.gz
add toc to _cc_stub_library_shared rules
Bug: 270408757 Test: m droid --bazel-mode-dev (cherry picked from https://android-review.googlesource.com/q/commit:83756af876d3f233ecd13f2dc2770a12214ade6c) Merged-In: I4a9145fc2e56e7fb9f74903e6f711ef5bc7adcbd Change-Id: I4a9145fc2e56e7fb9f74903e6f711ef5bc7adcbd
-rw-r--r--rules/cc/cc_library_shared.bzl2
-rw-r--r--rules/cc/cc_stub_library.bzl45
2 files changed, 40 insertions, 7 deletions
diff --git a/rules/cc/cc_library_shared.bzl b/rules/cc/cc_library_shared.bzl
index 36b14e01..9fed9694 100644
--- a/rules/cc/cc_library_shared.bzl
+++ b/rules/cc/cc_library_shared.bzl
@@ -508,7 +508,7 @@ _cc_library_shared_proxy = rule(
default = "//prebuilts/clang/host/linux-x86:llvm-readelf",
),
},
- provides = [CcAndroidMkInfo, CcInfo],
+ provides = [CcAndroidMkInfo, CcInfo, CcTocInfo],
fragments = ["cpp"],
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
)
diff --git a/rules/cc/cc_stub_library.bzl b/rules/cc/cc_stub_library.bzl
index 00f3c0fe..f9c90623 100644
--- a/rules/cc/cc_stub_library.bzl
+++ b/rules/cc/cc_stub_library.bzl
@@ -19,6 +19,7 @@ load(":cc_library_headers.bzl", "cc_library_headers")
load(":cc_library_shared.bzl", "CcStubLibrariesInfo")
load(":cc_library_static.bzl", "cc_library_static")
load(":fdo_profile_transitions.bzl", "drop_fdo_profile_transition")
+load(":generate_toc.bzl", "CcTocInfo", "generate_toc")
# This file contains the implementation for the cc_stub_library rule.
#
@@ -186,14 +187,17 @@ def _cc_stub_library_shared_impl(ctx):
defines = depset([version_macro_name]),
)
- cc_infos = [ctx.attr.root[CcInfo]]
- cc_infos.append(CcInfo(compilation_context = compilation_context))
- cc_info = cc_common.merge_cc_infos(cc_infos = cc_infos)
+ cc_info = cc_common.merge_cc_infos(cc_infos = [
+ ctx.attr.root[CcInfo],
+ CcInfo(compilation_context = compilation_context),
+ ])
+ toc_info = generate_toc(ctx, ctx.attr.name, ctx.attr.library_target.files.to_list()[0])
return [
ctx.attr.library_target[DefaultInfo],
ctx.attr.library_target[CcSharedLibraryInfo],
ctx.attr.stub_target[CcStubInfo],
+ toc_info,
cc_info,
CcStubLibrariesInfo(has_stubs = True),
OutputGroupInfo(rule_impl_debug_files = depset()),
@@ -207,15 +211,44 @@ _cc_stub_library_shared = rule(
# to converge the configurations of the stub targets
cfg = drop_fdo_profile_transition,
attrs = {
- "stub_target": attr.label(mandatory = True),
- "library_target": attr.label(mandatory = True),
- "root": attr.label(mandatory = True),
+ "stub_target": attr.label(
+ providers = [CcStubInfo],
+ mandatory = True,
+ ),
+ "library_target": attr.label(
+ providers = [CcSharedLibraryInfo],
+ mandatory = True,
+ ),
+ "root": attr.label(
+ providers = [CcInfo],
+ mandatory = True,
+ ),
"source_library_label": attr.string(mandatory = True),
"version": attr.string(mandatory = True),
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
+ "_toc_script": attr.label(
+ cfg = "exec",
+ executable = True,
+ allow_single_file = True,
+ default = "//build/soong/scripts:toc.sh",
+ ),
+ "_readelf": attr.label(
+ cfg = "exec",
+ executable = True,
+ allow_single_file = True,
+ default = "//prebuilts/clang/host/linux-x86:llvm-readelf",
+ ),
},
+ provides = [
+ CcSharedLibraryInfo,
+ CcTocInfo,
+ CcInfo,
+ CcStubInfo,
+ CcStubLibrariesInfo,
+ CcStubLibrarySharedInfo,
+ ],
)
def cc_stub_suite(