about summary refs log tree commit diff
path: root/sysdeps/s390/s390-32
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.vnet.ibm.com>2017-12-11 08:47:51 +0100
committerStefan Liebler <stli@linux.vnet.ibm.com>2017-12-11 08:47:51 +0100
commitdee943668fdf97e118fe14f7953486b934cbf9c4 (patch)
tree486d68e7823f15f9031da4b49bfc3d8b284d336c /sysdeps/s390/s390-32
parentf648728cb17bcf043b6f750f360b6c8960c491fd (diff)
downloadglibc-dee943668fdf97e118fe14f7953486b934cbf9c4.tar.gz
glibc-dee943668fdf97e118fe14f7953486b934cbf9c4.tar.xz
glibc-dee943668fdf97e118fe14f7953486b934cbf9c4.zip
S390: Add CFI rule in _dl_runtime_resolve[_vx] for unwinding.
In _dl_runtime_resolve[_vx], unwinding fails after the new stack frame
is created as there is no CFI rule for r15. This is also observeable in
GDB: Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Therefore this patch is now storing r15 on stack and is using cfi_offset rule.
The stmg/lmg instruction is used to store/load r14 and r15 with one instruction.
On 64bit, the offsets of the fprs have moved to store r15 directly after r14.
On 31bit, the r14/r15 is now stored between the other gprs and fprs as the space
wasn't used.

ChangeLog:

	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
	Store r15 on stack and add cfi rule.
	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
	Likewise.
Diffstat (limited to 'sysdeps/s390/s390-32')
-rw-r--r--sysdeps/s390/s390-32/dl-trampoline.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/sysdeps/s390/s390-32/dl-trampoline.h b/sysdeps/s390/s390-32/dl-trampoline.h
index 19776eec8a..2d6a67474f 100644
--- a/sysdeps/s390/s390-32/dl-trampoline.h
+++ b/sysdeps/s390/s390-32/dl-trampoline.h
@@ -51,12 +51,13 @@ _dl_runtime_resolve:
 	cfi_offset (r3, -60)
 	cfi_offset (r4, -56)
 	cfi_offset (r5, -52)
+	stm    %r14,%r15,48(%r15)
+	cfi_offset (r14, -48)
+	cfi_offset (r15, -44)
 	std    %f0,56(%r15)
 	cfi_offset (f0, -40)
 	std    %f2,64(%r15)
 	cfi_offset (f2, -32)
-	st     %r14,8(%r15)
-	cfi_offset (r14, -88)
 	lr     %r0,%r15
 	lm     %r2,%r3,24(%r15)		# load args saved by PLT
 #ifdef RESTORE_VRS
@@ -90,13 +91,11 @@ _dl_runtime_resolve:
 	.machinemode "zarch_nohighgprs"
 	vlm    %v24,%v31,96(%r15)	# restore vector registers
 	.machine pop
-	ahi   %r15,224			# remove stack frame
-	cfi_adjust_cfa_offset (-224)
+	lm     %r14,%r15,272(%r15)# remove stack frame and restore registers
 #else
-	ahi    %r15,96			# remove stack frame
-	cfi_adjust_cfa_offset (-96)
+	lm     %r14,%r15,144(%r15)# remove stack frame and restore registers
 #endif
-	l      %r14,8(15)		# restore registers
+	cfi_def_cfa_offset (96)
 	ld     %f0,56(%r15)
 	ld     %f2,64(%r15)
 	lm     %r2,%r5,32(%r15)