Skip to content

fix(nixos): add per-version gcroots for patched solc linker#188

Open
0xferrous wants to merge 1 commit into
alloy-rs:masterfrom
0xferrous:push-ymnorysmprrl
Open

fix(nixos): add per-version gcroots for patched solc linker#188
0xferrous wants to merge 1 commit into
alloy-rs:masterfrom
0xferrous:push-ymnorysmprrl

Conversation

@0xferrous
Copy link
Copy Markdown

On NixOS, installed solc binaries are patched to use a dynamic linker from
the nix store. Without a gcroot, that interpreter path can be garbage-collected,
breaking previously installed solc binaries.

This change resolves the linker path explicitly, adds a persistent gcroot under
the SVM data_dir in .gcroots for each solc version, and then patches the binary
to that resolved interpreter. Using per-version roots avoids repointing a shared root
when linker paths change across system updates.

Adds a dedicated error variant for gcroot creation failures.

On NixOS, installed solc binaries are patched to use a dynamic linker from
the nix store. Without a gcroot, that interpreter path can be garbage-collected,
breaking previously installed solc binaries.

This change resolves the linker path explicitly, adds a persistent gcroot under
the SVM `data_dir` in `.gcroots` for each solc version, and then patches the binary
to that resolved interpreter. Using per-version roots avoids repointing a shared root
when linker paths change across system updates.

Adds a dedicated error variant for gcroot creation failures.
@0xferrous 0xferrous force-pushed the push-ymnorysmprrl branch from 8564246 to 4b56b3d Compare March 3, 2026 12:08
Copy link
Copy Markdown
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea how to review this

maybe @DaniPopes has an idea

@zerosnacks
Copy link
Copy Markdown
Contributor

maybe @shekhirin / @joshieDo?

implementation generally makes sense to me

@DaniPopes
Copy link
Copy Markdown
Member

@decofe check this out

decofe

This comment was marked as resolved.

@0xferrous
Copy link
Copy Markdown
Author

It didn't error when i tried, it derives the root from the given path.

$ nix-store --add-root /tmp/test --realise /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/ld-linux-x86-64.so.2
$ nix-store --gc --print-roots | grep /tmp/test
/tmp/test -> /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47

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.

5 participants