Skip to content

Commit c17eb4d

Browse files
legrosbufflempe
authored andcommitted
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: c9029ef ("powerpc: Avoid clang warnings around setjmp and longjmp") Cc: [email protected] # v4.14+ Signed-off-by: Clement Courbet <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 41b8426 commit c17eb4d

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
@@ -7,7 +7,9 @@
77

88
#define JMP_BUF_LEN 23
99

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));
1214

1315
#endif /* _ASM_POWERPC_SETJMP_H */

arch/powerpc/kexec/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
# Makefile for the linux kernel.
44
#
55

6-
# Avoid clang warnings around longjmp/setjmp declarations
7-
CFLAGS_crash.o += -ffreestanding
8-
96
obj-y += core.o crash.o core_$(BITS).o
107

118
obj-$(CONFIG_PPC32) += relocate_32.o

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
GCOV_PROFILE := n
85
KCOV_INSTRUMENT := n
96
UBSAN_SANITIZE := n

0 commit comments

Comments
 (0)