History

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.

Clement Courbet committed 6 years ago

Commit c17eb4d1 parent 41b84263 files · +4 −8Browse files

Unified · Split

3 files
  1. arch/powerpc/include/asm/setjmp.h +4 −2
  2. arch/powerpc/kexec/Makefile +0 −3
  3. arch/powerpc/xmon/Makefile +0 −3
arch/powerpc/include/asm/setjmp.h+4−2
@@ -7,7 +7,9 @@ · 6 unmodified lines
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+0−3
@@ -3,9 +3,6 @@ · 2 unmodified lines
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+0−3
@@ -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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t