Skip to content

gcc: extend stripping of .a libraries and .o objects#184908

Merged
trofi merged 1 commit intoNixOS:stagingfrom
trofi:expand-gcc-strip
Aug 6, 2022
Merged

gcc: extend stripping of .a libraries and .o objects#184908
trofi merged 1 commit intoNixOS:stagingfrom
trofi:expand-gcc-strip

Conversation

@trofi
Copy link
Contributor

@trofi trofi commented Aug 2, 2022

The initial intent was to strip .a and .o files, not .a.o files.
While at it expanded stripping for $lib output as well.

Without the change libgcc.a was not stripped and .debug* sections
made into final binaries. It's not a problem on it's own, but it's an
unintended side-effect. Noticed on crystal_1_0 test failure where
crystal was not able to handle dwarf-5.

While at it allowed absolute file names to be passed to stripDebugList
and friends.

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@trofi trofi requested a review from matthewbauer as a code owner August 2, 2022 22:09
@trofi trofi marked this pull request as draft August 2, 2022 22:09
@trofi
Copy link
Contributor Author

trofi commented Aug 2, 2022

Will convert from draft when test a few native and cross targets.

@ofborg ofborg bot added 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Aug 2, 2022
The initial intent was to strip .a and .o files, not .a.o files.
While at it expanded stripping for $lib output as well.

Without the change `libgcc.a` was not stripped and `.debug*` sections
made into final binaries. It's not a problem on it's own, but it's an
unintended side-effect. Noticed on `crystal_1_0` test failure where
`crystal` was not able to handle `dwarf-5`.

While at it allowed absolute file names to be passed to stripDebugList
and friends.
@trofi trofi force-pushed the expand-gcc-strip branch from 418abd1 to c817efe Compare August 3, 2022 21:29
@trofi trofi changed the title gcc: fix stripping of .a libraries and . objects gcc: extend stripping of .a libraries and .o objects Aug 3, 2022
@trofi
Copy link
Contributor Author

trofi commented Aug 3, 2022

Tested stripping on x86_64-linux for:

  • stdenv.cc.cc
  • pkgsCross.mingw32.stdenv.cc.cc
  • pkgsCross.ppc64.stdenv.cc.cc
  • pkgsCross.armv7l-hf-multiplatform.stdenv.cc.cc

All toolchains are still able to link executables and run them. Ready for review.

@trofi trofi marked this pull request as ready for review August 3, 2022 22:52
@trofi trofi requested a review from Ericson2314 as a code owner August 3, 2022 22:52
@ofborg ofborg bot added the 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. label Aug 3, 2022
@trofi
Copy link
Contributor Author

trofi commented Aug 4, 2022

This PR also fixes original problem with crystal_1_0_0 and crystal_1_1_0 (also fixed by 357ae16)

@trofi trofi merged commit 57080fa into NixOS:staging Aug 6, 2022
@trofi trofi deleted the expand-gcc-strip branch August 6, 2022 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant