Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Global bazelrc file, see https://docs.bazel.build/versions/master/guide.html#bazelrc.

common --noenable_bzlmod --enable_workspace

# Use strict action env to prevent leaks of env vars.
build --incompatible_strict_action_env

Expand Down Expand Up @@ -97,7 +99,7 @@ test:aarch64_sysroot --test_tag_filters=-no_libcpp,-requires_root,-requires_bpf,
# Build for Clang using Libc++.
build:clang --config=clang-base
build:clang --//bazel:enable_libcpp
build:clang --features=libc++ --features=-libstdc++
build:clang --features=libc++ --features=-libstdc++ --host_features=libc++ --host_features=-libstdc++
build:clang --build_tag_filters=-no_libcpp
build:clang --test_tag_filters=-no_libcpp,-requires_root,-requires_bpf,-disabled
test:clang --config=tmp-sandbox
Expand All @@ -110,7 +112,7 @@ test:clang-libstdc++ --config=tmp-sandbox

build:qemu-bpf --config=clang-base
build:qemu-bpf --//bazel:enable_libcpp
build:qemu-bpf --features=libc++ --features=-libstdc++
build:qemu-bpf --features=libc++ --features=-libstdc++ --host_features=libc++ --host_features=-libstdc++
build:qemu-bpf --build_tag_filters=requires_bpf,requires_root,-no_qemu,-no_libcpp
build:qemu-bpf --test_tag_filters=requires_bpf,requires_root,-no_qemu,-no_libcpp,-disabled
build:qemu-bpf --sandbox_fake_username
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.0
7.7.1
110 changes: 76 additions & 34 deletions bazel/cc_toolchains/unix_cc_toolchain_config.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
diff --color -Naur a/cc_toolchain_config.bzl b/cc_toolchain_config.bzl
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diff updates the unix_cc_toolchain_config patch against bazel 7.7.1 (as seen from the bazel/repository_locations.bzl diff).

--- a/cc_toolchain_config.bzl 2023-01-06 15:34:50.000000000 -0800
+++ b/cc_toolchain_config.bzl 2023-01-22 15:33:16.794758043 -0800
@@ -27,6 +27,7 @@
"with_feature_set",
)
diff --git a/cc_toolchain_config.bzl b/cc_toolchain_config.bzl
index 1dd0e7a6e7..29b59c6325 100644
--- a/cc_toolchain_config.bzl
+++ b/cc_toolchain_config.bzl
@@ -15,6 +15,7 @@
"""A Starlark cc_toolchain configuration rule"""

load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
+load(":toolchain_features.bzl", "pl_toolchain_pre_features", "PL_EXTRA_CC_CONFIG_ATTRS", "pl_toolchain_post_features", "pl_action_configs")

def layering_check_features(compiler):
if compiler != "clang":
@@ -147,7 +148,7 @@
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"action_config",
@@ -228,7 +229,7 @@ def _impl(ctx):
tool_path(name = name, path = path)
for name, path in ctx.attr.tool_paths.items()
]
Expand All @@ -18,7 +19,7 @@ diff --color -Naur a/cc_toolchain_config.bzl b/cc_toolchain_config.bzl

llvm_cov_action = action_config(
action_name = ACTION_NAMES.llvm_cov,
@@ -168,6 +169,10 @@
@@ -278,6 +279,10 @@ def _impl(ctx):
name = "supports_start_end_lib",
enabled = True,
)
Expand All @@ -27,9 +28,9 @@ diff --color -Naur a/cc_toolchain_config.bzl b/cc_toolchain_config.bzl
+ enabled = True,
+ )

default_compile_flags_feature = feature(
name = "default_compile_flags",
@@ -203,7 +208,7 @@
gcc_quoting_for_param_files_feature = feature(
name = "gcc_quoting_for_param_files",
@@ -323,7 +328,7 @@ def _impl(ctx):
flags = ctx.attr.dbg_compile_flags,
),
] if ctx.attr.dbg_compile_flags else []),
Expand All @@ -38,49 +39,89 @@ diff --color -Naur a/cc_toolchain_config.bzl b/cc_toolchain_config.bzl
),
flag_set(
actions = all_compile_actions,
@@ -212,7 +217,7 @@
@@ -332,7 +337,7 @@ def _impl(ctx):
flags = ctx.attr.opt_compile_flags,
),
] if ctx.attr.opt_compile_flags else []),
- with_features = [with_feature_set(features = ["opt"])],
+ with_features = [with_feature_set(features = ["opt", "default_opt_level_flags"])],
),
flag_set(
actions = all_cpp_compile_actions + [ACTION_NAMES.lto_backend],
@@ -244,7 +249,7 @@
actions = [ACTION_NAMES.c_compile],
@@ -372,7 +377,7 @@ def _impl(ctx):
flags = ctx.attr.opt_link_flags,
),
] if ctx.attr.opt_link_flags else []),
- with_features = [with_feature_set(features = ["opt"])],
+ with_features = [with_feature_set(features = ["opt", "default_opt_level_flags"])],
),
],
env_sets = [
@@ -1473,27 +1478,6 @@ def _impl(ctx):
enabled = True,
)
@@ -1255,6 +1260,7 @@

