From b935e6371008aa508d1a05b67ef0f6e8b8f4d55c Mon Sep 17 00:00:00 2001 From: Shigeki Ohtsu Date: Mon, 23 Apr 2018 21:26:28 +0900 Subject: [PATCH] build: limit assembler version check on x86 The current openssl checks assembler version only x86_64 or ia32 target arch for use of AES-NI, AVX and AVX2. This requires --openssl-no-asm option during configure when an older assembler version is found only on x86_64 or ia32. PR-URL: https://github.com/nodejs/node/pull/20226 Fixes: https://github.com/nodejs/node/issues/19944 Refs: https://github.com/nodejs/node/pull/20217 Reviewed-By: James M Snell Reviewed-By: Ali Ijaz Sheikh Reviewed-By: Myles Borins Reviewed-By: Richard Lau --- BUILDING.md | 6 ++++-- configure | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 618427eaefb881..9690e826c396f8 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -94,14 +94,16 @@ Depending on host platform, the selection of toolchains may vary. #### OpenSSL asm support OpenSSL-1.1.0 requires the following asssembler version for use of asm -support. +support on x86_64 and ia32. * gas (GNU assembler) version 2.23 or higher * xcode version 5.0 or higher * llvm version 3.3 or higher * nasm version 2.10 or higher in Windows -Otherwise, `--openssl-no-asm` is added with warning in configure. +Otherwise `configure` will fail with an error. This can be avoided by +either providing a newer assembler as per the list above or by +using the `--openssl-no-asm` flag. *Note:* The forthcoming OpenSSL-1.1.1 will require higher version. Please refer diff --git a/configure b/configure index 0294e3a1311466..c1170f9a132a16 100755 --- a/configure +++ b/configure @@ -1106,6 +1106,8 @@ def configure_openssl(o): o['defines'] += ['NODE_WITHOUT_NODE_OPTIONS'] if not options.shared_openssl and not options.openssl_no_asm: + is_x86 = 'x64' in variables['target_arch'] or 'ia32' in variables['target_arch'] + # supported asm compiler for AVX2. See https://github.com/openssl/openssl/ # blob/OpenSSL_1_1_0-stable/crypto/modes/asm/aesni-gcm-x86_64.pl#L52-L69 openssl110_asm_supported = \ @@ -1114,7 +1116,7 @@ def configure_openssl(o): ('llvm_version' in variables and float(variables['llvm_version']) >= 3.3) or \ ('nasm_version' in variables and float(variables['nasm_version']) >= 2.10) - if not openssl110_asm_supported: + if is_x86 and not openssl110_asm_supported: error('''Did not find a new enough assembler, install one or build with --openssl-no-asm. Please refer to BUILDING.md''')