Skip to content
Merged
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
15 changes: 13 additions & 2 deletions infra/base-images/base-builder/indexer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,24 @@ def patch_binary_rpath_and_interpreter(
binary_path: os.PathLike[str],
lib_mount_path: pathlib.Path,
ld_binary_path: pathlib.Path = LD_BINARY_PATH_X86_64,
extra_rpath_entries: Sequence[pathlib.Path] = (),
):
"""Patches the binary rpath and interpreter."""
"""Patches the binary rpath and interpreter.

Args:
binary_path: Path to the ELF binary to patch.
lib_mount_path: Primary library directory. Used as the main RPATH entry and
to resolve the ELF interpreter (ld-linux).
ld_binary_path: Basename / path of the dynamic linker.
extra_rpath_entries: Additional directories prepended to the RPATH (searched
before ``lib_mount_path``).
"""
rpath = ":".join(p.as_posix() for p in [*extra_rpath_entries, lib_mount_path])
subprocess.run(
[
"patchelf",
"--set-rpath",
lib_mount_path.as_posix(),
rpath,
"--force-rpath",
binary_path,
],
Expand Down
Loading