aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Delmerico <delmerico@google.com>2023-05-24 17:57:21 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-05-24 17:57:21 +0000
commitded709b413f19000bc3d42303642e70e874b9609 (patch)
treed90f1dc229a6eb2e6a12a95487b1cfabe6716ec1
parentbb4da57fbfaf898acfc98eb478d495bb638b3cd1 (diff)
parenta92f0d7187a4f35c9679eda75612f5660ef688b7 (diff)
downloadbazel-ded709b413f19000bc3d42303642e70e874b9609.tar.gz
add toc to _cc_stub_library_shared rules am: a92f0d7187
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/bazel/+/23375757 Change-Id: Ifeccbb1d21a64c076c659f4b0f1fd2422d5728f7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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(