Skip to content

Commit

Permalink
kleaf: Remove EXEC_ORIGIN.
Browse files Browse the repository at this point in the history
This fixes running cc_test libcap_test.

Link: bazelbuild/bazel#3592
Bug: 325514706
Change-Id: Ibc034ceede5c381dc5d9f5ac7b4f603ea0f695f9
  • Loading branch information
HONG Yifan committed Aug 17, 2024
1 parent f47c575 commit f764d94
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions kleaf/clang_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
load(
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
"feature",
"flag_group",
"flag_set",
)
load(
"@rules_cc//cc:action_names.bzl",
"ACTION_NAMES",
)
load(":android.bzl", "android")
load(":common.bzl", "common")
Expand Down Expand Up @@ -62,6 +68,26 @@ def _impl(ctx):
enabled = False,
))

# Hack to get rid of EXEC_ORIGIN. This fixes running cc_test.
# https://github.com/bazelbuild/bazel/issues/3592
features.append(feature(
name = "runtime_library_search_directories",
flag_sets = [flag_set(
actions = [
ACTION_NAMES.cpp_link_executable,
ACTION_NAMES.cpp_link_dynamic_library,
ACTION_NAMES.cpp_link_nodeps_dynamic_library,
],
flag_groups = [flag_group(
expand_if_available = "runtime_library_search_directories",
iterate_over = "runtime_library_search_directories",
flag_groups = [flag_group(
flags = ["-Wl,-rpath,$ORIGIN/%{runtime_library_search_directories}"],
)],
)],
)],
))

sysroot_path = "/dev/null"
if ctx.file.sysroot_dir:
sysroot_path = ctx.file.sysroot_dir.path
Expand Down

0 comments on commit f764d94

Please sign in to comment.