Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1828499imm; Mon, 3 Sep 2018 10:29:15 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ5O+Ga1bfPMFnTeMXUOZvZw+q/46ZXkHpI3cJJpeaeW0aXL+1nF91uZ7cAr4we4JRaNtha X-Received: by 2002:a17:902:710c:: with SMTP id a12-v6mr29901798pll.310.1535995755738; Mon, 03 Sep 2018 10:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995755; cv=none; d=google.com; s=arc-20160816; b=uxa+v9kJzD0iwDg0WZzLK7FRMaQbSHGIdfrWcYvQQfMDu0WgGlDisVFXSLslZAxLOT oxGoZmCA6B4BoW1vPnMDUDxOFW89ogpfc+kK4o9NRtPsq9nyUJC2oZpKdbqe6V9VVOW5 5boCZOGlINZMCXe/cIOwHMnCJKOK1fLXvXhNKbR+9TsL/3FMeiFcA8V6iO8bgOUcOK2q 2RlhXvAipMZBRP4AcakWVckDCMNWgMHKpMjlOg3vbkj+/7QoIfFJ3PVib3yLLGlqs/X5 cB/ksQEM3qkV9vUZ8BzaFQ9nI9UUa/fn6fOdLLEnPMfe802y/6/Nqu4pBMP0dG1lHbWr 85ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9oxVGEdbsmr7+vrIwQzjxsnnn2pJsNiHc4tOELBHmbs=; b=f3+XYx0IGE19/FtQC2S7jUwA+Y4g+5tAyySVWxqvA69S3yJZ3uTOZzjkP9ZXLbZYBk 7DuESKGRNhiVkE4rkMetYzfqVXwvwz+jneLa+IZwbeISBNNEiJOHE/RqqaKxGh9a/Dje sfN1B1tYqGhwfu50rfzd9wYKtgKLDwnLyteXYDuPmEqfZplY4Kq433SOwO3GX5/8sDXm YAnwUsgTkSJCyqCtx0/FEAsUgug0n99KsuDS0FjKm6pymTlZ0D7ZNVotYgH9S4VX4yFo kUh1GExqsKnkPk4yu4lEhzwrWE6a8amnAeiDbKMojG0ubTiuB4+0vPxdUnNo2TDJ7JEA bQsA== 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 y8-v6si17800829pfm.141.2018.09.03.10.29.00; Mon, 03 Sep 2018 10:29:15 -0700 (PDT) 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 S1731046AbeICVsm (ORCPT + 99 others); Mon, 3 Sep 2018 17:48:42 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46290 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728175AbeICVsl (ORCPT ); Mon, 3 Sep 2018 17:48:41 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6C77CD01; Mon, 3 Sep 2018 17:27:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Burton , Vladimir Kondratiev , James Hogan , Ralf Baechle , linux-mips@linux-mips.org Subject: [PATCH 4.14 152/165] MIPS: lib: Provide MIPS64r6 __multi3() for GCC < 7 Date: Mon, 3 Sep 2018 18:57:18 +0200 Message-Id: <20180903165704.702197566@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Burton commit 690d9163bf4b8563a2682e619f938e6a0443947f upstream. Some versions of GCC suboptimally generate calls to the __multi3() intrinsic for MIPS64r6 builds, resulting in link failures due to the missing function: LD vmlinux.o MODPOST vmlinux.o kernel/bpf/verifier.o: In function `kmalloc_array': include/linux/slab.h:631: undefined reference to `__multi3' fs/select.o: In function `kmalloc_array': include/linux/slab.h:631: undefined reference to `__multi3' ... We already have a workaround for this in which we provide the instrinsic, but we do so selectively for GCC 7 only. Unfortunately the issue occurs with older GCC versions too - it has been observed with both GCC 5.4.0 & GCC 6.4.0. MIPSr6 support was introduced in GCC 5, so all major GCC versions prior to GCC 8 are affected and we extend our workaround accordingly to all MIPS64r6 builds using GCC versions older than GCC 8. Signed-off-by: Paul Burton Reported-by: Vladimir Kondratiev Fixes: ebabcf17bcd7 ("MIPS: Implement __multi3 for GCC7 MIPS64r6 builds") Patchwork: https://patchwork.linux-mips.org/patch/20297/ Cc: James Hogan Cc: Ralf Baechle Cc: linux-mips@linux-mips.org Cc: stable@vger.kernel.org # 4.15+ Signed-off-by: Greg Kroah-Hartman diff --git a/arch/mips/lib/multi3.c b/arch/mips/lib/multi3.c index 111ad475aa0c..4c2483f410c2 100644 --- a/arch/mips/lib/multi3.c +++ b/arch/mips/lib/multi3.c @@ -4,12 +4,12 @@ #include "libgcc.h" /* - * GCC 7 suboptimally generates __multi3 calls for mips64r6, so for that - * specific case only we'll implement it here. + * GCC 7 & older can suboptimally generate __multi3 calls for mips64r6, so for + * that specific case only we implement that intrinsic here. * * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82981 */ -#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ == 7) +#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ < 8) /* multiply 64-bit values, low 64-bits returned */ static inline long long notrace dmulu(long long a, long long b)