Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2139459ybb; Sun, 29 Mar 2020 23:46:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtogZFrxBnGmYEH+c8BDG8yKJSAg070vMvDUDRLDeDA2ljGgSOV/eylt9OSV491vZP19XCu X-Received: by 2002:aca:db08:: with SMTP id s8mr6974800oig.167.1585550769664; Sun, 29 Mar 2020 23:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585550769; cv=none; d=google.com; s=arc-20160816; b=mtdvIpUVa/HqBgN984Uw4dCGIFbY/ziGMlA80qQvJF9EtRQk4M+s1szhpBeSi3jmOR pa+ccVjhZHsa/C4Bb6BTKtjZ+r0Azqc86XBaPoFj+24NfGPYipL5M6KnzMjjYi5wQH/a z/VcwiD10DC5o0AgcMsbYJpxGZqTasI8Er/FZc5CwL8euvuGDRrFmae/rzi0QYdtzqqm cBRp5jkip245YV7uL9SwoGye3tsedPTIcBskOr1mB9wYiPa41LSiR8SrowbIx107kMBY ak412aacoa0alv7PUhpAnTZmgHB0/Ma0/cpK98NBJC7QTysfDsJF8uGfG53dElvJoFr1 y97w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:cc:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=xapqDhPFeX4c/sEZFBXwtVQVL9ia2nDPE/e7jpQzTQA=; b=gRFtO84sHs8Pt+He8V9WBDHPtgU9Gx7EY5rCH19OEdIhOPAXO3XntUh97ugns2dhYi aAcNy555EvefzgLMszNEJPwraxJZm+LbIREoD2Dc9Ffxyu4T7ghwaen/Mr/3hP47COBZ ubpRYZz/yiqrIrdq3+d0UuddoKA5AsIyt1ez94X5uLj3qTEgRQNxFfIesTS6e5vFzOar xqlA2aX5pgfumIbkmuDisvWCg4po1vQ90YR3WDQOQ5Jg4Z+29td8aCui4UzXkzAXDfn0 lj87p0Q8O3so1sEj7vMGWRMJyhbJaKwZ55EGquDq48YiT9jbiHRn7fDTP+YXZ0G/k2uh L26Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=d8hUdfNw; 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 l24si6315832otn.57.2020.03.29.23.45.57; Sun, 29 Mar 2020 23:46:09 -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=d8hUdfNw; 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 S1729253AbgC3Gng (ORCPT + 99 others); Mon, 30 Mar 2020 02:43:36 -0400 Received: from mail-pl1-f202.google.com ([209.85.214.202]:44725 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbgC3Gnf (ORCPT ); Mon, 30 Mar 2020 02:43:35 -0400 Received: by mail-pl1-f202.google.com with SMTP id c7so12179032plr.11 for ; Sun, 29 Mar 2020 23:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:cc; bh=xapqDhPFeX4c/sEZFBXwtVQVL9ia2nDPE/e7jpQzTQA=; b=d8hUdfNwN+8iAFJdBnwUiTZeEYcdMVOCOWJfgJWR7/vu/vixLec11deCzX+uCdblaJ vKTaEhiX0gbcQtU4EApIuDXMtuTCWFoDKk4CgV8V935/DxbKWIDs72JckC3qfblOJpgk G9weGGi1TLjXnb+sCyklu/HBRr22EUaVJtVA40MdyL4HyOlURlp86JTaxm5hNpkh/Ucp HprDqPmzfRmnX01nh+JznDUcsbJGNU+qhqlQlILFD+CnXbBVSFh4f8+tvKF4yDKkNhJV AqXyZPKRB5yIndXdCOloQ2x0tlgm5EJ08HcBtcME/64wFkfUFajpMjx7jSKtQTt64fW9 P6tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:cc; bh=xapqDhPFeX4c/sEZFBXwtVQVL9ia2nDPE/e7jpQzTQA=; b=EJQ+ppoEYkFRZex8+UMI4AiehJ86M638OREx4U83rB4XrzBAaJnc9OmIK/ljkqKE3n O4ttwdNsWfzDuyhLRSN6o1scT8TEvGh7/4hUvGMyEiCMes0HS/HfEJLEAqY073LGDUq1 3O0w6a8hZ5u1LL3AHG9WvH/9e7M2GKX26kdxuWyMdZi6HXavKstHxeYcmKTV0N9DTKj7 Jf2uSmvzkYwTpU7w7JG8UTfyJQcy05Tk4qjzHPIA+Zjpku9YNEwvI7O3cpA4jTQig6vR tNd2Bt37pYCc21+aoYYG3Vs0y6k4j/xvNf2DUbUg4Cp+FQAkruuYsA7rfgjU+vil+oBu FsIw== X-Gm-Message-State: ANhLgQ35Yng2EUWh5T4zbCFkWsbl9x0GD1ngnD3XqQNuRcEZXnFgr6NO hOB5zjfqGxeLetNOzFMxjymHUnOyMYy3 X-Received: by 2002:a17:90a:65c8:: with SMTP id i8mr14048414pjs.156.1585550612534; Sun, 29 Mar 2020 23:43:32 -0700 (PDT) Date: Mon, 30 Mar 2020 08:43:19 +0200 In-Reply-To: <20200327100801.161671-1-courbet@google.com> Message-Id: <20200330064323.76162-1-courbet@google.com> Mime-Version: 1.0 References: <20200327100801.161671-1-courbet@google.com> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog Subject: [PATCH v2] powerpc: Make setjmp/longjmp signature standard From: Clement Courbet Cc: Nick Desaulniers , Nathan Chancellor , Michael Ellerman , Segher Boessenkool , Clement Courbet , stable@vger.kernel.org, Benjamin Herrenschmidt , Paul Mackerras , Allison Randal , Thomas Gleixner , Greg Kroah-Hartman , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Content-Type: text/plain; charset="UTF-8" To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Declaring setjmp()/longjmp() as taking longs makes the signature non-standard, and makes clang complain. In the past, this has been worked around by adding -ffreestanding to the compile flags. The implementation looks like it only ever propagates the value (in longjmp) or sets it to 1 (in setjmp), and we only call longjmp with integer parameters. This allows removing -ffreestanding from the compilation flags. Context: https://lore.kernel.org/patchwork/patch/1214060 https://lore.kernel.org/patchwork/patch/1216174 Signed-off-by: Clement Courbet Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor --- v2: Use and array type as suggested by Segher Boessenkool Cc: stable@vger.kernel.org # v4.14+ Fixes: c9029ef9c957 ("powerpc: Avoid clang warnings around setjmp and longjmp") --- arch/powerpc/include/asm/setjmp.h | 6 ++++-- arch/powerpc/kexec/Makefile | 3 --- arch/powerpc/xmon/Makefile | 3 --- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/include/asm/setjmp.h b/arch/powerpc/include/asm/setjmp.h index e9f81bb3f83b..f798e80e4106 100644 --- a/arch/powerpc/include/asm/setjmp.h +++ b/arch/powerpc/include/asm/setjmp.h @@ -7,7 +7,9 @@ #define JMP_BUF_LEN 23 -extern long setjmp(long *) __attribute__((returns_twice)); -extern void longjmp(long *, long) __attribute__((noreturn)); +typedef long jmp_buf[JMP_BUF_LEN]; + +extern int setjmp(jmp_buf env) __attribute__((returns_twice)); +extern void longjmp(jmp_buf env, int val) __attribute__((noreturn)); #endif /* _ASM_POWERPC_SETJMP_H */ diff --git a/arch/powerpc/kexec/Makefile b/arch/powerpc/kexec/Makefile index 378f6108a414..86380c69f5ce 100644 --- a/arch/powerpc/kexec/Makefile +++ b/arch/powerpc/kexec/Makefile @@ -3,9 +3,6 @@ # Makefile for the linux kernel. # -# Avoid clang warnings around longjmp/setjmp declarations -CFLAGS_crash.o += -ffreestanding - obj-y += core.o crash.o core_$(BITS).o obj-$(CONFIG_PPC32) += relocate_32.o diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile index c3842dbeb1b7..6f9cccea54f3 100644 --- a/arch/powerpc/xmon/Makefile +++ b/arch/powerpc/xmon/Makefile @@ -1,9 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for xmon -# Avoid clang warnings around longjmp/setjmp declarations -subdir-ccflags-y := -ffreestanding - GCOV_PROFILE := n KCOV_INSTRUMENT := n UBSAN_SANITIZE := n -- 2.26.0.rc2.310.g2932bb562d-goog