Skip to content

Commit

Permalink
SH: ABORT_INSTRUCTION.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Schwinge committed Jun 23, 2012
1 parent a9def8c commit 967705f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
2012-06-23 Thomas Schwinge <thomas@codesourcery.com>

* sysdeps/sh/abort-instr.h: New file.
* sysdeps/unix/sysv/linux/sh/makecontext.S (.Lexitcode): Terminate the
process in case exit returns.

* sysdeps/unix/sysv/linux/sh/makecontext.S (.Lexitcode): Always
initialize the GOT register before use.

Expand Down
3 changes: 3 additions & 0 deletions sysdeps/sh/abort-instr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* An instruction which should crash any program is `sleep'. */
#define ABORT_INSTRUCTION_ASM sleep
#define ABORT_INSTRUCTION asm ("sleep")
7 changes: 4 additions & 3 deletions sysdeps/unix/sysv/linux/sh/makecontext.S
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */

#include <sysdep.h>
#include <abort-instr.h>

#include "ucontext_i.h"

Expand Down Expand Up @@ -124,9 +125,9 @@ ENTRY(__makecontext)
#endif
jsr @r1
mov r0, r4
0:
bra 0b
nop
/* The 'exit' call should never return. In case it does cause the
process to terminate. */
ABORT_INSTRUCTION_ASM

.align 2
#ifdef PIC
Expand Down

0 comments on commit 967705f

Please sign in to comment.