Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Make setjmp/longjmp signature standard

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: c9029ef9c957 ("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

authored by

Clement Courbet and committed by
Michael Ellerman
c17eb4dc 41b8426f

+4 -8
+4 -2
arch/powerpc/include/asm/setjmp.h
··· 7 7 8 8 #define JMP_BUF_LEN 23 9 9 10 - extern long setjmp(long *) __attribute__((returns_twice)); 11 - extern void longjmp(long *, long) __attribute__((noreturn)); 10 + typedef long jmp_buf[JMP_BUF_LEN]; 11 + 12 + extern int setjmp(jmp_buf env) __attribute__((returns_twice)); 13 + extern void longjmp(jmp_buf env, int val) __attribute__((noreturn)); 12 14 13 15 #endif /* _ASM_POWERPC_SETJMP_H */
-3
arch/powerpc/kexec/Makefile
··· 3 3 # Makefile for the linux kernel. 4 4 # 5 5 6 - # Avoid clang warnings around longjmp/setjmp declarations 7 - CFLAGS_crash.o += -ffreestanding 8 - 9 6 obj-y += core.o crash.o core_$(BITS).o 10 7 11 8 obj-$(CONFIG_PPC32) += relocate_32.o
-3
arch/powerpc/xmon/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 # Makefile for xmon 3 3 4 - # Avoid clang warnings around longjmp/setjmp declarations 5 - subdir-ccflags-y := -ffreestanding 6 - 7 4 GCOV_PROFILE := n 8 5 KCOV_INSTRUMENT := n 9 6 UBSAN_SANITIZE := n