Skip to content

Optimize stripping prefix in replaceNeeded#635

Open
kugel- wants to merge 1 commit intoNixOS:masterfrom
kugel-:optimize_replace_needed
Open

Optimize stripping prefix in replaceNeeded#635
kugel- wants to merge 1 commit intoNixOS:masterfrom
kugel-:optimize_replace_needed

Conversation

@kugel-
Copy link

@kugel- kugel- commented Jan 28, 2026

We can avoid resizing .dynstr if the user just requested to strip a prefix. More importanly, we can avoid relocating the section to the end of the binary which is almost always mandatory since .dynstr only ever grows.

This is a common use case when replacing fully-qualified needed entries (e.g. absolute build paths) with just its base name (to have the runtime linker do the search).

Thank you!

Please do your best to include a regression test
so that the quality of future releases can be preserved.

We can avoid resizing .dynstr if the user just requested to strip
a prefix. More importanly, we can avoid relocating the section
to the end of the binary which is almost always mandatory since
.dynstr only ever grows.

This is a common use case when replacing fully-qualified
needed entries (e.g. absolute build paths) with just its base
name (to have the runtime linker do the search).
@kugel- kugel- force-pushed the optimize_replace_needed branch from 6eb4128 to c1d1ca2 Compare January 28, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant