Received: by 10.192.165.156 with SMTP id m28csp36701imm; Tue, 10 Apr 2018 15:53:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx48+bp1G+C//1FX06U5DSW+NpnmLirHmvhTqzDZpABOQ6iLc9+57zmEGujqCQGmyJ93X+B8N X-Received: by 10.99.95.22 with SMTP id t22mr1617964pgb.315.1523400812736; Tue, 10 Apr 2018 15:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523400812; cv=none; d=google.com; s=arc-20160816; b=IsD7LiHTCKG7ASCgFs+z9DShaF2uFmtSqvBgjzpAluI+f8GxZ1F1ZxUujUgRlwXzZ3 sYs/5IH9mghjzlOG2xxcQX2J1qAnipyrPfJI7RE6K4KLhZCEt7xmOvFjrig5d8xR6bw/ Q4QZVRlhfHbhoyThlhnqPSPbYW+IiAH7aDYqMigCvOkm5FGcS3gpjT67HWyWwsnHTGst QCwN9SJ3Wz1UgpTlKKt7EqLX4kApM9ynI1uFL074kwuMux0GXLpsVjNdVl7d+E6f2+/D 0tRp28YFRdC5pdh4LlDQmrgxCVrvLSRm3I7F5yPE/6teJQ/6kwFgzLLDKO2i8xxPPqjo aglg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=62zNPASylPMn5p+mhfUkT/JJFeD5ux08bCPPj3SKo6g=; b=Dz/qR5tEfmlOHDGhNDw2onH6cRykqddiYNo015ueQ+L/IZh0lPHUPaohm+ookDZA1A 3NMQ2yC3Uxwpf751VQj7DMAplpyTasC2wVkRTrs2Yjv2AQVG/PyGhM2k1Kuftu3uh7Jl 8WRMlv+RNmUHSo+EYYErDDF6vUub4L58uHi+5gL9mndnO3hof04fi6f/HWlyqzcjcfEG O2jjk5yN6SgwYT12cPnP4cMfD0IGaFKrqNv2iEtR279yl+xhBjtRmAHpoeF4nGGgrQI/ eiGcvBvKRk6nrOZSZxn6cfmsovkNfyaBiT7nLtPjX3ZI4Lso1JNM7oOVDZGLwGRHB5ff /XOA== 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 3-v6si3686109plt.98.2018.04.10.15.52.56; Tue, 10 Apr 2018 15:53:32 -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 S1756211AbeDJWsT (ORCPT + 99 others); Tue, 10 Apr 2018 18:48:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:35246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756091AbeDJWsQ (ORCPT ); Tue, 10 Apr 2018 18:48:16 -0400 Received: from saruman (jahogan.plus.com [212.159.75.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 536E921771; Tue, 10 Apr 2018 22:48:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 536E921771 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jhogan@kernel.org Date: Tue, 10 Apr 2018 23:48:06 +0100 From: James Hogan To: Arnd Bergmann , linux-mips@linux-mips.org, Paul Burton , Maciej Rozycki Cc: linux-arch@vger.kernel.org, Andrew Morton , linux-kbuild@vger.kernel.org, Vineet Gupta , Mikael Starvik , Jesper Nilsson , Tony Luck , Fenghua Yu , Geert Uytterhoeven , "David S. Miller" , Christopher Li , Thomas Gleixner , Peter Zijlstra , Kees Cook , Ingo Molnar , Josh Poimboeuf , Will Deacon , "Steven Rostedt (VMware)" , Mark Rutland , linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-cris-kernel@axis.com, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, sparclinux@vger.kernel.org, linux-sparse@vger.kernel.org Subject: Re: [PATCH] bug.h: Work around GCC PR82365 in BUG() Message-ID: <20180410224805.GA21429@saruman> References: <20171219114112.939391-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sdtB3X0nJg68CQEu" Content-Disposition: inline In-Reply-To: <20171219114112.939391-1-arnd@arndb.de> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --sdtB3X0nJg68CQEu Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Arnd, On Tue, Dec 19, 2017 at 12:39:33PM +0100, Arnd Bergmann wrote: > diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h > index 5d595cfdb2c4..66cfdad68f7e 100644 > --- a/include/linux/compiler-gcc.h > +++ b/include/linux/compiler-gcc.h > @@ -205,6 +205,15 @@ > #endif > =20 > /* > + * calling noreturn functions, __builtin_unreachable() and __builtin_tra= p() > + * confuse the stack allocation in gcc, leading to overly large stack > + * frames, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D82365 > + * > + * Adding an empty inline assembly before it works around the problem > + */ > +#define barrier_before_unreachable() asm volatile("") > + > +/* > * Mark a position in code as unreachable. This can be used to > * suppress control flow warnings after asm blocks that transfer > * control elsewhere. > @@ -214,7 +223,11 @@ > * unreleased. Really, we need to have autoconf for the kernel. > */ > #define unreachable() \ > - do { annotate_unreachable(); __builtin_unreachable(); } while (0) > + do { \ > + annotate_unreachable(); \ > + barrier_before_unreachable(); \ > + __builtin_unreachable(); \ > + } while (0) Unfortunately this breaks microMIPS builds (e.g. MIPS micro32r2_defconfig and micro32r2el_defconfig) on gcc 7.2, due to the lack of .insn in the asm volatile. Because of the __builtin_unreachable() there is no code following it. Without the empty asm the compiler will apparently put the .insn there automatically, but with the empty asm it doesn't. Therefore the assembler won't treat an immediately preceeding label as pointing at 16-bit microMIPS instructions which need the ISA bit set, i.e. bit 0 of the address. This causes assembler errors since the branch target is treated as a different ISA mode: arch/mips/mm/dma-default.s:3265: Error: branch to a symbol in another ISA m= ode arch/mips/mm/dma-default.s:5027: Error: branch to a symbol in another ISA m= ode Due to a compiler bug on gcc 4.9.2 -> somewhere before 7.2, Paul submitted these patches a while back: https://patchwork.linux-mips.org/patch/13360/ https://patchwork.linux-mips.org/patch/13361/ Your patch (suitably fixed for microMIPS) would I imagine fix that issue too (it certainly fixes the resulting link error on microMIPS builds with an old toolchain). Before I forward port those patches to add .insn for MIPS, is that sort of approach (an arch specific asm/compiler-gcc.h to allow MIPS to override barrier_before_unreachable()) an acceptable fix? Thanks James --sdtB3X0nJg68CQEu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEd80NauSabkiESfLYbAtpk944dnoFAlrNPx8ACgkQbAtpk944 dnqSJw/+Kb3O5v2XI2GmfHi/0KELq1a0ZD1AXtMeexXWCA/G67vblwP7DhFAB5px IV666quqgKR09AdudWDm8+fMbH15AqlMBXRIgLRtyq6a8CuSD9P67MClnniB7+kq hWOqGYKwg/jAmw5E/ALHs1Xl9CmNnLnyVVG+utwTO3vA/2BkeA81oSCaeokhKlOX 5KM9nTqjxW3eCP2syAXmlBli9bdGX7puZ3fXj7dNPbYTnOAT7E1NH4sD0+gr20Xv Vjwn+JVKxCdyMrQqIG5E/enYM3Gk+4z9Xjv7GFQB/I/iOuhUBzHbm6Fy7B+08xhl utcCYQKHnFia0a5rFHXesqonCB5KvATesX2yWYNpRatj/5Dn37kdY1+1hGqNeNbN WNtXKVOegnWJnBLu7TQ8XJxZnYuKvA+2Uj2pb5tTD2M1SYqxAfsJdxqv9GnutJKH R9INBc/U7/gqRfez9ycihU1ZcNJHj88I+ePMxUgphcKHdBiCryoO3Xf4+PA+EGhY AW176RF4f7VgZP3WgJ3WOTfD4Cq+FfqKGcQDyD8KnZ7o0pdiRY1tcrczeyYLd7Rl Rx7JcW9SE7SENMHbdiygBuLTKIbhYl1YXf9VcAm/mYSzgWfVhd9IXIN55FnViPvR d3Z7bA8GuxlydlHGdt2OYgSuIuJ3+MqNpIhIOTBNASjd7PdEVAA= =oUHg -----END PGP SIGNATURE----- --sdtB3X0nJg68CQEu--