From nobody Thu May 2 09:05:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1500052767315706.924510638386; Fri, 14 Jul 2017 10:19:27 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C85DD2095D8D6; Fri, 14 Jul 2017 10:17:35 -0700 (PDT) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3F06C2095D8CF for ; Fri, 14 Jul 2017 10:17:34 -0700 (PDT) Received: by mail-wm0-x232.google.com with SMTP id i127so28952665wma.0 for ; Fri, 14 Jul 2017 10:19:23 -0700 (PDT) Received: from localhost.localdomain ([154.145.198.181]) by smtp.gmail.com with ESMTPSA id l73sm5593927wma.27.2017.07.14.10.19.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 10:19:21 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=q9culi+A05MDRkXxKDcQEQUzXVuWlLpq/hBHkvKY9ho=; b=d1dx0IZJlYj+qzKucMRABMdt0FlF8K42ESqaNlM/sTXqCmTy5mEmqjrYpkr/praaG4 rS1MEicIZ2a2LmMel0xE2DcHKWszou5NXZiHzcVsdMmusm5WGWH1gzAVWTjb8T7S33Ol rLc2AecywGENJFZOD6mx6opSiiEZODj7u37YI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=q9culi+A05MDRkXxKDcQEQUzXVuWlLpq/hBHkvKY9ho=; b=qpTL59069e0/SpxzKOwC9Z83IP7TuqqvXnOVX3upAAJwuDblxWsq5Ir/n9R1b1XxDX gs00FoP8l4Z7TouSn/HthKY7X3key6zOrKouYrFyLAI5/zt3t3hQjFKCR/GmAaYzJDsT KwT0J72B7q/voJtu4t+e8BFPwudfLHYgyGxP4rBBD6ndySVgFfdNiJAgSmyczb0ElSQI iwUf4M/LncibeAJvR5bm8iM+pLoXgiJYrKq6bEnglzzPhUgdwGDloi/umHf1Kqtvx4C7 Sis+Etkdaejb2RRnXc6KQhYRbIxCRJr721T3jbhoqrBmofxiwpnW7mO3wKselQEOeoZz eNPQ== X-Gm-Message-State: AIVw113Ry9GMiF0e7jykLhYa2ee49Z+dNzeZuzscXLxAICV+J1jETEc8 owbOnFwjfhF2kfDc3OZx0Q== X-Received: by 10.28.154.19 with SMTP id c19mr3272853wme.87.1500052761955; Fri, 14 Jul 2017 10:19:21 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, qin.long@intel.com Date: Fri, 14 Jul 2017 18:19:13 +0100 Message-Id: <20170714171913.28524-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 Subject: [edk2] [PATCH] CryptoPkg/OpensslLib AARCH64: clear XIP CC flags X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ting.ye@intel.com, lersek@redhat.com, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit 0df6c8c157af ("BaseTools/tools_def AARCH64: avoid SIMD registers in XIP code") updated the compiler flags used by AARCH64 when building modules (including BASE libraries) that may execute before the MMU is enabled. This broke the build for OpensslLib/OpensslLibCrypto because the SIMD register file is shared with the FPU, and since OpenSSL contains some references to float/double types (which are mostly unused for UEFI btw), disabling floating point prevents the compiler from building OpenSSL at all. When introducing the support for XIP CC flags, we were aware that this would affect BASE libraries as well, but were not expecting this to have any performance impact. However, in the case of software crypto, it makes sense not to needlessly inhibit the compiler's ability to generate fast code, and even if OpenssLib is a BASE library, it is guaranteed not to run with the MMU off, so we can create a local exception, and clear its XIP CC flags for AARCH64. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Acked-by: Laszlo Ersek Reviewed-by: Leif Lindholm Reviewed-by: Long Qin --- Note that this un-breaks the currently broken AARCH64 build for platforms that have secure boot enabled CryptoPkg/Library/OpensslLib/OpensslLib.inf | 11 +++++++++++ CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/CryptoPkg/Library/OpensslLib/OpensslLib.inf b/CryptoPkg/Librar= y/OpensslLib/OpensslLib.inf index cbabb34bdd7c..1d15da6660b2 100644 --- a/CryptoPkg/Library/OpensslLib/OpensslLib.inf +++ b/CryptoPkg/Library/OpensslLib/OpensslLib.inf @@ -580,3 +580,14 @@ [BuildOptions] RVCT:*_*_ARM_CC_FLAGS =3D $(OPENSSL_FLAGS) --library_interface=3Daea= bi_clib99 --diag_suppress=3D1296,1295,550,1293,111,68,177,223,144,513,188,1= 28,546,1,3017 -JCryptoPkg/Include XCODE:*_*_IA32_CC_FLAGS =3D -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FL= AGS) -w XCODE:*_*_X64_CC_FLAGS =3D -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FL= AGS) -w + + # + # AARCH64 uses strict alignment and avoids SIMD registers for code that = may execute + # with the MMU off. This involves SEC, PEI_CORE and PEIM modules as well= as BASE + # libraries, given that they may be included into such modules. + # This library, even though of the BASE type, is never used in such case= s, and + # avoiding the SIMD register file (which is shared with the FPU) prevent= s the + # compiler from successfully building some of the OpenSSL source files t= hat + # use floating point types, so clear the flags here. + # + GCC:*_*_AARCH64_CC_XIPFLAGS =3D=3D diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/= Library/OpensslLib/OpensslLibCrypto.inf index 026b551bcafa..6fc8884da492 100644 --- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf +++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf @@ -541,3 +541,14 @@ [BuildOptions] RVCT:*_*_ARM_CC_FLAGS =3D $(OPENSSL_FLAGS) --library_interface=3Daea= bi_clib99 --diag_suppress=3D1296,1295,550,1293,111,68,177,223,144,513,188,1= 28,546,1,3017 -JCryptoPkg/Include XCODE:*_*_IA32_CC_FLAGS =3D -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FL= AGS) -w XCODE:*_*_X64_CC_FLAGS =3D -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FL= AGS) -w + + # + # AARCH64 uses strict alignment and avoids SIMD registers for code that = may execute + # with the MMU off. This involves SEC, PEI_CORE and PEIM modules as well= as BASE + # libraries, given that they may be included into such modules. + # This library, even though of the BASE type, is never used in such case= s, and + # avoiding the SIMD register file (which is shared with the FPU) prevent= s the + # compiler from successfully building some of the OpenSSL source files t= hat + # use floating point types, so clear the flags here. + # + GCC:*_*_AARCH64_CC_XIPFLAGS =3D=3D --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel