Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2187730ybb; Mon, 30 Mar 2020 01:04:39 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtHeSBS+NozY1qvi72OSgXk9e7XWix0W8cRDOv7KXSbVa8MeEK2r6SU9GfdaxBIL0SCYeL+ X-Received: by 2002:aca:aa55:: with SMTP id t82mr6773673oie.147.1585555479535; Mon, 30 Mar 2020 01:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585555479; cv=none; d=google.com; s=arc-20160816; b=qSiDX3JAQRtKGHHVtJwPcIGir2WCv6sdRcElak5HSFefkuv4L/zShSY7DX1xqzMRZs jQFJLoX5AeJGqvpiwKvjKqoTBU5eH7zZej5LfxNL6CAXDDQVd9me5yj6UYs+72ULp0XY SxEYtMdbtr1AumX/bs9+FlNkfb8cXOyez2au3KopceUu6RDtTL7N7hpSMXkMw/qqlGLI Hqp10J5Ya8C4Z8VSVzIltkJtXZ86Ge1B2q9rmT8AlA/EYremwhEuV6K90z47DRhucJ2q HW9FEVqIJB1km/2gRlUhm6V2CrZx1tszL+Y6l6DMbDhj43OXqNSCMKloS+TgEyJcXwf6 xdGQ== 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=6uUpEI08oXikXCp5+9gsd81DMfh5aZ7xYc26aZNsMcE=; b=OV+hXHuRYG0jHLoVnlXAvCqHr3tubebanumT5AsA73+0swKgVVIvG+o9XsLgWaamdK 3ajOYsdldG/2ak5zdO5X/xjhPrvB9d6t2xu2KMvepGitQ616UtZ3xzagPD7id2mWSeex T6I6dvJg42b3nlSIrEnDlqF6LFt1fD7dgv1o7OcnQEhU3/fgxTsEjRvgK4Ty5H2WLsLm HTiJNVkhaaui/3Mp46cpeTwlcVYQzFhjfCoLVPIPSnaWWPO/tAUG9sI4R5+0npGg5lcD 8ap0Nkm60Aiczkwl/MF+WzDwHEI2yzaHtMDRpG+cHm25HFVuqDGzT5x4OUUmdzZZ4/0h eAPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=R5aQu0gP; 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 s21si6027938otr.16.2020.03.30.01.04.27; Mon, 30 Mar 2020 01:04:39 -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=R5aQu0gP; 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 S1729579AbgC3IEI (ORCPT + 99 others); Mon, 30 Mar 2020 04:04:08 -0400 Received: from mail-qv1-f73.google.com ([209.85.219.73]:44611 "EHLO mail-qv1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729474AbgC3IEH (ORCPT ); Mon, 30 Mar 2020 04:04:07 -0400 Received: by mail-qv1-f73.google.com with SMTP id d2so13711076qve.11 for ; Mon, 30 Mar 2020 01:04:07 -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=6uUpEI08oXikXCp5+9gsd81DMfh5aZ7xYc26aZNsMcE=; b=R5aQu0gPcdYxwympNDA6UKdwMEnC2lGvXrGlXdylt5YSMQ4nAlR4gXuAS+7DzVEFW9 bncYZz2qzYyv60L9tsSIMS6mi7tymeJ2mjj2uFTPgT8gTz02xBhf4Ut/2l8JRwepapq6 v7MV4eHIuJsBec5DldbEcDJ/X2g+0uDLUfpyPOsLAWJG+7u5noEunaLudIgD88epxYKv Jdolza7eiLG5kgnu5wfR62bw23CdRRHVOQAFXqOhIs2UJBqImVKGEcmPswTxOAVJmNqi QkhU2j1WsrWkCb5+2hNw1Xx4esmiKqnMFvbnwL0CIsgEPe//N0hq9yOnyhTr3R1xVQrZ tHGg== 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=6uUpEI08oXikXCp5+9gsd81DMfh5aZ7xYc26aZNsMcE=; b=axxSj8WdoIeqELgFSwRFpI0p64tv/OgeZil7p4ZheR41SDPdvkm5duxSgthQddaDaA yvAvPbySVFSjat3vbZclrBkg1yeljZ/nG4JHhR/BrDwAIomSuXtc14ZTRO9nIpemEmcV rdQ88XsczsBS+65NKyVSza54uh0mw90vVfLNBmUi9Yk7YBPpAijWKtnNSrbPeRuQK4IV hREx1y4DSBZwFwwZsHikwNlIJ9D2ynZCP6AxyLVZHnXPaYUYB5LiczSebN4X72Prck5s XbQN28CNrhgIrMbat5Wpm2EzalZsaRiLUAqCK3TQvFK6Cuzaj7pZWhgKhxxoJsZD/c3M W/ag== X-Gm-Message-State: ANhLgQ2Z06DbiW+Q0+OtsLn7S5G8PL9tNBXd9/jrCjllyyDfmYv2D3Gj 7zn58HsXJatlar6hSBpyGz7TCXN5NnTL X-Received: by 2002:ac8:6890:: with SMTP id m16mr10623891qtq.5.1585555446842; Mon, 30 Mar 2020 01:04:06 -0700 (PDT) Date: Mon, 30 Mar 2020 10:03:56 +0200 In-Reply-To: <20200327100801.161671-1-courbet@google.com> Message-Id: <20200330080400.124803-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 v3] 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 , 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 Cc: stable@vger.kernel.org # v4.14+ Fixes: c9029ef9c957 ("powerpc: Avoid clang warnings around setjmp and longjmp") --- v2: Use and array type as suggested by Segher Boessenkool Add fix tags. v3: Properly place tags. --- 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