0
Fork 0
mirror of https://github.com/zml/zml.git synced 2026-11-16 19:11:09 +00:00
zml/bazel/patchelf.bzl
Kevin Barre e9685a3662
zml/bazel: simplify patchelf execution and fix RPATH removal (#916)
The `@patchelf` version 0.18.0 is more capable and can now construct
something like

```bash
patchelf \
  --add-needed somelib.so \
  --force-rpath \
  --set-rpath '/home/kevin/sdk/lib' \
  --rename-dynamic-symbols patched_tcc.symbols \
  --output patched_tcc/furiosa-tcc \
  somebinary
```

So now we do not need to spawn a shell and do all the cp, chmod, and the
successive patchelf command

Before 

```bash
remove_rpath = ["some/directory"]
```

`--remove-rpath` is a flag that `Removes the entire embedded search
path` and not an individual directory

will contruct something like `patchelf --remove-rpath some/directory
patched.so` but `--remove-rpath` do not take arguments

Switch to `remove_rpath = True` to ensure something like `patchelf
--remove-rpath --output patched.so original.so` the `--remove-rpath` is
now used just after the patchelf to ensure correct usage flag placement.
2026-10-20 11:49:41 +02:00

80 lines
3 KiB