This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] alpha: Add cfi information for _startcontext routines to stop unwinding [BZ#22910]


Starting with GCC 8, libgc1c is better at unwinding on alpha. This
causes backtrace called within a context created by makecontext to yield
infinite backtrace. This patch adds cfi information for _startcontext
and ra which marks the frame as outermost frame.

This fixes tst-makecontext for alpha.
---
 ChangeLog                                   | 6 ++++++
 sysdeps/unix/sysv/linux/alpha/makecontext.S | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 4b7e0a0261..8ea10886e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-01  Aurelien Jarno  <aurelien@aurel32.net>
+
+	[BZ #22910]
+	* sysdeps/unix/sysv/linux/alpha/setcontext.S (__startcontext): Set
+	up CFI directive to forbid further backtracing.
+
 2018-03-01  Maciej W. Rozycki  <macro@mips.com>
 
 	* nptl_db/td_ta_thr_iter.c (iterate_thread_list): Remove
diff --git a/sysdeps/unix/sysv/linux/alpha/makecontext.S b/sysdeps/unix/sysv/linux/alpha/makecontext.S
index cae2144e03..cc824dfe25 100644
--- a/sysdeps/unix/sysv/linux/alpha/makecontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/makecontext.S
@@ -138,10 +138,14 @@ weak_alias (__makecontext, makecontext)
 
 	.align	4
 	.ent	__startcontext
+	cfi_startproc
 __startcontext:
 	.frame $31, 0, $31, 0
 	.prologue 0
 
+	/* Mark ra as undefined in order to stop unwinding here.  */
+	cfi_undefined(ra)
+
 	jsr	$26, ($27), 0
 	ldgp	$29, 0($26)
 	mov	$9, $16
@@ -160,4 +164,5 @@ __startcontext:
 
 	halt
 
+	cfi_endproc
 	.end __startcontext
-- 
2.16.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]