Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4008539ybp; Sun, 13 Oct 2019 19:53:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTeb4EW3S4xnCt1O/0IKKjSkl7XKbkpnS1tf/NikR/DYvvlkuJPslJuOTN1Rw7ENPurUp8 X-Received: by 2002:a17:906:7212:: with SMTP id m18mr26301139ejk.88.1571021638888; Sun, 13 Oct 2019 19:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571021638; cv=none; d=google.com; s=arc-20160816; b=NG2IaeJ5rh6YOawk6xi9suSo/t5v3iwkO+5007UVPoSKcYmrjDzdB7Km61Npf+h3kA U2BrDPPRspvGsBb5nNdHqyRr95eOjKHJZAk+rJOOufnHMq42B1bvXVHIACPcfgjPmHWF 1xoCXz5OL2uDgeDo18YZkhrbu3e0DLOxIlJQu0hXz7LOFNA9XhducsPuBvsJX6fw58Qz Mb4iQ719DsAAar5u0+rAhws/NCEzd2PJ/O8IU609onlXmY16vk2gTLiZnXMVkZ04VnEd LcWFJEHO3bw6sLCVBH7zRfKavzGygxAMVXEFRqUygqg2vvN4Lrj9COh68UwqSsq4p/7b idsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F36EaD5caKU9PTKbiMakPn6QNXZEgKWjgXwIAtKPD44=; b=LAwZ+XDP0U8fUgOcotB+rbJkqxI4aP3ThsVJv5hZx1XxbMYBcwOREyUmISJjPeHNzo hfhMAFXt/vCS9CsuQKU4VE2Co8+clmouLiq3w8XUzPlUvTssgbRRXDVcIbLIEI5ZqvuU w2jr/Svn5XDX6vsl8GyS3yakce5mIO2/pb1gyJaQKInqsi0xKJuLsOEVrvCasf53bXLH 2ZZKiAUBvBXjUoO9romzmYimOb/8pcL7DTIwszTxiB3Sfp3IiRg2kOp0fQCqwG9lW426 jjMsMpsEwEXgZL1NCiYsSEVsg2q+9ncWvxn1Mm+kE/q9V1TvPx8mSlNQnQ9aoI7DYd0r 5VXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=q4vo8JFU; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si10160147ejb.259.2019.10.13.19.53.35; Sun, 13 Oct 2019 19:53:58 -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=@gmail.com header.s=20161025 header.b=q4vo8JFU; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729888AbfJNCvZ (ORCPT + 99 others); Sun, 13 Oct 2019 22:51:25 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:37119 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729712AbfJNCvY (ORCPT ); Sun, 13 Oct 2019 22:51:24 -0400 Received: by mail-oi1-f196.google.com with SMTP id i16so12574762oie.4; Sun, 13 Oct 2019 19:51:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F36EaD5caKU9PTKbiMakPn6QNXZEgKWjgXwIAtKPD44=; b=q4vo8JFU4HugUERMWeB4mHp+fw5ON+93BhOylrPtQkKaqZFfDIVrpOI058PORX4ei/ 4Hn53KbXlJBc+Lb8QNW7fHlCUD80Mc8lsyFrLV3A9nZb3I9fUthgPkRYm/zkEYx/bWt4 bOark5DAZa5oJYf0hn6FaM941/TMhBhsD21D7UOL29rHMZ7OlSPqTetpsNxp2ISsPOYw XpSF8cZQVABFIkW/wj83bqNW07tSrE47jJvVBLDxgUUJbQawgownaEircNT+0Matmc65 gSrGwtWsybRFx0VzHTUbtSNxJsDinfJ+zJP5W8gNfguBxiSqKyzwGyQHRwI2qbSW8B0N ZjYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F36EaD5caKU9PTKbiMakPn6QNXZEgKWjgXwIAtKPD44=; b=mH6FEBxdFYYJ9Lnx9PRlB0ZFrSAjHrL4HNHHlGrQ1mXkYVuxY7oFghcktRLjII4diM OYf1ru6XenTgrw1hNj7axft3lZI1RXtiw1bBCnlNagXEm1Cxqs+LecalqYMkzDfzbBgl lmzivw+BCyPFFb/8yrcg67G2p0F+xZ2YPzLsMmhdc2G38SiHl1/EGXY8/gtGPVfvyoqV ZldL0hc6m9+9TfLrG4qimE4o68CNrARpS6JJtEcG1DLIe1xWsFozwFWrB25T5Qkrrrdc 9JPxi/sK4uLH4MYwcBogZCHPEPtR0Uny4Rg76ZPNn+UBvhZitr3/ab4CKMwZP1iENnXb 2BGw== X-Gm-Message-State: APjAAAXCg+IbmPDXS0B8xzTV+0yGhngtBNhZpt5mnM8m8ZEhImry9hDI 5bH4So6oQv1mzzfGO8a0Z5A= X-Received: by 2002:aca:53c3:: with SMTP id h186mr23216972oib.174.1571021483233; Sun, 13 Oct 2019 19:51:23 -0700 (PDT) Received: from localhost.localdomain ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id 11sm5612491otg.62.2019.10.13.19.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2019 19:51:22 -0700 (PDT) From: Nathan Chancellor To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , stable@vger.kernel.org, Segher Boessenkool Subject: [PATCH v4 2/3] powerpc: Avoid clang warnings around setjmp and longjmp Date: Sun, 13 Oct 2019 19:51:00 -0700 Message-Id: <20191014025101.18567-3-natechancellor@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191014025101.18567-1-natechancellor@gmail.com> References: <20190911182049.77853-1-natechancellor@gmail.com> <20191014025101.18567-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. We are not using the standard library's longjmp/setjmp implementations for obvious reasons; make this clear to clang by using -ffreestanding on these files. Cc: stable@vger.kernel.org # 4.14+ Link: https://github.com/ClangBuiltLinux/linux/issues/625 Link: https://github.com/llvm/llvm-project/commit/3be25e79477db2d31ac46493d97eca8c20592b07 Link: https://godbolt.org/z/B2oQnl Suggested-by: Segher Boessenkool Reviewed-by: Nick Desaulniers Signed-off-by: Nathan Chancellor --- v1 -> v3 (I skipped v2 because the first patch in the series already had a v2): * Use -ffreestanding instead of outright disabling the warning because it is legitimate. v3 -> v4: * Rebase on v5.4-rc3 * Add Nick's reviewed-by and Compiler Explorer link. arch/powerpc/kernel/Makefile | 4 ++-- arch/powerpc/xmon/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index a7ca8fe62368..f1f362146135 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -5,8 +5,8 @@ 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 around longjmp/setjmp declarations +CFLAGS_crash.o += -ffreestanding ifdef CONFIG_PPC64 CFLAGS_prom_init.o += $(NO_MINIMAL_TOC) diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile index f142570ad860..c3842dbeb1b7 100644 --- a/arch/powerpc/xmon/Makefile +++ b/arch/powerpc/xmon/Makefile @@ -1,8 +1,8 @@ # 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 around longjmp/setjmp declarations +subdir-ccflags-y := -ffreestanding GCOV_PROFILE := n KCOV_INSTRUMENT := n -- 2.23.0