Skip to content

Commit 7934eaf

Browse files
legrosbufflegregkh
authored andcommitted
powerpc: Make setjmp/longjmp signature standard
commit c17eb4d upstream. 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. Fixes: c9029ef ("powerpc: Avoid clang warnings around setjmp and longjmp") Cc: stable@vger.kernel.org # v4.14+ Signed-off-by: Clement Courbet <courbet@google.com> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Tested-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200330080400.124803-1-courbet@google.com Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ef29998 commit 7934eaf

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

arch/powerpc/include/asm/setjmp.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
#define JMP_BUF_LEN 23
1414

15-
extern long setjmp(long *) __attribute__((returns_twice));
16-
extern void longjmp(long *, long) __attribute__((noreturn));
15+
typedef long jmp_buf[JMP_BUF_LEN];
16+
17+
extern int setjmp(jmp_buf env) __attribute__((returns_twice));
18+
extern void longjmp(jmp_buf env, int val) __attribute__((noreturn));
1719

1820
#endif /* _ASM_POWERPC_SETJMP_H */

arch/powerpc/kernel/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66
CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
77

8-
# Avoid clang warnings around longjmp/setjmp declarations
9-
CFLAGS_crash.o += -ffreestanding
10-
118
subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
129

1310
ifeq ($(CONFIG_PPC64),y)

arch/powerpc/xmon/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
# Makefile for xmon
33

4-
# Avoid clang warnings around longjmp/setjmp declarations
5-
subdir-ccflags-y := -ffreestanding
6-
74
subdir-ccflags-$(CONFIG_PPC_WERROR) += -Werror
85

96
GCOV_PROFILE := n

0 commit comments

Comments
 (0)