Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1197996ybl; Wed, 28 Aug 2019 11:02:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5TJrkrx2MQuMtpS3zY9swKE/3Fd56QS09hL6kWNoV42Vvn13uKz/hktwNNtYnpi81Nq3Z X-Received: by 2002:a62:1941:: with SMTP id 62mr6224994pfz.188.1567015370619; Wed, 28 Aug 2019 11:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567015370; cv=none; d=google.com; s=arc-20160816; b=Wmc6kupSMzU/AuxqkJ3pktituU161oYFqKTqqcXRpBmRrVaZzKS+DP7/iTQvjeV7HP w/JvmQnefBkwuQotXUs/7v6ID3jEtgVPyPR9FI0UwAj7WIVv5Od6LaBnYsKbUc1AZIPv cYRFUH6LxhI6BulM0qGB/XJrKs/+0QU7ZHJKbNuCl26JuuJIaHhtBiCSIypS56KdpfYI zg/SQe+f0UsG2+EY000vIZzDRmvaXF4Jq0KJSy4NmCRxoMs9YVoRY/kiDd2BFLb1nQoS zmsJILHmKcHKWfBiS6R6DEfN1aiHcmVyVx4DjhKp/Royy6iChTQSFv7HZUmK+RD48DlA Fx2Q== 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 :in-reply-to:references:mime-version:dkim-signature; bh=/9cEynbX19AvJzoEgiHwKGteceFTE1ys9oyagJjkZAw=; b=v5ejyQG94fA4RlWSVM7xHM5B+nDmOevOPrhp52wRugVIQOmT0S8qFf914MPSW8nAKf OiOmaFThm3peA3xg8Ttb6ep0Xdbi+uUIyziACefWJcGmK0IM90/9ojm9aKIps8XUdIY/ uyEAluaMexVCYX0Mq3HkL8dgNKIBRc5kwP6BUNhzNgF5Z1n3FzK/+RuTeproSB6XV3w4 XjbnaN3NeYMhQ398OBnn27bjzN3rWXuHYr1STZ/VrMXFt5TihgNIGJ+fmrvX6EjCJ41C 2CI7Mbp2sqc22vwP4HUwWeDtxgGl/bDqgiOelPGtRjLk0KzNKPhvypjlaFiWl2Crf0VC OrHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rOtj7avi; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j16si3047408pff.174.2019.08.28.11.02.32; Wed, 28 Aug 2019 11:02:50 -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=pass header.i=@google.com header.s=20161025 header.b=rOtj7avi; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726898AbfH1SB2 (ORCPT + 99 others); Wed, 28 Aug 2019 14:01:28 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39290 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbfH1SB1 (ORCPT ); Wed, 28 Aug 2019 14:01:27 -0400 Received: by mail-pf1-f196.google.com with SMTP id y200so287239pfb.6 for ; Wed, 28 Aug 2019 11:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/9cEynbX19AvJzoEgiHwKGteceFTE1ys9oyagJjkZAw=; b=rOtj7aviFrxSPtDu5RCopbB3+BGnL8mph6ucHa2CIA7ygi0sOSsEibJuEbbJj94fpQ x66iT79k3dbCO/mCbxrmkq9BxvyshcXfzaUejmsf0qfi0qYGAbJCU8dC6nkMp133T8kN eGMqnQ6ai9vsiu2yIbbfsiXK4AD5JOIThmRseYbjF6Ocr6f/D3XA5QqyRqTDjmdB+KIW bP8eQgpGqZMAzoub5+TCB1FsSsrKQjgf6aCd00I60WHxUq2KP0UoLSTRveezMmwkQFkY WkNHgVFaRt5C/18B4Q9hr18vzFE9nwUhW55/xNAUM2v1DnTrw3y74yGKFtwRnA4avGBl kBRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/9cEynbX19AvJzoEgiHwKGteceFTE1ys9oyagJjkZAw=; b=r50wkuQAI9rmm2lyPjQtU/kZ5JHTiasra9BToIlT8AsiGqQ1mEPUBdVvMsyiLKxdCp Y/cU5HIYgyanBZDpUVMS9ZYQpHZyvQfvmefIpmqu793WgeWQ+2KYADV4KCYk97C0DQSE UP1LLoCq9FyAfaviT9GZdSOrRozxE7gCtJ98rKqjYqECnMrOmUT6ZKwHpp1v7Qc3ZDmS u6ga5qqGjxyxyZBlf/DtGq32fWjPMqjqVg1BsK5EEdvvfKyz2S2PHkMyLIFhVCJK9GWa oi+P2e3kM7Ax3x1ZnYe/p+kWYeXTbHlQxx2Q9c2smAFh6WoT1mi6QigRUQ5rCnFuGv6F XmMg== X-Gm-Message-State: APjAAAXORQ7wrRbbBWwwIeqg6A6MjMAvlt0WSICNuurVMFOgWS+Yr283 HApI0eYyZEt3TbT91p1oefpRtBDzX+bqcvUBcdcWsg== X-Received: by 2002:a63:61cd:: with SMTP id v196mr4621079pgb.263.1567015286046; Wed, 28 Aug 2019 11:01:26 -0700 (PDT) MIME-Version: 1.0 References: <20190812023214.107817-1-natechancellor@gmail.com> <878srdv206.fsf@mpe.ellerman.id.au> <20190828175322.GA121833@archlinux-threadripper> In-Reply-To: <20190828175322.GA121833@archlinux-threadripper> From: Nick Desaulniers Date: Wed, 28 Aug 2019 11:01:14 -0700 Message-ID: Subject: Re: [PATCH] powerpc: Avoid clang warnings around setjmp and longjmp To: Nathan Chancellor Cc: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev , LKML , clang-built-linux , "# 3.4.x" 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, Aug 28, 2019 at 10:53 AM Nathan Chancellor wrote: > > On Wed, Aug 28, 2019 at 11:43:53PM +1000, Michael Ellerman wrote: > > Nathan Chancellor writes: > > > > > Commit aea447141c7e ("powerpc: Disable -Wbuiltin-requires-header when > > > setjmp is used") disabled -Wbuiltin-requires-header because of a warning > > > about the setjmp and longjmp declarations. > > > > > > r367387 in clang added another diagnostic around this, complaining that > > > there is no jmp_buf declaration. > > > > > > In file included from ../arch/powerpc/xmon/xmon.c:47: > > > ../arch/powerpc/include/asm/setjmp.h:10:13: error: declaration of > > > built-in function 'setjmp' requires the declaration of the 'jmp_buf' > > > type, commonly provided in the header . > > > [-Werror,-Wincomplete-setjmp-declaration] > > > extern long setjmp(long *); > > > ^ > > > ../arch/powerpc/include/asm/setjmp.h:11:13: error: declaration of > > > built-in function 'longjmp' requires the declaration of the 'jmp_buf' > > > type, commonly provided in the header . > > > [-Werror,-Wincomplete-setjmp-declaration] > > > extern void longjmp(long *, long); > > > ^ > > > 2 errors generated. > > > > > > Take the same approach as the above commit by disabling the warning for > > > the same reason, we provide our own longjmp/setjmp function. > > > > > > Cc: stable@vger.kernel.org # 4.19+ > > > Link: https://github.com/ClangBuiltLinux/linux/issues/625 > > > Link: https://github.com/llvm/llvm-project/commit/3be25e79477db2d31ac46493d97eca8c20592b07 > > > Signed-off-by: Nathan Chancellor > > > --- > > > > > > It may be worth using -fno-builtin-setjmp and -fno-builtin-longjmp > > > instead as it makes it clear to clang that we are not using the builtin > > > longjmp and setjmp functions, which I think is why these warnings are > > > appearing (at least according to the commit that introduced this waring). > > > > > > Sample patch: > > > https://github.com/ClangBuiltLinux/linux/issues/625#issuecomment-519251372 > > > > Couldn't we just add those flags to CFLAGS for the whole kernel? Rather > > than making them per-file. > > Yes, I don't think this would be unreasonable. Are you referring to the > cc-disable-warning flags or the -fno-builtin flags? I personally think > the -fno-builtin flags convey to clang what the kernel is intending to > do better than disabling the warnings outright. The `-f` family of flags have dire implications for codegen, I'd really prefer we think long and hard before adding/removing them to suppress warnings. I don't think it's a solution for this particular problem. > > > I mean there's no kernel code that wants to use clang's builtin > > setjmp/longjmp implementation at all right? > > > > cheers > > I did a quick search of the tree and it looks like powerpc and x86/um > are the only architectures that do anything with setjmp/longjmp. x86/um > avoids this by using a define flag to change setjmp to kernel_setjmp: > > arch/um/Makefile: -Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp \ > > Seems like adding those flags should be safe. > > Cheers, > Nathan -- Thanks, ~Nick Desaulniers