Files
buildroot/support/scripts/fix-rpath
Tobias Waldekranz 85376a7181 support/scripts/fix-rpath: Reduce overhead of parallelization
Rather than fork+exec:ing a whole bash process for every file of
interest, split up the work into ${PARALLEL_JOBS} separate file lists,
and then fork off a single worker per list.

Since workers now run in a fork, we also don't have to re-parse the
arguments on every call to patch_file().

In the worker, we also add a low-overhead check for the ELF magic,
which allows us to skip all non-ELFs without having to fork off
additional processes. In the event that we encounter an invalid ELF,
that is still taken care of by the existing exitcode-test in
patch_file().

On a 4-core/8-thread box, this cuts down the time it takes to fix the
RPATHS in the host directory from around 25s to 1.5s.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
[Peter: fix shellcheck issues]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2025-02-03 11:07:48 +01:00

6.0 KiB
Executable File