openssl: prevent -march= flags from being added on mips#244255
Merged
1 commit merged intomasterfrom Jul 31, 2023
unknown repository
Merged
openssl: prevent -march= flags from being added on mips#2442551 commit merged intomasterfrom unknown repository
1 commit merged intomasterfrom
unknown repository
Conversation
Openssl assumes that CFLAGS contains all of the flags that will be
passed to the compiler. This assumption fails for nixpkgs due to
our cc-wrapper.
On mips platforms, openssl scans CFLAGS to see if the user passed a
-march flag; if not, it adds its own:
if ($target =~ /linux.*-mips/ && !$disabled{asm}
&& !grep { $_ =~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) {
# minimally required architecture flags for assembly modules
my $value;
$value = '-mips2' if ($target =~ /mips32/);
$value = '-mips3' if ($target =~ /mips64/);
unshift @{$config{cflags}}, $value;
unshift @{$config{cxxflags}}, $value if $config{CXX};
}
Unfortunately since nixpkgs adds `-march=` in the wrapper, rather
than the CFLAGS, openssl can't see it. The result is two
conflicting `-march=` flags and a build failure when the user has
customized `hostPlatform.gcc.arch`:
openssl-mips64el-unknown-linux-gnuabin32> mips64el-unknown-linux-gnuabin32-gcc -I. -Iinclude -Iapps/include -fPIC -pthread -mabi=n32 -mips3 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSLDIR="\"/nix/store/8kwvrgwdk56ml6sz5swr71fv9mv4592w-openssl-mips64el-unknown-linux-gnuabin32-3.0.9/etc/ssl\"" -DENGINESDIR="\"/nix/store/8kwvrgwdk56ml6sz5swr71fv9mv4592w-openssl-mips64el-unknown-linux-gnuabin32-3.0.9/lib/engines-3\"" -DMODULESDIR="\"/nix/store/8kwvrgwdk56ml6sz5swr71fv9mv4592w-openssl-mips64el-unknown-linux-gnuabin32-3.0.9/lib/ossl-modules\"" -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -MMD -MF apps/lib/libapps-lib-engine.d.tmp -MT apps/lib/libapps-lib-engine.o -c -o apps/lib/libapps-lib-engine.o apps/lib/engine.c
cc1: error: '-mips3' conflicts with the other architecture options, which specify a mips64r2 processor
cc1: error: '-mips3' conflicts with the other architecture options, which specify a mips64r2 processor
make[1]: *** [Makefile:4254: apps/lib/libapps-lib-app_libctx.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:4262: apps/lib/libapps-lib-app_params.o] Error 1
make[1]: *** [Makefile:4270: apps/lib/libapps-lib-app_provider.o] Error 1
This commit defeats the perl code above by passing `CFLAGS=-march`
to openssl's `./Configure` script.
This pull request was closed.
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.
Description of changes
Openssl assumes that CFLAGS contains all of the flags that will be passed to the compiler. This assumption fails for nixpkgs due to our cc-wrapper.
On mips platforms, openssl scans CFLAGS to see if the user passed a -march flag; if not, it adds its own:
Unfortunately since nixpkgs adds
-march=in the wrapper, rather than the CFLAGS, openssl can't see it. The result is two conflicting-march=flags and a build failure when the user has customizedhostPlatform.gcc.arch:This commit defeats the perl code above by passing
CFLAGS=-marchto openssl's./Configurescript.Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)