Skip to content

Commit

Permalink
powerpc: Add attributes for setjmp/longjmp
Browse files Browse the repository at this point in the history
The setjmp function should be declared as "returns_twice", or bad
things can happen[1]. This does not actually change generated code in
my testing.

The longjmp function should be declared as "noreturn", so that the
compiler can optimise calls to it better. This makes the generated
code a little shorter.

1: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-returns_005ftwice-function-attribute

Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/c02ce4a573f3bac907e2c70957a2d1275f910013.1567605586.git.segher@kernel.crashing.org
  • Loading branch information
Segher Boessenkool authored and Michael Ellerman committed Sep 11, 2019
1 parent 67c8789 commit aa497d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/include/asm/setjmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#define JMP_BUF_LEN 23

extern long setjmp(long *);
extern void longjmp(long *, long);
extern long setjmp(long *) __attribute__((returns_twice));
extern void longjmp(long *, long) __attribute__((noreturn));

#endif /* _ASM_POWERPC_SETJMP_H */

0 comments on commit aa497d4

Please sign in to comment.