- asan_feature = _sanitizer_feature(
- name = "asan",
- specific_compile_flags = [
- "-fsanitize=address",
- "-fno-common",
- ],
- specific_link_flags = [
- "-fsanitize=address",
- ],
- )
-
- tsan_feature = _sanitizer_feature(
- name = "tsan",
- specific_compile_flags = [
- "-fsanitize=thread",
- ],
- specific_link_flags = [
- "-fsanitize=thread",
- ],
- )
-
ubsan_feature = _sanitizer_feature(
name = "ubsan",
specific_compile_flags = [
@@ -1569,11 +1553,10 @@ def _impl(ctx):
strip_debug_symbols_feature,
coverage_feature,
supports_pic_feature,
- asan_feature,
- tsan_feature,
ubsan_feature,
gcc_quoting_for_param_files_feature,
static_link_cpp_runtimes_feature,
+ default_opt_level_flags_feature,
] + (
[
supports_start_end_lib_feature,
@@ -1276,6 +1282,7 @@
else:
features = [
supports_pic_feature,
@@ -1613,11 +1596,10 @@ def _impl(ctx):
set_install_name_feature,
libtool_feature,
archiver_flags_feature,
- asan_feature,
- tsan_feature,
ubsan_feature,
gcc_quoting_for_param_files_feature,
static_link_cpp_runtimes_feature,
+ default_opt_level_flags_feature,
] + (
[
supports_start_end_lib_feature,
@@ -1294,6 +1301,7 @@
unfiltered_compile_flags_feature,
] + layering_check_features(ctx.attr.compiler)
@@ -1643,8 +1625,8 @@ def _impl(ctx):
parse_headers_action_configs, parse_headers_features = parse_headers_support(
parse_headers_tool_path = ctx.attr.tool_paths.get("parse_headers"),
)
+ features = pl_toolchain_pre_features(ctx) + features + parse_headers_features + pl_toolchain_post_features(ctx)
action_configs += parse_headers_action_configs
- features += parse_headers_features

+ features = pl_toolchain_pre_features(ctx) + features + pl_toolchain_post_features(ctx)
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
features = features,
@@ -1313,7 +1321,7 @@
if symbol_check:
features.append(symbol_check)
@@ -1669,7 +1651,7 @@ def _impl(ctx):

cc_toolchain_config = rule(
implementation = _impl,
Expand All @@ -89,11 +130,12 @@ diff --color -Naur a/cc_toolchain_config.bzl b/cc_toolchain_config.bzl
"cpu": attr.string(mandatory = True),
"compiler": attr.string(mandatory = True),
"toolchain_identifier": attr.string(mandatory = True),
@@ -1336,6 +1344,6 @@
"coverage_link_flags": attr.string_list(),
"supports_start_end_lib": attr.bool(),
"builtin_sysroot": attr.string(),
@@ -1699,7 +1681,7 @@ cc_toolchain_config = rule(
fragment = "apple",
name = "xcode_config_label",
)),
- },
+ }, **PL_EXTRA_CC_CONFIG_ATTRS),
fragments = ["apple", "cpp"],
provides = [CcToolchainConfigInfo],
)
3 changes: 2 additions & 1 deletion bazel/pl_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def pl_common_linkopts():
"-lunwind",
],
# The OSX system library transitively links common libraries (e.g., pthread).
"@bazel_tools//tools/osx:darwin": [],
"@bazel_tools//tools/osx:darwin_arm64": [],
"@bazel_tools//tools/osx:darwin_x86_64": [],
"//conditions:default": [
"-pthread",
"-lunwind",
Expand Down
4 changes: 2 additions & 2 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,9 @@ REPOSITORY_LOCATIONS = dict(
],
),
unix_cc_toolchain_config = dict(
sha256 = "2c1d60ef4d586909f138c28409780e102e2ebd619e7d462ded26dce43a8f9ffb",
sha256 = "dfee9d4e56421497002c1bb932a1cf9323eca9273374419ca436e7d4b1421134",
urls = [
"https://raw.githubusercontent.com/bazelbuild/bazel/5.3.1/tools/cpp/unix_cc_toolchain_config.bzl",
"https://raw.githubusercontent.com/bazelbuild/bazel/7.7.1/tools/cpp/unix_cc_toolchain_config.bzl",
],
),
# GRPC and Protobuf pick different versions. Pick the newer one.
Expand Down
7 changes: 7 additions & 0 deletions bazel/test_runners/qemu_with_kernel/launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ RUN_QEMU_SCRIPT=%runqemuscript%
# Create a tmp directory that serves as the /test_fs sanbox dir inside qemu.
tmpdir_for_sandbox=$(mktemp -d)

# This file must be modified to signal to bazel that the qemu runner supports sharding.
# Since this runner leverages bazel's test runner and only runs supported binaries
# (googletest tests), we fulfill the requirement by touching this file.
if [ -n "${TEST_SHARD_STATUS_FILE}" ]; then
touch "${TEST_SHARD_STATUS_FILE}"
fi

# shellcheck disable=SC2317
function cleanup {
retval=$?
Expand Down
5 changes: 3 additions & 2 deletions ci/cquery_ignore_non_target_and_incompatible.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
def format(target):
build_opts = build_options(target)

# We only want to get targets that are in the target configuration. So we ignore exec and host targets.
if build_opts["//command_line_option:is exec configuration"] or build_opts["//command_line_option:is host configuration"]:
# We only want to get targets that are in the target configuration. So we ignore exec targets.
# Note: "is host configuration" was removed in Bazel 7 as host configuration was fully replaced by exec configuration.
if build_opts["//command_line_option:is exec configuration"]:
return None

# Ignore targets that are incompatible with the target configuration.
Expand Down