Skip to content

Commit ad04d7b

Browse files
shigekitargos
authored andcommitted
deps: add only avx2 configs for OpenSSL-1.1.1
OpenSSL-1.1.1 has new support of AVX-512 but AVX-2 asm files still need to be generated for the older assembler support to keep backward compatibilities. PR-URL: #25381 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org> Backport-PR-URL: #25688
1 parent 670f100 commit ad04d7b

File tree

6 files changed

+155
-14
lines changed

6 files changed

+155
-14
lines changed

deps/openssl/config/Makefile

+7-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ linux-ppc64 linux-ppc64le linux32-s390x linux64-s390x \
1616
solaris-x86-gcc solaris64-x86_64-gcc VC-WIN64A VC-WIN32
1717

1818
CC = gcc
19+
FAKE_GCC = ../config/fake_gcc.pl
20+
1921
CONFIGURE = ./Configure
2022
# no-comp: against CRIME attack
2123
# no-shared: openssl-cli needs static link
@@ -45,12 +47,12 @@ all: $(ARCHS) replace
4547
$(ARCHS):
4648
# Remove openssl .gitignore to follow nodejs .gitignore
4749
if [ -e $(GITIGNORE) ]; then rm $(GITIGNORE); fi
48-
if [ "$(findstring darwin, $@)" = "" ]; then \
49-
cd $(OPSSL_SRC); $(NO_WARN_ENV) ARC=$@ CC=$(CC) $(PERL) $(CONFIGURE) $(COPTS) $@; \
50-
else \
51-
cd $(OPSSL_SRC); $(NO_WARN_ENV) ARC=$@ CC=./fake_gcc.pl $(PERL) $(CONFIGURE) $(COPTS) $@; \
52-
fi
50+
cd $(OPSSL_SRC); $(NO_WARN_ENV) CC=$(CC) $(PERL) $(CONFIGURE) $(COPTS) $@;
5351
$(PERL) -w -I$(OPSSL_SRC) $(GENERATE) asm $@
52+
# Confgure asm_avx2 and generate upto avx2 support
53+
cd $(OPSSL_SRC); $(NO_WARN_ENV) CC=$(FAKE_GCC) $(PERL) $(CONFIGURE) \
54+
$(COPTS) $@;
55+
$(PERL) -w -I$(OPSSL_SRC) $(GENERATE) asm_avx2 $@
5456
# Confgure no-asm and generate no-asm sources
5557
cd $(OPSSL_SRC); $(NO_WARN_ENV) $(PERL) $(CONFIGURE) $(COPTS) \
5658
no-asm $@;

