Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965432AbbEMU5N (ORCPT ); Wed, 13 May 2015 16:57:13 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:61791 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965142AbbEMU5K (ORCPT ); Wed, 13 May 2015 16:57:10 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Dan Streetman , Herbert Xu , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] lib: fix 842 build on 32-bit architectures Date: Wed, 13 May 2015 22:56:39 +0200 Message-ID: <2802721.Q9KnE9eNH4@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:Z2zD0Bv0knWpjqlYdzuuCpzpfufhwKtV1Zlqb6yMaZ/enAXfiYq RG6qQj0LiOQ4Sys1t6My1ovrdoaKw303LiRWkkxUHYHQ05uQMb1OTkMoSq7MHfoQWJEJF/r erqCcpJvZvQJT3Qdkc+wzxWQoHhT65jBNAkk4iM9ngvwsmur7wbQqvOWOtpLGREO29aHQhz ulfx/b3w9+xvdSQ7lSgpQ== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1486 Lines: 40 Building the 842 code on 32-bit ARM currently results in this link error: ERROR: "__aeabi_uldivmod" [lib/842/842_decompress.ko] undefined! The reason is that the __do_index function performs a 64-bit division by a power-of-two number, but it has no insight into the function arguments. By marking that function inline, the fsize argument is always known at the time that do_index is called, and the compiler is able to replace the extremely expensive 64-bit division with a cheap constant shift operation. Aside from fixing that link error, this approach should also improve both code size and performance on 32-bit architectures significantly. Signed-off-by: Arnd Bergmann --- Found while building arm32 allmodconfig with gcc-5.0 diff --git a/lib/842/842_decompress.c b/lib/842/842_decompress.c index 6b2b45aecde3..285bf6b6959c 100644 --- a/lib/842/842_decompress.c +++ b/lib/842/842_decompress.c @@ -169,7 +169,7 @@ static int do_data(struct sw842_param *p, u8 n) return 0; } -static int __do_index(struct sw842_param *p, u8 size, u8 bits, u64 fsize) +static inline int __do_index(struct sw842_param *p, u8 size, u8 bits, u64 fsize) { u64 index, offset, total = round_down(p->out - p->ostart, 8); int ret; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/