Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp7798ybl; Mon, 12 Aug 2019 10:47:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwQanpJRy4iFZAGdE2iM/FVJHRAvVP8Ara2nu2ZYExxI5L+AbY0q7kKFivzwHjfVGmYsp0 X-Received: by 2002:a63:c006:: with SMTP id h6mr30835137pgg.290.1565632028597; Mon, 12 Aug 2019 10:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565632028; cv=none; d=google.com; s=arc-20160816; b=K/sMOu8f5dtVIWV/2V0l0V6Rwns0ldTU2M1gDGcqixluKofTQnIkd/3UWd3qDA+Znz L9cnEPh/TJhS8buolpPfCjkHIr/MY6vttv+SDczscUkmKeY+COPkaAtXVE+HLVf61NFt ZvyaGVyEeQjcTh9yEb0FIOCjOryuPC2KizGTdrpqV+Fp/fnCsSWnGOC+o/kcLKLYtUh/ lYQDGrh3YPr/gSipJkcYmLp60VtxSm7W15ePraTaaGzL44FerxqWoIFFwIl9XGDicOJc 98zD+1bXtjMx+Ey3ILN2uSs+MzJRqUB8cxHwBXQCQ3A9oHvzuNe4IFsadjrF47d9o6+6 8x3g== 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=oZi4p9sU++IMNyLOoMu4O4MSpldoBC3la4O/D+JmVeE=; b=Eptk4OjTLH0+I5PgzAEo1cQsvxrg0FssyPs9FkzRiNsG32aETOLsDAt689BGTZxhvJ tMlRCcht9XmBJ6WjWv5Qp3kcsGcTv1udbpbzk0vnuU/VXUvfRw4UPnI7h27LgoMknzWQ 1LBIjCAlRheRQBWQA4xzeV4bgWuNAOm1800+VhRwERcVFjFRys5ee9ifpeP6uGV92z2m H/op6dG8mwZ+6ryIRyoQm7MxNbiNm1svzbocxU5uXsE2ByPFikCHcAZN883xZTK1oJnW webGO3PhPJQ935m8U+BCwegN1I7DeddGbQ2K38CzeZQf1HlB1cq1FbzywoBQjvouBwAn dmPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RsNkwjci; 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 e80si61863094pfh.121.2019.08.12.10.46.53; Mon, 12 Aug 2019 10:47:08 -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=RsNkwjci; 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 S1727025AbfHLRgI (ORCPT + 99 others); Mon, 12 Aug 2019 13:36:08 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37609 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725843AbfHLRgI (ORCPT ); Mon, 12 Aug 2019 13:36:08 -0400 Received: by mail-pg1-f196.google.com with SMTP id d1so17022570pgp.4 for ; Mon, 12 Aug 2019 10:36:08 -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=oZi4p9sU++IMNyLOoMu4O4MSpldoBC3la4O/D+JmVeE=; b=RsNkwjciAZJFroOX5ILBuBvMy8TWcIT9hJzrTA5xuOZfMYJaav94/bNa1G1AZHA/sx IqeuX0m5wrq1olWYnCUFdWcRs4HHNmD+fSaxGCDngxV9gs9hEaGvpwiel6l6FYROI+wM b2h/J/0MtTn4wk+24P+lye5PvT7SR216V5ztbRz1yijbJD2TeXZKy39Wwf+AkV8DYbM0 CP6fjXz/iairhkQqUorj+Ear31cpwrY8D8/ls28sODMfPbYKCYDBl2dAo83EtHCePTLH MGmTVzL/6+j8BOjr0vRr/sKO1HKHpXTj0Kqk+R5o3T3ezXSVTGqzUJFXtYU7FXUZdbq9 iK5Q== 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=oZi4p9sU++IMNyLOoMu4O4MSpldoBC3la4O/D+JmVeE=; b=fHEvlF0KAbj1FM8BfOEB/S4q0vwxtiUUB+XL3bxPpQtpGPaR/U4dKTKeDBc21ymY26 luD9JxmWVY9WZdbnejtsmtyGTU53U3MmIZc52t72hLJariTiqLD4ELWsZ0IFI4Oucvhc dvzeimdW6gKe6aPlQU6aNB1kCXy+CywwJimmQyt21Brgsm/fRhrsXTss+jCGHWKCIoSF 8JXGb+bof1OOmp3ENJeki5ZQt4sfGVZL92Mt+muQOeU17V7jwscpr7bciay8ZPcewlcX yGc3smst9gw6k5qI+LxH5mbRbowxz6xwpWRFeSeJtc0Ep18ULl0/7F1SQwVh11Fc35VT /3ZQ== X-Gm-Message-State: APjAAAXQSssolG2j+73D4djyj5rjTmxPMXKNlmbg0HZwe2SLtFrc7CAH qOTd/kV0U/iu3u33bYvaqG2w0b6OaM1lcijrIAlw7Q== X-Received: by 2002:a63:f94c:: with SMTP id q12mr30736518pgk.10.1565631367302; Mon, 12 Aug 2019 10:36:07 -0700 (PDT) MIME-Version: 1.0 References: <20190812023214.107817-1-natechancellor@gmail.com> In-Reply-To: <20190812023214.107817-1-natechancellor@gmail.com> From: Nick Desaulniers Date: Mon, 12 Aug 2019 10:35:56 -0700 Message-ID: Subject: Re: [PATCH] powerpc: Avoid clang warnings around setjmp and longjmp To: Nathan Chancellor Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , 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 Sun, Aug 11, 2019 at 7:42 PM Nathan Chancellor wrote: > > 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 Thanks for the patch, Nathan. Reviewed-by: Nick Desaulniers > --- > > 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 > > However, this is the most conservative approach, as I have already had > someone notice this error when building LLVM with PGO on tip of tree > LLVM. > > arch/powerpc/kernel/Makefile | 5 +++-- > arch/powerpc/xmon/Makefile | 5 +++-- > 2 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile > index ea0c69236789..44e340ed4722 100644 > --- a/arch/powerpc/kernel/Makefile > +++ b/arch/powerpc/kernel/Makefile > @@ -5,8 +5,9 @@ > > CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' > > -# Disable clang warning for using setjmp without setjmp.h header > -CFLAGS_crash.o += $(call cc-disable-warning, builtin-requires-header) > +# Avoid clang warnings about longjmp and setjmp built-ins (inclusion of setjmp.h and declaration of jmp_buf type) > +CFLAGS_crash.o += $(call cc-disable-warning, builtin-requires-header) \ > + $(call cc-disable-warning, incomplete-setjmp-declaration) > > ifdef CONFIG_PPC64 > CFLAGS_prom_init.o += $(NO_MINIMAL_TOC) > diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile > index f142570ad860..53f341391210 100644 > --- a/arch/powerpc/xmon/Makefile > +++ b/arch/powerpc/xmon/Makefile > @@ -1,8 +1,9 @@ > # SPDX-License-Identifier: GPL-2.0 > # Makefile for xmon > > -# Disable clang warning for using setjmp without setjmp.h header > -subdir-ccflags-y := $(call cc-disable-warning, builtin-requires-header) > +# Avoid clang warnings about longjmp and setjmp built-ins (inclusion of setjmp.h and declaration of jmp_buf type) > +subdir-ccflags-y := $(call cc-disable-warning, builtin-requires-header) \ > + $(call cc-disable-warning, incomplete-setjmp-declaration) > > GCOV_PROFILE := n > KCOV_INSTRUMENT := n > -- > 2.23.0.rc2 > -- Thanks, ~Nick Desaulniers