aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--sysdeps/sh/____longjmp_chk.S17
-rw-r--r--sysdeps/unix/sysv/linux/sh/____longjmp_chk.S17
-rw-r--r--sysdeps/unix/sysv/linux/sh/makecontext.S12
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.h11
5 files changed, 57 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 649b656da1..06c33afa2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2012-06-23 Thomas Schwinge <thomas@codesourcery.com>
+ * sysdeps/sh/____longjmp_chk.S (CALL_FAIL): Preserve r12 and pr
+ registers for frame unwinding purposes, add CFI directives.
+ * sysdeps/unix/sysv/linux/sh/____longjmp_chk.S (CALL_FAIL): Likewise.
+ * sysdeps/unix/sysv/linux/sh/makecontext.S (.Lexitcode): Likewise
+ * sysdeps/unix/sysv/linux/sh/sysdep.h (SYSCALL_ERROR_HANDLER):
+ Likewise.
+
* sysdeps/sh/____longjmp_chk.S (CALL_FAIL): Don't plan for the call to
__fortify_fail returning.
* sysdeps/unix/sysv/linux/sh/____longjmp_chk.S (CALL_FAIL): Likewise.
diff --git a/sysdeps/sh/____longjmp_chk.S b/sysdeps/sh/____longjmp_chk.S
index e8d5f687e1..b37a94861c 100644
--- a/sysdeps/sh/____longjmp_chk.S
+++ b/sysdeps/sh/____longjmp_chk.S
@@ -28,9 +28,16 @@ longjmp_msg:
# define CALL_FAIL \
mov.l .Lfail, r1; \
mov.l .Lstr, r4; \
+ mov.l r12, @-r15; \
+ cfi_remember_state; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (r12, 0); \
mova .Lgot, r0; \
mov.l .Lgot, r12; \
add r0, r12; \
+ sts.l pr, @-r15; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (pr, 0); \
bsrf r1; \
add r12, r4; \
/* Unreachable. */ \
@@ -41,11 +48,16 @@ longjmp_msg:
.Lstr: \
.long longjmp_msg@GOTOFF; \
.Lfail: \
- .long __GI___fortify_fail@PLT-(.Lfail0-.);
+ .long __GI___fortify_fail@PLT-(.Lfail0-.); \
+ cfi_restore_state;
#else
# define CALL_FAIL \
mov.l .Lfail, r1; \
mov.l .Lstr, r4; \
+ sts.l pr, @-r15; \
+ cfi_remember_state; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (pr, 0); \
jsr @r1; \
nop; \
/* Unreachable. */ \
@@ -53,7 +65,8 @@ longjmp_msg:
.Lstr: \
.long longjmp_msg; \
.Lfail: \
- .long __fortify_fail;
+ .long __fortify_fail; \
+ cfi_restore_state;
#endif
#define CHECK_SP(reg) \
diff --git a/sysdeps/unix/sysv/linux/sh/____longjmp_chk.S b/sysdeps/unix/sysv/linux/sh/____longjmp_chk.S
index bcf828bc03..d74caa21b8 100644
--- a/sysdeps/unix/sysv/linux/sh/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/sh/____longjmp_chk.S
@@ -32,9 +32,16 @@ longjmp_msg:
# define CALL_FAIL \
mov.l .Lfail, r1; \
mov.l .Lstr, r4; \
+ mov.l r12, @-r15; \
+ cfi_remember_state; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (r12, 0); \
mova .Lgot, r0; \
mov.l .Lgot, r12; \
add r0, r12; \
+ sts.l pr, @-r15; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (pr, 0); \
bsrf r1; \
add r12, r4; \
.Lfail0: \
@@ -45,11 +52,16 @@ longjmp_msg:
.Lstr: \
.long longjmp_msg@GOTOFF; \
.Lfail: \
- .long __GI___fortify_fail@PLT-(.Lfail0-.);
+ .long __GI___fortify_fail@PLT-(.Lfail0-.); \
+ cfi_restore_state;
#else
# define CALL_FAIL \
mov.l .Lfail, r1; \
mov.l .Lstr, r4; \
+ sts.l pr, @-r15; \
+ cfi_remember_state; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (pr, 0); \
jsr @r1; \
nop; \
/* Unreachable. */ \
@@ -57,7 +69,8 @@ longjmp_msg:
.Lstr: \
.long longjmp_msg; \
.Lfail: \
- .long __fortify_fail;
+ .long __fortify_fail; \
+ cfi_restore_state;
#endif
#define CHECK_SP(reg) \
diff --git a/sysdeps/unix/sysv/linux/sh/makecontext.S b/sysdeps/unix/sysv/linux/sh/makecontext.S
index ec9ce91693..a04bc9f635 100644
--- a/sysdeps/unix/sysv/linux/sh/makecontext.S
+++ b/sysdeps/unix/sysv/linux/sh/makecontext.S
@@ -97,8 +97,12 @@ ENTRY(__makecontext)
cfi_endproc
.align 5
+ cfi_startproc
.Lexitcode:
#ifdef PIC
+ mov.l r12, @-r15
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (r12, 0)
mova .Lgot, r0
mov.l .Lgot, r12
add r0, r12
@@ -107,6 +111,9 @@ ENTRY(__makecontext)
bt/s 2f
mov r8, r4 /* r4 <- ucb->uc_link */
mov.l .Lsetcontext, r1
+ sts.l pr, @-r15
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (pr, 0)
#ifdef PIC
bsrf r1
.LPCS0:
@@ -115,6 +122,10 @@ ENTRY(__makecontext)
jsr @r1
nop
#endif
+ /* Restore to keep CFI/CFA balanced. */
+ lds.l @r15+, pr
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (pr)
/* If this returns (which can happen if the syscall fails) we'll exit
the program with the return error value (-1). */
@@ -143,7 +154,6 @@ ENTRY(__makecontext)
.Lexit:
.long HIDDEN_JUMPTARGET(exit)
#endif
- cfi_startproc
PSEUDO_END(__makecontext)
weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h
index 5215a845d9..ce72c66a77 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1992,1993,1995-2000,2002-2006,2009,2011
- Free Software Foundation, Inc.
+/* Copyright (C) 1992-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
@@ -100,11 +99,15 @@
# if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER \
neg r0,r1; \
+ mov r12,r2; \
+ cfi_register (r12, r2); \
mov.l 0f,r12; \
mova 0f,r0; \
add r0,r12; \
mov.l 1f,r0; \
mov.l r1,@(r0,r12); \
+ mov r2,r12; \
+ cfi_restore (r12); \
bra .Lpseudo_end; \
mov _IMM1,r0; \
.align 2; \
@@ -121,6 +124,7 @@
# define SYSCALL_ERROR_HANDLER \
neg r0,r1; \
mov r12,r2; \
+ cfi_register (r12, r2); \
mov.l 0f,r12; \
mova 0f,r0; \
add r0,r12; \
@@ -128,6 +132,7 @@
stc gbr, r4; \
mov.l @(r0,r12),r0; \
mov r2,r12; \
+ cfi_restore (r12); \
add r4,r0; \
mov.l r1,@r0; \
bra .Lpseudo_end; \
@@ -140,12 +145,14 @@
# define SYSCALL_ERROR_HANDLER \
neg r0,r1; \
mov r12,r2; \
+ cfi_register (r12, r2); \
mov.l 0f,r12; \
mova 0f,r0; \
add r0,r12; \
mov.l 1f,r0; \
mov.l @(r0,r12),r0; \
mov r2,r12; \
+ cfi_restore (r12); \
mov.l r1,@r0; \
bra .Lpseudo_end; \
mov _IMM1,r0; \