Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc: optimize cross-compiled libraries #88988

Merged
merged 1 commit into from May 27, 2020

Conversation

tobim
Copy link
Contributor

@tobim tobim commented May 26, 2020

libstdc++ and a few other libraries are comiled with the options set in EXTRA_TARGET_FLAGS. Normally, this is filled form EXTRA_FLAGS inside of builder.sh, from which it inherits its optimization option.
For cross compilers EXTRA_TARGET_FLAGS is set by a dedicated function that does not specify any optimization, leading to sub-par runtime performance of many C++ programs.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

cc @Ericson2314 @matthewbauer

@tobim tobim requested a review from matthewbauer as a code owner May 26, 2020 22:31
@veprbl veprbl added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label May 26, 2020
@Ericson2314
Copy link
Member

We should deduplicate this stuff eventually, but I guess this is good for now. Can you add a comment about that?

`libstdc++` and a few other libraries are comiled with the options
set in `EXTRA_TARGET_FLAGS`. Normally, this is filled form
`EXTRA_FLAGS` inside of `builder.sh`, from which it inherits its
optimization option. For cross compilers `EXTRA_TARGET_FLAGS` is
set by a dedicated function that does not specify any optimization,
leading to sub-par runtime performance of many C++ programs.
@tobim tobim force-pushed the optimize-cross-libstdc++ branch from e447835 to 2be2b53 Compare May 27, 2020 08:07
@tobim
Copy link
Contributor Author

tobim commented May 27, 2020

@Ericson2314 done.

@matthewbauer matthewbauer merged commit 7e571eb into NixOS:master May 27, 2020
@tobim tobim deleted the optimize-cross-libstdc++ branch August 14, 2023 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 10.rebuild-darwin: 1-10 10.rebuild-linux: 11-100
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants