Select debug compression by linker capability#240
Merged
Conversation
Select compressed-debug formats according to each linker’s declared capability instead of globally lowering the policy. `mkClangTarget` keeps zstd as its default, while the four built-in Nixpkgs GNU/Linux cross targets explicitly use zlib because their cross-binutils linkers lack zstd support. Add focused native Wild+zstd and x86_64-to-AArch64 BFD+zlib link coverage and document the behavior. ### Details The built-in `mkClangTarget` inventory contains four Linux GNU targets and two native-only Darwin targets. A target matching the build architecture short-circuits through `mkNativeTarget`; non-native Linux cells use Nixpkgs target-prefixed GNU ld.bfd. Direct AArch64, i686, and RISC-V probes show those cross-binutils linkers reject zstd but accept zlib, while native Wild and mold accept zstd. Nixpkgs exposes no stable compression capability signal, so each built-in GNU cross target declares its known zlib policy explicitly rather than inferring support or globally lowering the default. Custom and future `mkClangTarget` users retain zstd by default and can declare another supported format explicitly. Native Wild/mold remain on zstd, and Darwin native behavior remains unchanged. The x86_64-linux check performs real native and AArch64 Cargo links, ties each configured format to its selected linker, verifies linker acceptance and ELF architecture, and requires compressed `.debug_info` from both outputs. The initial implementation and review used zlib for every `mkClangTarget`; user feedback identified that this degraded zstd-capable custom linkers. The capability-specific revision preserves zstd by default and limits zlib to the known-incompatible built-in cells. Independent re-review found no correctness, policy, test-quality, scope, or portability issues and returned PASS. Focused linker probes/builds, Linux and Darwin target evaluations, formatting, `nix flake check --no-build`, and `selfci check --candidate sqzoqwsromon` passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Posted by Tau
Summary
Select compressed-debug formats according to each linker's declared capability.
mkClangTargetkeeps zstd as the default; only the four built-in Nixpkgs GNU/Linux cross targets explicitly use zlib because their target-prefixedld.bfdbuilds reject zstd.Details
Native Wild and mold accept zstd and remain on zstd. Custom and future
mkClangTargetusers also retain zstd by default and may explicitly select another supported format. Native Darwin behavior is unchanged.The built-in non-native Linux cells use Nixpkgs target-prefixed GNU
ld.bfd. Direct AArch64, i686, and RISC-V probes report zstd unsupported and zlib supported. Nixpkgs exposes no stable compression-capability attribute, so those four target definitions declare their known zlib requirement instead of inferring support or globally lowering the policy.Enabling zstd in those BFD linkers would require rebuilding cross binutils and rewrapping each cross Clang toolchain. This change avoids that dependency/cache expansion while preserving zstd everywhere the selected linker supports it.
The focused check performs two real Cargo links:
It verifies the exact linker/flag combinations, option acceptance, ELF architecture, and compressed
.debug_infoin both outputs. The check is independent of PR #239.Reviewers can validate the change with
nix develop -c selfci check --candidate sqzoqwsromon.