SH: ABORT_INSTRUCTION.
authorThomas Schwinge <thomas@codesourcery.com>
Sat, 23 Jun 2012 09:47:39 +0000 (11:47 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Sat, 23 Jun 2012 09:47:39 +0000 (11:47 +0200)
ChangeLog
sysdeps/sh/abort-instr.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/sh/makecontext.S

index 751797d..1ec2e00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
 
diff --git a/sysdeps/sh/abort-instr.h b/sysdeps/sh/abort-instr.h
new file mode 100644 (file)
index 0000000..69381ae
--- /dev/null
@@ -0,0 +1,3 @@
+/* An instruction which should crash any program is `sleep'.  */
+#define ABORT_INSTRUCTION_ASM sleep
+#define ABORT_INSTRUCTION asm ("sleep")
index a847bb6..ec9ce91 100644 (file)
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <sysdep.h>
+#include <abort-instr.h>
 
 #include "ucontext_i.h"
 
@@ -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