RFC: enable split-object compilation for static build#109652
Draft
KAction wants to merge 1 commit intoNixOS:masterfrom
Draft
RFC: enable split-object compilation for static build#109652KAction wants to merge 1 commit intoNixOS:masterfrom
KAction wants to merge 1 commit intoNixOS:masterfrom
Conversation
Member
|
I marked this as a draft to not accidentally merge it and break busybox. Feel free to undraft it when you think it is ready. |
|
I marked this as stale due to inactivity. → More info |
Create new adapter that passes extra flags through NIX_CFLAGS_COMPILE
and NIX_CFLAGS_LINK that instruct linker to eliminate unused symbols (as
opposed to unused objects).
Disk usage save varies greatly: pkgsStatic.mmh won a lot (9.4Mb -> 8.2Mb),
pkgsStatic.coreutils improvement is around 10Kb out of 9Mb.
This patch is imperfect and does not seem to cause rebuild of musl libc,
so improvement may be bigger. Another problem is that it breaks packages
that seems to do partial linkage, e.g busybox:
GEN include/applet_tables.h include/NUM_APPLETS.h
HOSTCC applets/usage_pod
CC applets/applets.o
LD applets/built-in.o
/nix/store/f7b0y2q80kgnqjkjmh7cng048wsy6mw9-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_6
4-unknown-linux-musl-ld: gc-sections requires either an entry or an undefined symbol
collect2: error: ld returned 1 exit status
make[1]: *** [scripts/Makefile.build:264: applets/built-in.o] Error 1
make: *** [Makefile:372: applets_dir] Error 2
So I am looking for advice where and how to apply these changes.
42d7971 to
dfea967
Compare
|
I marked this as stale due to inactivity. → More info |
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.
Create new adapter that passes extra flags through NIX_CFLAGS_COMPILE
and NIX_CFLAGS_LINK that instruct linker to eliminate unused symbols (as
opposed to unused objects).
Disk usage save varies greatly: pkgsStatic.mmh won a lot (9.4Mb -> 8.2Mb),
pkgsStatic.coreutils improvement is around 10Kb out of 9Mb.
This patch is imperfect and does not seem to cause rebuild of musl libc,
so improvement may be bigger. Another problem is that it breaks packages
that seems to do partial linkage, e.g busybox:
/nix/store/f7b0y2q80kgnqjkjmh7cng048wsy6mw9-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_6
4-unknown-linux-musl-ld: gc-sections requires either an entry or an undefined symbol
collect2: error: ld returned 1 exit status
make[1]: *** [scripts/Makefile.build:264: applets/built-in.o] Error 1
make: *** [Makefile:372: applets_dir] Error 2
So I am looking for advice where and how to apply these changes.
Motivation for this change
Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)