From patchwork Fri Feb 2 16:21:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 126747 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp785379ljc; Fri, 2 Feb 2018 08:21:38 -0800 (PST) X-Google-Smtp-Source: AH8x224rCNoJBJObJDh+n3T/0FalML1KswYlKZnX9rGioMAfE463Noj5hgbdJj68CTjOUVmNgaNZ X-Received: by 10.101.80.75 with SMTP id k11mr20730817pgo.451.1517588498410; Fri, 02 Feb 2018 08:21:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517588498; cv=none; d=google.com; s=arc-20160816; b=YYZszRUJCNLRuBD7Ws5zl/mg4y7TI6+XETg2aLHsho7dAKQsXD8LJ5a0+nd52xYma+ HIT3kDYelprhYAbH5DKXDRG6pQ8BJ+D++XXtCbYaL3SM+Sop6YDg2t6k7p+YD0KL8ZcE usMRXS1SWEb13W+tu8omW9nLBOP5ZvtVT3HBp1BjG9hrMJU05ITy7qJMioY0At51i3jr kZxIVwGJGhmeoAHxg9oWRgs7L5NxRUP8lRwZGuEqPV9ASnClZbSt5tHYuwX+ab8bfrVi suD3ygTqZFIgrkNZjyAgwvk51AWbvPn93UW+UKSBYeYIKVeIFq9t0EFWaSPW2y8LPIp0 UMBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=925H+tZhzhNDpXlC39VwfYueuWn8XG3WxOb95JIOLY8=; b=OOLQOin9cw1hGQVNfWgpaaDZhU1KGaRvakniAe2BcXJT2mjtKkKHpsvB1e77GvPU3y 1Yo8CpzIQlOoDkfSP36wzzcaDrxvmxNQlTmbP57ZTKWW3eOX/nayDjIRBUMvss5pwVfp nnyzNXXV3Jw7XuOQ8I6B1115OTNuSvsUzol1HE19RAnIc0yR/QZRK5CSCdoTAf0fiVfh j2OKNO+duQ3mNZD+vF5id8oBJgIElz0VRTNMS3pEcbjuZGhskf/oEmS3ejwHfYAW52EE KGtRnUB5TTp5frbYGsNP/8u/tzBgmmGgGP36EIrOhpqzbkM6oG0qQB3ZyKk7NHmxHrDr 8AGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18si2056116pfg.271.2018.02.02.08.21.38; Fri, 02 Feb 2018 08:21:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752323AbeBBQVg (ORCPT + 28 others); Fri, 2 Feb 2018 11:21:36 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:51339 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbeBBQVW (ORCPT ); Fri, 2 Feb 2018 11:21:22 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0MGR4S-1eUUvN1edc-00DG8C; Fri, 02 Feb 2018 17:21:17 +0100 From: Arnd Bergmann To: Andi Kleen Cc: Nicolas Pitre , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Arnd Bergmann Subject: [PATCH 3/7] [HACK] x86: crypto: fix link error with LTO Date: Fri, 2 Feb 2018 17:21:00 +0100 Message-Id: <20180202162104.2300532-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180202161550.2106846-1-arnd@arndb.de> References: <20180202161550.2106846-1-arnd@arndb.de> X-Provags-ID: V03:K0:/4xB8qLKWRsQKS6zFXtOIoVYJOhfhv/XMhjjv3mV7IpzLd2Amsp DRXC8eRUisLpqAR1g38LRi2XbAdnCRUuBzpyO1w/wV+z5f8zxr0OX3FCJJ/tkcGUzK6xsjP 1XYem71gFR08CjBfcOHX/+8YxoDb9vGsQ7sU/0tY2ClEHLlzbs3pSiSXObJfqHR6jUrp2Fk 6aJAaDrQr0CT6yF1EnJrA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Uy4Kgz9iaYM=:FYA3RK/NLHdVC+0osIkE4a jPUeN7QhWD/Ztn1SoyP7tmuYD31Oje1A80SZ3/q4RG/RfmwDijE7xQWIkvZlxrsLFZbq2E2kA A3KGAjEWxEy4vB/3YOgDyvwkgHGxa8O8CBcxgem8O+4/RQ9UuOC+DEOKTXy/v+nwGpMzuv9vH Wd4QrqSArEMl3MLr6JGglUX4zupEs+sNGRC062hR6EHF+T7ix1Xk66CXo0iwPtM1XXj3xzr+i Y4FudgJcOrxSdnhXrNSahme13E+5S0FyjGqkSdnQhFo4NdycfhqTxKq0Q0LSmrTk4aWmy4SN8 hn8NzxuHicmWHMY3+HfwGMws2CRrSjRbGg/bKSXGYx42iLEYzNlahLsgpueVH4TZjQ/EM92Rp n3m+q3by5VOUQMoGsS8YLftEMUzqpYtNim9ilBeAPwgWyVy+e9GPGcO7yMR6pM3OQJVICUvnV xax4+dMfd61SFe6OSY9pOQjPhtoBDI5oRBninsk81PmluSkWr+YRzFCenQ8S6itmvX2WVepXd u93qnwFMOwZg0SIE0hUwUKnjBOgxzHQAlMMTmRxixYJxW0TIVpe1m9gq/ppJj8V/TaBoEsATG gZOd14nkQytgzrxYePmVXnLO8fHKoWY1+gRFiQw8RjVnx/m2/uCScKAkvq1onmLhn3eJeB//S txHEIfy9ym/PsPK+X6eA2riLHGDNRT5OvvFnbM3s4dioGC3mD/8eJCXSrze/w5ZZuf0N3WJDN 1EmU+mRAAi9LBQr9FN6UGFA2rUQRSTgJ5oGFgw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org crypto_it_tab and the other symbols like it are defined in crypto/aes_generic.c and exported for loadable modules. When building with LTO and CONFIG_TRIM_UNUSED_KSYMS, the exports are eliminated, since kbuild fails to take the users in the arch/x86/crypto/aes-i586-asm_32.S assembler file into account. This adds an ugly workaround by adding a reference to each symbol into aes_glue.c, which gets linked together with the assembler file. We obviously want to fix the CONFIG_TRIM_UNUSED_KSYMS logic to do the right thing here instead, but I couldn't come up with a good fix, so I use this instead to get a clean build for testing. This fix only works most of the time, but I still ran into some cases where combining an .S with a .c file did not produce the correct .ko file, as the lto linker apparently did not expect that kind of input. 'nm' on the file after 'ld -r' showed only the contents of the assembler file, and after the lto-ld stage, only the contents of the .c file are there. Signed-off-by: Arnd Bergmann --- arch/x86/crypto/aes_glue.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.9.0 diff --git a/arch/x86/crypto/aes_glue.c b/arch/x86/crypto/aes_glue.c index e26984f7ab8d..6da3e3c34a77 100644 --- a/arch/x86/crypto/aes_glue.c +++ b/arch/x86/crypto/aes_glue.c @@ -53,6 +53,11 @@ static struct crypto_alg aes_alg = { static int __init aes_init(void) { + /* ugly hack to force a link time dependency */ + if (&crypto_it_tab == &crypto_ft_tab || + &crypto_fl_tab == &crypto_il_tab) + return 0; + return crypto_register_alg(&aes_alg); }