Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use shared linkage for benchmarks #1336

Merged
merged 1 commit into from
Oct 26, 2023
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
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ jobs:
# Exclude large benchmarking binaries created in debug and asan configurations to avoid
# running out of disk space on the runner (nominally 14GB). We typically have two copies
# of generated artifacts: one under bazel output-base and one in the bazel disk cache.
if: contains(matrix.config.suffix, 'debug') || contains(matrix.config.suffix, 'asan')
# This should not be needed on Linux, where we can use shared linkage so binary sizes are
# much less of an issue.
if: matrix.os.name != 'linux' && (contains(matrix.config.suffix, 'debug') || contains(matrix.config.suffix, 'asan'))
shell: bash
run: |
cat <<EOF >> .bazelrc
Expand Down
7 changes: 7 additions & 0 deletions build/wd_cc_benchmark.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ def wd_cc_benchmark(
native.cc_binary(
name = name,
defines = ["WD_IS_BENCHMARK"],
# Use shared linkage for benchmarks, matching the approach used for tests. Unfortunately,
# bazel does not support shared linkage on macOS and it is broken on Windows, so only
# enable this on Linux.
linkstatic = select({
"@platforms//os:linux": 0,
"//conditions:default": 1,
}),
linkopts = linkopts + select({
"@//:use_dead_strip": ["-Wl,-dead_strip"],
"//conditions:default": [""],
Expand Down
Loading