Received: by 10.192.165.156 with SMTP id m28csp399951imm; Wed, 11 Apr 2018 00:34:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+nyP++Oif2uF8p6T4y3gLZBgL2eWSZrVfKwq4F8A2cxojlvui5x2ZsJtUV3PM+KWdeZSL/ X-Received: by 10.101.91.73 with SMTP id y9mr662522pgr.93.1523432056205; Wed, 11 Apr 2018 00:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523432056; cv=none; d=google.com; s=arc-20160816; b=ePrOAKnH1+ufZ3uq+yClWkYrr7FbxJK3WgETJrwdC72/OaYf2DGBQGRgs1quW+KuLC s2hK0ttxb9dwzh52yd6ownBwzzOcODp8KNZJNbOjyZIvkQBac0gDP6qIAgSl7GsEdQHD B3DqzJwEO9Jm5WQjUN7htBkk47epAfx3TtE0H1FS27NOtwEpXDyhxxXESZXI+OgiPm3G hXxYh497AWtoPmmJLC5tRzB8Z2+nHtVlyO2fi5Nz4+U2NFHQcKTHS40lDjLJOcs77CmR qId8thaB5LES3awyrIQCMQInH5pj7WPl6+9B+coFJc8u4MYagIbMVInhqXPC1tjAOK3z f5qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=7yFYxHK6EXr/97H+FTDzxXkHxaWaE7Uj0PiqXtrUG/A=; b=juK/wJ5XmrwAwvrxhYrVHz0L15eR6QT3rvvcOWHfYUfOwMi+zds6KToh9BOSOgRvfH K1nExchGrtcNLJgyxmA4ZOITEXDCdNwhCJvnmNvSNRpljcwwkuugPz4Xpuy+PW+sES4J kw9ItrKxVEE4qRb+mn7e+aSghIbUH9/xnFuAZVmZApjCYtAslqlIBtD9wrkfy6K2l5t7 u1qdHmbh3ayZFeCkeFArRbGgMZBM6oEbrINeASAVFF6M+6zzh3xCEAOuY9o4Mb/I/ODK rz++7o1TwC0i0FSqJot8F8g3nOKBy38vFV4CLL4ISqSiklAxVmmxmZl5bb/hjsSvIkpm evew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Uyd8R7yd; 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 h2si422934pfn.191.2018.04.11.00.33.38; Wed, 11 Apr 2018 00:34:16 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Uyd8R7yd; 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 S1751953AbeDKHbC (ORCPT + 99 others); Wed, 11 Apr 2018 03:31:02 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:34711 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750743AbeDKHa6 (ORCPT ); Wed, 11 Apr 2018 03:30:58 -0400 Received: by mail-qk0-f196.google.com with SMTP id g7so867799qkm.1; Wed, 11 Apr 2018 00:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=7yFYxHK6EXr/97H+FTDzxXkHxaWaE7Uj0PiqXtrUG/A=; b=Uyd8R7ydl8Y1VhsCEJRwdSekthVSMLREjY72/e/Qz+evaJuvC2wjlaVVjqdORjSFiT U0d+3dFlcIP6k4KvfQPtCLHZCnW4BUROhKyJXGKyB4dB0+9S54/3Bwsvw/lODXgWq8eV 3a1+9nKbgeoHkwiOP5aGFiRFCqb4fKU6o9r67ezl1E18AAOnwETV0/6Pj1YEbH95EcAT Y8RK4EswOap9GlEe7bopekeW1zXO26MaJtz3Igzmrt3A1XfT5MCShRZ4FYi1LB9aS26M yL3cAaGeCW0JTAujf+gdDb2R4PzDBnCE9CAxWp24qwUWayVra7R+vTNdwACXHj7ATlGV /hPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=7yFYxHK6EXr/97H+FTDzxXkHxaWaE7Uj0PiqXtrUG/A=; b=WaJEYw5nPYr6ECPYAXIfjnC9aU/9716m7OpOglPGIdOFssJQ+RJamwQnDqXs3vIiS/ 4ju0YbLsf/M76WevuUlaRlYTmS3a1mZZGdu1o8b/HNL0rMd/0I8fRbmL0lOnXtSzHVkn S2UBAph1sbFUQ2l81cFgG/gy8KfY9yqkwC1Cq0cPuH8KY8OqwT+gKqBzBHHkKERyPHZK ebsb/4d3XNxzC/mLNKnxlQDWQcc6uNOokcOfgnOPGYVt4gRH4GrmDjIfZDUwiFXmR6Gr ZzBLt+BTFWxMA6laaQCAHM9LO6YACpDYLS3TddoNBLdILz5TI2M9OTFuzo6zDB5g0uu7 NgYA== X-Gm-Message-State: ALQs6tDgoCKi0hXOvFm3/HHCJKV3aj5TiD6NUBbxkdJ8MNKjZH5IhbUy q0KPTaRprjHFNOSoM8EQLjHKa27g0gS7grE6WMY= X-Received: by 10.55.5.8 with SMTP id 8mr5183618qkf.84.1523431856891; Wed, 11 Apr 2018 00:30:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.185.25 with HTTP; Wed, 11 Apr 2018 00:30:56 -0700 (PDT) In-Reply-To: <20180410224805.GA21429@saruman> References: <20171219114112.939391-1-arnd@arndb.de> <20180410224805.GA21429@saruman> From: Arnd Bergmann Date: Wed, 11 Apr 2018 09:30:56 +0200 X-Google-Sender-Auth: zIrBH2DwpijzqcjQg8mMkwyBu-c Message-ID: Subject: Re: [PATCH] bug.h: Work around GCC PR82365 in BUG() To: James Hogan Cc: "open list:RALINK MIPS ARCHITECTURE" , Paul Burton , Maciej Rozycki , linux-arch , Andrew Morton , Linux Kbuild mailing list , 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 , "open list:SYNOPSYS ARC ARCHITECTURE" , Linux Kernel Mailing List , linux-cris-kernel@axis.com, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, sparclinux , linux-sparse@vger.kernel.org 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 On Wed, Apr 11, 2018 at 12:48 AM, James Hogan wrote: > 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 >> >> /* >> + * calling noreturn functions, __builtin_unreachable() and __builtin_trap() >> + * confuse the stack allocation in gcc, leading to overly large stack >> + * frames, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365 >> + * >> + * 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 mode > arch/mips/mm/dma-default.s:5027: Error: branch to a symbol in another ISA mode Ok, I see. > 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? That sounds fine to me. However, I would suggest making that asm/compiler.h instead of asm/compiler-gcc.h, so we can also use the same file to include workarounds for clang if needed. Arnd