deps/openssl/config/fake_gcc.pl

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#! /usr/bin/env perl
22
use 5.10.0;
33
use strict;
4-
my $arch = $ENV{ARC};
4+
my $args = join(' ', @ARGV);
5+
56
my $ret;
6-
if ($arch =~ /^darwin/) {
7-
$ret = "Apple LLVM version 10.0.0 (clang-1000.11.45.2)\n";
7+
if ($args eq '-Wa,-v -c -o /dev/null -x assembler /dev/null') {
8+
$ret = "GNU assembler version 2.23.52.0.1 (x86_64-redhat-linux) using BFD version version 2.23.52.0.1-30.el7_1.2 20130226\n";
89
} else {
9-
$ret = `gcc -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`;
10+
$ret = `gcc $args`;
1011
}
1112
print STDOUT $ret;

deps/openssl/config/generate_gypi.pl

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
my $asm = $ARGV[0];
1818

19-
unless ($asm eq "asm" or $asm eq "no-asm") {
19+
unless ($asm eq "asm" or $asm eq "asm_avx2" or $asm eq "no-asm") {
2020
die "Error: $asm is invalid argument";
2121
}
2222
my $arch = $ARGV[1];
@@ -25,15 +25,15 @@
2525
my $nasm_banner = `nasm -v`;
2626
die "Error: nasm is not installed." if (!$nasm_banner);
2727

28-
my $nasm_version_min = 2.11;
28+
my $nasm_version_min = 2.13.3;
2929
my ($nasm_version) = ($nasm_banner =~/^NASM version ([0-9]\.[0-9][0-9])+/);
3030
if ($nasm_version < $nasm_version_min) {
3131
die "Error: nasm version $nasm_version is too old." .
3232
"$nasm_version_min or higher is required.";
3333
}
3434

3535
# gas version check
36-
my $gas_version_min = 2.26;
36+
my $gas_version_min = 2.30;
3737
my $gas_banner = `gcc -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`;
3838
my ($gas_version) = ($gas_banner =~/GNU assembler version ([2-9]\.[0-9]+)/);
3939
if ($gas_version < $gas_version_min) {

deps/openssl/openssl-cl_asm_avx2.gypi

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
'conditions': [
3+
['target_arch=="ppc" and OS=="aix"', {
4+
'includes': ['config/archs/aix-gcc/asm_avx2/openssl-cl.gypi'],
5+
}, 'target_arch=="ppc" and OS=="linux"', {
6+
'includes': ['config/archs/linux-ppc/asm_avx2/openssl-cl.gypi'],
7+
}, 'target_arch=="ppc64" and OS=="aix"', {
8+
'includes': ['config/archs/aix64-gcc/asm_avx2/openssl-cl.gypi'],
9+
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
10+
'includes': ['config/archs/linux-ppc64le/asm_avx2/openssl-cl.gypi'],
11+
}, 'target_arch=="ppc64" and OS=="linux"', {
12+
'includes': ['config/archs/linux-ppc64/asm_avx2/openssl-cl.gypi'],
13+
}, 'target_arch=="s390" and OS=="linux"', {
14+
'includes': ['config/archs/linux32-s390x/asm_avx2/openssl-cl.gypi'],
15+
}, 'target_arch=="s390x" and OS=="linux"', {
16+
'includes': ['config/archs/linux64-s390x/asm_avx2/openssl-cl.gypi'],
17+
}, 'target_arch=="arm" and OS=="linux"', {
18+
'includes': ['config/archs/linux-armv4/asm_avx2/openssl-cl.gypi'],
19+
}, 'target_arch=="arm64" and OS=="linux"', {
20+
'includes': ['config/archs/linux-aarch64/asm_avx2/openssl-cl.gypi'],
21+
}, 'target_arch=="ia32" and OS=="linux"', {
22+
'includes': ['config/archs/linux-elf/asm_avx2/openssl-cl.gypi'],
23+
}, 'target_arch=="ia32" and OS=="mac"', {
24+
'includes': ['config/archs/darwin-i386-cc/asm_avx2/openssl-cl.gypi'],
25+
}, 'target_arch=="ia32" and OS=="solaris"', {
26+
'includes': ['config/archs/solaris-x86-gcc/asm_avx2/openssl-cl.gypi'],
27+
}, 'target_arch=="ia32" and OS=="win"', {
28+
'includes': ['config/archs/VC-WIN32/asm_avx2/openssl-cl.gypi'],
29+
}, 'target_arch=="ia32"', {
30+
# noasm linux-elf for other ia32 platforms
31+
'includes': ['config/archs/linux-elf/asm_avx2/openssl-cl.gypi'],
32+
}, 'target_arch=="x64" and OS=="freebsd"', {
33+
'includes': ['config/archs/BSD-x86_64/asm_avx2/openssl-cl.gypi'],
34+
}, 'target_arch=="x64" and OS=="mac"', {
35+
'includes': ['config/archs/darwin64-x86_64-cc/asm_avx2/openssl-cl.gypi'],
36+
}, 'target_arch=="x64" and OS=="solaris"', {
37+
'includes': ['config/archs/solaris64-x86_64-gcc/asm_avx2/openssl-cl.gypi'],
38+
}, 'target_arch=="x64" and OS=="win"', {
39+
'includes': ['config/archs/VC-WIN64A/asm_avx2/openssl-cl.gypi'],
40+
}, 'target_arch=="x64" and OS=="linux"', {
41+
'includes': ['config/archs/linux-x86_64/asm_avx2/openssl-cl.gypi'],
42+
}, {
43+
# Other architectures don't use assembly
44+
'includes': ['config/archs/linux-x86_64/asm_avx2/openssl-cl.gypi'],
45+
}],
46+
],
47+
}

deps/openssl/openssl.gyp

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2+
'variables': {
3+
'gas_version%': 0,
4+
'llvm_version%': 0,
5+
'nasm_version%': 0,
6+
},
27
'targets': [
38
{
49
'target_name': 'openssl',
@@ -11,10 +16,15 @@
1116
'OPENSSL_NO_HW',
1217
],
1318
'conditions': [
14-
[ 'openssl_no_asm==0', {
19+
[ 'openssl_no_asm==1', {
20+
'includes': ['./openssl_no_asm.gypi'],
21+
}, 'gas_version >= "2.26" or nasm_version >= "2.11.8"', {
22+
# Require AVX512IFMA supported. See
23+
# https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html
24+
# Currently crypto/poly1305/asm/poly1305-x86_64.pl requires AVX512IFMA.
1525
'includes': ['./openssl_asm.gypi'],
1626
}, {
17-
'includes': ['./openssl_no_asm.gypi'],
27+
'includes': ['./openssl_asm_avx2.gypi'],
1828
}],
1929
],
2030
'direct_dependent_settings': {

deps/openssl/openssl_asm_avx2.gypi

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
'conditions': [
3+
['target_arch=="ppc" and OS=="aix"', {
4+
'includes': ['config/archs/aix-gcc/asm_avx2/openssl.gypi'],
5+
}, 'target_arch=="ppc" and OS=="linux"', {
6+
'includes': ['config/archs/linux-ppc/asm_avx2/openssl.gypi'],
7+
}, 'target_arch=="ppc64" and OS=="aix"', {
8+
'includes': ['config/archs/aix64-gcc/asm_avx2/openssl.gypi'],
9+
}, 'target_arch=="ppc64" and OS=="linux" and node_byteorder =="little"', {
10+
'includes': ['config/archs/linux-ppc64le/asm_avx2/openssl.gypi'],
11+
}, 'target_arch=="ppc64" and OS=="linux"', {
12+
'includes': ['config/archs/linux-ppc64/asm_avx2/openssl.gypi'],
13+
}, 'target_arch=="s390" and OS=="linux"', {
14+
'includes': ['config/archs/linux32-s390x/asm_avx2/openssl.gypi'],
15+
}, 'target_arch=="s390x" and OS=="linux"', {
16+
'includes': ['config/archs/linux64-s390x/asm_avx2/openssl.gypi'],
17+
}, 'target_arch=="arm" and OS=="linux"', {
18+
'includes': ['config/archs/linux-armv4/asm_avx2/openssl.gypi'],
19+
}, 'target_arch=="arm64" and OS=="linux"', {
20+
'includes': ['config/archs/linux-aarch64/asm_avx2/openssl.gypi'],
21+
}, 'target_arch=="ia32" and OS=="linux"', {
22+
'includes': ['config/archs/linux-elf/asm_avx2/openssl.gypi'],
23+
}, 'target_arch=="ia32" and OS=="mac"', {
24+
'includes': ['config/archs/darwin-i386-cc/asm_avx2/openssl.gypi'],
25+
}, 'target_arch=="ia32" and OS=="solaris"', {
26+
'includes': ['config/archs/solaris-x86-gcc/asm_avx2/openssl.gypi'],
27+
}, 'target_arch=="ia32" and OS=="win"', {
28+
'includes': ['config/archs/VC-WIN32/asm_avx2/openssl.gypi'],
29+
'rules': [
30+
{
31+
'rule_name': 'Assemble',
32+
'extension': 'asm',
33+
'inputs': [],
34+
'outputs': [
35+
'<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
36+
],
37+
'action': [
38+
'nasm.exe',
39+
'-f win32',
40+
'-o', '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
41+
'<(RULE_INPUT_PATH)',
42+
],
43+
}
44+
],
45+
}, 'target_arch=="ia32"', {
46+
'includes': ['config/archs/linux-elf/asm_avx2/openssl.gypi'],
47+
}, 'target_arch=="x64" and OS=="freebsd"', {
48+
'includes': ['config/archs/BSD-x86_64/asm_avx2/openssl.gypi'],
49+
}, 'target_arch=="x64" and OS=="mac"', {
50+
'includes': ['config/archs/darwin64-x86_64-cc/asm_avx2/openssl.gypi'],
51+
}, 'target_arch=="x64" and OS=="solaris"', {
52+
'includes': ['config/archs/solaris64-x86_64-gcc/asm_avx2/openssl.gypi'],
53+
}, 'target_arch=="x64" and OS=="win"', {
54+
'includes': ['config/archs/VC-WIN64A/asm_avx2/openssl.gypi'],
55+
'rules': [
56+
{
57+
'rule_name': 'Assemble',
58+
'extension': 'asm',
59+
'inputs': [],
60+
'outputs': [
61+
'<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
62+
],
63+
'action': [
64+
'nasm.exe',
65+
'-f win64',
66+
'-DNEAR',
67+
'-Ox',
68+
'-g',
69+
'-o', '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
70+
'<(RULE_INPUT_PATH)',
71+
],
72+
}
73+
],
74+
}, 'target_arch=="x64" and OS=="linux"', {
75+
'includes': ['config/archs/linux-x86_64/asm_avx2/openssl.gypi'],
76+
}, {
77+
# Other architectures don't use assembly
78+
'includes': ['config/archs/linux-x86_64/asm_avx2/openssl.gypi'],
79+
}],
80+
],
81+
}

0 commit comments

Comments
 (0)