Skip to content

Commit

Permalink
powerpc: Avoid clang warnings around setjmp and longjmp
Browse files Browse the repository at this point in the history
Commit aea4471 ("powerpc: Disable -Wbuiltin-requires-header when
setjmp is used") disabled -Wbuiltin-requires-header because of a
warning about the setjmp and longjmp declarations.

r367387 in clang added another diagnostic around this, complaining
that there is no jmp_buf declaration.

  In file included from ../arch/powerpc/xmon/xmon.c:47:
  ../arch/powerpc/include/asm/setjmp.h:10:13: error: declaration of
  built-in function 'setjmp' requires the declaration of the 'jmp_buf'
  type, commonly provided in the header <setjmp.h>.
  [-Werror,-Wincomplete-setjmp-declaration]
  extern long setjmp(long *);
              ^
  ../arch/powerpc/include/asm/setjmp.h:11:13: error: declaration of
  built-in function 'longjmp' requires the declaration of the 'jmp_buf'
  type, commonly provided in the header <setjmp.h>.
  [-Werror,-Wincomplete-setjmp-declaration]
  extern void longjmp(long *, long);
              ^
  2 errors generated.

We are not using the standard library's longjmp/setjmp implementations
for obvious reasons; make this clear to clang by using -ffreestanding
on these files.

Cc: stable@vger.kernel.org # 4.14+
Suggested-by: Segher Boessenkool <segher@kernel.crashing.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191119045712.39633-3-natechancellor@gmail.com
  • Loading branch information
Nathan Chancellor authored and Michael Ellerman committed Nov 25, 2019
1 parent 465bfd9 commit c9029ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/kexec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Makefile for the linux kernel.
#

# Disable clang warning for using setjmp without setjmp.h header
CFLAGS_crash.o += $(call cc-disable-warning, builtin-requires-header)
# Avoid clang warnings around longjmp/setjmp declarations
CFLAGS_crash.o += -ffreestanding

obj-y += core.o crash.o core_$(BITS).o

Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/xmon/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0
# Makefile for xmon

# Disable clang warning for using setjmp without setjmp.h header
subdir-ccflags-y := $(call cc-disable-warning, builtin-requires-header)
# Avoid clang warnings around longjmp/setjmp declarations
subdir-ccflags-y := -ffreestanding

GCOV_PROFILE := n
KCOV_INSTRUMENT := n
Expand Down

0 comments on commit c9029ef

Please sign in to comment.