Skip to content

Optimize stripping prefix in replaceNeeded#635

Open
kugel- wants to merge 1 commit into
NixOS:masterfrom
kugel-:optimize_replace_needed
Open

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

Conversation

@kugel-

@kugel- kugel- commented Jan 28, 2026

Copy link
Copy Markdown

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.

@kugel- kugel- force-pushed the optimize_replace_needed branch from 6eb4128 to c1d1ca2 Compare January 28, 2026 20:17
@kugel-

kugel- commented May 13, 2026

Copy link
Copy Markdown
Author

@edolstra @Ericson2314 Can one of you guys look at this please?

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 c1d1ca2 to 99c498e Compare June 17, 2026 10:53
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