Skip to content

Add support for GCC's __builtin_unreachable() and use it in BUG (v2.1).

David Daney linux-arch linux-mips linux-s390 lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5Add support for GCC-4.5's __builtin_unreachable() to compiler.h (v2)include/linux/compiler-gcc4.h include/linux/compiler.h+19 -00 replies
2/5x86: Convert BUG() to use unreachable()arch/x86/include/asm/bug.h+2 -20 replies
3/5MIPS: Convert BUG() to use unreachable()arch/mips/include/asm/bug.h+1 -30 replies
4/5s390: Convert BUG() to use unreachable()arch/s390/include/asm/bug.h+1 -10 replies
5/5avr32: Convert BUG() to use unreachable()arch/avr32/include/asm/bug.h+1 -10 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchRalf BaechleMartin SchwidefskyHaavard SkinnemoenH. Peter Anvin
1/5A-b
2/5A-b
3/5A-b
4/5A-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 0/5] Add support for GCC's __builtin_unreachable() and use it in BUG (v2.1).

Greetings Linus et al.,

From the announcement of the first version:

Starting with version 4.5, GCC has a new built-in function called __builtin_unreachable(). The function tells the compiler that control flow will never reach that point. Currently we trick the compiler by putting in for(;;); but this has the disadvantage that extra code is emitted for an endless loop. For an i386 kernel using __builtin_unreachable() results in an defaultconfig that is nearly 4000 bytes smaller.

This patch set adds support to compiler.h creating a new macro usable in the kernel called unreachable(). If the compiler lacks __builtin_unreachable(), it just expands to for(;;).

For version 2:

I fixed a couple of checkpatch issues, and simplified the unreachable() macro for the pre-GCC-4.5 case (as suggested by Richard Henderson). Also several Acked-by: were added.

For this version 2.1:

I removed patches from the set for which there were no Acked-by, and rebased and tested against 2.6.32.

I will reply with the 5 patches.

David Daney (5):
Add support for GCC-4.5's __builtin_unreachable() to compiler.h (v2)
x86: Convert BUG() to use unreachable()
MIPS: Convert BUG() to use unreachable()
s390: Convert BUG() to use unreachable()
avr32: Convert BUG() to use unreachable()

 arch/avr32/include/asm/bug.h  |    2 +-
 arch/mips/include/asm/bug.h   |    4 +---
 arch/s390/include/asm/bug.h   |    2 +-
 arch/x86/include/asm/bug.h    |    4 ++--
 include/linux/compiler-gcc4.h |   14 ++++++++++++++
 include/linux/compiler.h      |    5 +++++
 6 files changed, 24 insertions(+), 7 deletions(-)