SERVER-109242 Add remote linking for compilation of arm64 tasks (#40052)
GitOrigin-RevId: 2a02a96ce187cf37f3073a035cae78d86eaab1db
This commit is contained in:
committed by
MongoDB Bot
parent
41db694f89
commit
886b418b06
1
.bazelrc
1
.bazelrc
@@ -374,6 +374,7 @@ common:remote_link --strategy=CppArchive=remote
|
||||
common:remote_link --strategy=SolibSymlink=remote
|
||||
common:remote_link --strategy=ExtractDebugInfo=remote
|
||||
common:remote_link --strategy=StripDebugInfo=remote
|
||||
common:remote_link --//bazel/config:remote_link=True
|
||||
common:remote_link --features=-thin_archive
|
||||
|
||||
# Coverage
|
||||
|
||||
@@ -41,6 +41,7 @@ load(
|
||||
"propeller_profile_generate",
|
||||
"propeller_profile_use",
|
||||
"release",
|
||||
"remote_link",
|
||||
"sdkroot",
|
||||
"separate_debug",
|
||||
"server_js",
|
||||
@@ -712,6 +713,31 @@ selects.config_setting_group(
|
||||
],
|
||||
)
|
||||
|
||||
# ==========
|
||||
# remote link
|
||||
# ==========
|
||||
|
||||
remote_link(
|
||||
name = "remote_link",
|
||||
build_setting_default = False,
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "remote_link_enabled",
|
||||
flag_values = {
|
||||
"//bazel/config:remote_link": "True",
|
||||
},
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "remote_link_arm_linux_enabled",
|
||||
match_all = [
|
||||
":remote_link_enabled",
|
||||
"@platforms//cpu:aarch64",
|
||||
"@platforms//os:linux",
|
||||
],
|
||||
)
|
||||
|
||||
# --------------------------------------
|
||||
# linker options
|
||||
# --------------------------------------
|
||||
|
||||
@@ -564,6 +564,19 @@ release = rule(
|
||||
build_setting = config.bool(flag = True),
|
||||
)
|
||||
|
||||
# =========
|
||||
# remote link
|
||||
# =========
|
||||
remote_link_provider = provider(
|
||||
doc = """Enable remote link features.""",
|
||||
fields = ["enabled"],
|
||||
)
|
||||
|
||||
remote_link = rule(
|
||||
implementation = lambda ctx: remote_link_provider(enabled = ctx.build_setting_value),
|
||||
build_setting = config.bool(flag = True),
|
||||
)
|
||||
|
||||
# =========
|
||||
# dwarf_version
|
||||
# =========
|
||||
|
||||
@@ -792,12 +792,14 @@ def _mongo_cc_binary_and_test(
|
||||
"target_compatible_with": target_compatible_with + enterprise_compatible,
|
||||
"additional_linker_inputs": additional_linker_inputs + MONGO_GLOBAL_ADDITIONAL_LINKER_INPUTS,
|
||||
"exec_properties": exec_properties | select({
|
||||
# Debug compression significantly reduces .o, .dwo, and .a sizes
|
||||
"//bazel/config:compress_debug_compile_enabled": {"cpp_link.coefficient": "18.0"},
|
||||
"//conditions:default": {"cpp_link.coefficient": "3.0"},
|
||||
"//bazel/config:remote_link_enabled": {},
|
||||
"//conditions:default": {"cpp_link.coefficient": "18.0"},
|
||||
}) | select({
|
||||
"//bazel/config:thin_lto_enabled": {"cpp_link.cpus": str(NUM_CPUS)},
|
||||
"//conditions:default": {},
|
||||
}) | select({
|
||||
"//bazel/config:remote_link_arm_linux_enabled": {"cpp_link.Pool": "arm_linker"},
|
||||
"//conditions:default": {},
|
||||
}),
|
||||
"env": env | SANITIZER_ENV,
|
||||
} | kwargs
|
||||
|
||||
@@ -95,6 +95,11 @@ if [ "${skip_debug_link}" = "true" ]; then
|
||||
export version_id="${version_id}"
|
||||
if [ "${task_name}" = "archive_dist_test" ]; then
|
||||
task_compile_flags="${task_compile_flags} --simple_build_id=True --linkopt='-Wl,-S' --separate_debug=False"
|
||||
ARCH=$(uname -m)
|
||||
# Remote linking is currently only supported on arm
|
||||
if [[ "$ARCH" == "arm64" || "$ARCH" == "aarch64" ]]; then
|
||||
task_compile_flags="${task_compile_flags} --remote_download_outputs=toplevel --config=remote_link"
|
||||
fi
|
||||
fi
|
||||
if [ "${task_name}" = "archive_dist_test_debug" ]; then
|
||||
task_compile_flags="${task_compile_flags} --simple_build_id=True"
|
||||
|
||||
Reference in New Issue
Block a user