public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 01/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_resolve
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
  2018-08-02  7:58 ` [PATCH 02/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_profile Ilya Leoshkevich
  2018-08-02  7:58 ` [PATCH 03/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_resolve Ilya Leoshkevich
@ 2018-08-02  7:58 ` Ilya Leoshkevich
  2018-08-02  7:59 ` [PATCH 09/12] S390: Test that lazy binding does not clobber R0 Ilya Leoshkevich
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:58 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

Maintainability improvement.

         * sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
           Use symbolic offsets for stack variables.
---
 sysdeps/s390/s390-32/dl-trampoline.h | 109 ++++++++++++++++++---------
 1 file changed, 73 insertions(+), 36 deletions(-)

diff --git a/sysdeps/s390/s390-32/dl-trampoline.h b/sysdeps/s390/s390-32/dl-trampoline.h
index d36c002743..547e1ebaa3 100644
--- a/sysdeps/s390/s390-32/dl-trampoline.h
+++ b/sysdeps/s390/s390-32/dl-trampoline.h
@@ -40,45 +40,66 @@
  *   v16 - v31 : call clobbered
  */
 
-
+#define CFA_OFF 96
+#define FRAME_OFF CFA_OFF + FRAME_SIZE
+#define V24_OFF -224
+#define V25_OFF -208
+#define V26_OFF -192
+#define V27_OFF -176
+#define V28_OFF -160
+#define V29_OFF -144
+#define V30_OFF -128
+#define V31_OFF -112
+#define PLT1_OFF -72
+#define PLT2_OFF -68
+#define R2_OFF -64
+#define R3_OFF -60
+#define R4_OFF -56
+#define R5_OFF -52
+#define R14_OFF -48
+#define R15_OFF -44
+#define F0_OFF -40
+#define F2_OFF -32
 	.globl _dl_runtime_resolve
 	.type _dl_runtime_resolve, @function
 	cfi_startproc
 	.align 16
 _dl_runtime_resolve:
-	stm    %r2,%r5,32(%r15)		# save registers
-	cfi_offset (r2, -64)
-	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)
+	stm    %r2,%r5,CFA_OFF+R2_OFF(%r15) # save registers
+	cfi_offset (r2, R2_OFF)
+	cfi_offset (r3, R3_OFF)
+	cfi_offset (r4, R4_OFF)
+	cfi_offset (r5, R5_OFF)
+	stm    %r14,%r15,CFA_OFF+R14_OFF(%r15)
+	cfi_offset (r14, R14_OFF)
+	cfi_offset (r15, R15_OFF)
+	std    %f0,CFA_OFF+F0_OFF(%r15)
+	cfi_offset (f0, F0_OFF)
+	std    %f2,CFA_OFF+F2_OFF(%r15)
+	cfi_offset (f2, F2_OFF)
 	lr     %r0,%r15
-	lm     %r2,%r3,24(%r15)		# load args saved by PLT
+	lm     %r2,%r3,CFA_OFF+PLT1_OFF(%r15) # load args saved by PLT
 #ifdef RESTORE_VRS
-	ahi    %r15,-224		# create stack frame
-	cfi_adjust_cfa_offset (224)
+# define FRAME_SIZE (CFA_OFF + 128)
+	ahi    %r15,-FRAME_SIZE # create stack frame
+	cfi_adjust_cfa_offset (FRAME_SIZE)
 	.machine push
 	.machine "z13"
 	.machinemode "zarch_nohighgprs"
-	vstm   %v24,%v31,96(%r15)	# store call-clobbered vr arguments
-	cfi_offset (v24, -224)
-	cfi_offset (v25, -208)
-	cfi_offset (v26, -192)
-	cfi_offset (v27, -176)
-	cfi_offset (v28, -160)
-	cfi_offset (v29, -144)
-	cfi_offset (v30, -128)
-	cfi_offset (v31, -112)
+	vstm   %v24,%v31,FRAME_OFF+V24_OFF(%r15) # save call-clobbered vr args
+	cfi_offset (v24, V24_OFF)
+	cfi_offset (v25, V25_OFF)
+	cfi_offset (v26, V26_OFF)
+	cfi_offset (v27, V27_OFF)
+	cfi_offset (v28, V28_OFF)
+	cfi_offset (v29, V29_OFF)
+	cfi_offset (v30, V30_OFF)
+	cfi_offset (v31, V31_OFF)
 	.machine pop
 #else
-	ahi    %r15,-96			# create stack frame
-	cfi_adjust_cfa_offset (96)
+# define FRAME_SIZE CFA_OFF
+	ahi    %r15,-FRAME_SIZE # create stack frame
+	cfi_adjust_cfa_offset (FRAME_SIZE)
 #endif
 	st     %r0,0(%r15)		# write backchain
 	basr   %r1,0
@@ -89,21 +110,37 @@ _dl_runtime_resolve:
 	.machine push
 	.machine "z13"
 	.machinemode "zarch_nohighgprs"
-	vlm    %v24,%v31,96(%r15)	# restore vector registers
+	vlm    %v24,%v31,FRAME_OFF+V24_OFF(%r15) # restore vector registers
 	.machine pop
-	lm     %r14,%r15,272(%r15)# remove stack frame and restore registers
-#else
-	lm     %r14,%r15,144(%r15)# remove stack frame and restore registers
 #endif
-	cfi_def_cfa_offset (96)
-	ld     %f0,56(%r15)
-	ld     %f2,64(%r15)
-	lm     %r2,%r5,32(%r15)
+	lm     %r14,%r15,FRAME_OFF+R14_OFF(%r15) # restore frame and registers
+#undef FRAME_SIZE
+	cfi_def_cfa_offset (CFA_OFF)
+	ld     %f0,CFA_OFF+F0_OFF(%r15)
+	ld     %f2,CFA_OFF+F2_OFF(%r15)
+	lm     %r2,%r5,CFA_OFF+R2_OFF(%r15)
 	br     %r1
 1:	.long  _dl_fixup - 0b
 	cfi_endproc
 	.size _dl_runtime_resolve, .-_dl_runtime_resolve
-
+#undef V24_OFF
+#undef V25_OFF
+#undef V26_OFF
+#undef V27_OFF
+#undef V28_OFF
+#undef V29_OFF
+#undef V30_OFF
+#undef V31_OFF
+#undef PLT1_OFF
+#undef PLT2_OFF
+#undef R2_OFF
+#undef R3_OFF
+#undef R4_OFF
+#undef R5_OFF
+#undef R14_OFF
+#undef R15_OFF
+#undef F0_OFF
+#undef F2_OFF
 
 #ifndef PROF
 	.globl _dl_runtime_profile
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 03/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_resolve
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
  2018-08-02  7:58 ` [PATCH 02/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_profile Ilya Leoshkevich
@ 2018-08-02  7:58 ` Ilya Leoshkevich
  2018-08-02  7:58 ` [PATCH 01/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_resolve Ilya Leoshkevich
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:58 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

Maintainability improvement.

         * sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
           Use symbolic offsets for stack variables.
---
 sysdeps/s390/s390-64/dl-trampoline.h | 124 ++++++++++++++++++---------
 1 file changed, 83 insertions(+), 41 deletions(-)

diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/s390-64/dl-trampoline.h
index d313fd521d..0a74694fad 100644
--- a/sysdeps/s390/s390-64/dl-trampoline.h
+++ b/sysdeps/s390/s390-64/dl-trampoline.h
@@ -37,47 +37,71 @@
  *   v16 - v31 : call clobbered
  */
 
+#define CFA_OFF 160
+#define FRAME_OFF CFA_OFF + FRAME_SIZE
+#define V24_OFF -288
+#define V25_OFF -272
+#define V26_OFF -256
+#define V27_OFF -240
+#define V28_OFF -224
+#define V29_OFF -208
+#define V30_OFF -192
+#define V31_OFF -176
+#define PLT1_OFF -112
+#define PLT2_OFF -104
+#define R2_OFF -96
+#define R3_OFF -88
+#define R4_OFF -80
+#define R5_OFF -72
+#define R14_OFF -64
+#define R15_OFF -56
+#define F0_OFF -48
+#define F2_OFF -40
+#define F4_OFF -32
+#define F6_OFF -24
 	.globl _dl_runtime_resolve
 	.type _dl_runtime_resolve, @function
 	cfi_startproc
 	.align 16
 _dl_runtime_resolve:
-	stmg   %r2,%r5,64(%r15)	# save call-clobbered argument registers
-	cfi_offset (r2, -96)
-	cfi_offset (r3, -88)
-	cfi_offset (r4, -80)
-	cfi_offset (r5, -72)
-	stmg   %r14,%r15,96(%r15)
-	cfi_offset (r14, -64)
-	cfi_offset (r15, -56)
-	std    %f0,112(%r15)
-	cfi_offset (f0, -48)
-	std    %f2,120(%r15)
-	cfi_offset (f2, -40)
-	std    %f4,128(%r15)
-	cfi_offset (f4, -32)
-	std    %f6,136(%r15)
-	cfi_offset (f6, -24)
-	lmg    %r2,%r3,48(%r15) # load args for fixup saved by PLT
+	stmg   %r2,%r5,CFA_OFF+R2_OFF(%r15) # save registers
+	cfi_offset (r2, R2_OFF)
+	cfi_offset (r3, R3_OFF)
+	cfi_offset (r4, R4_OFF)
+	cfi_offset (r5, R5_OFF)
+	stmg   %r14,%r15,CFA_OFF+R14_OFF(%r15)
+	cfi_offset (r14, R14_OFF)
+	cfi_offset (r15, R15_OFF)
+	std    %f0,CFA_OFF+F0_OFF(%r15)
+	cfi_offset (f0, F0_OFF)
+	std    %f2,CFA_OFF+F2_OFF(%r15)
+	cfi_offset (f2, F2_OFF)
+	std    %f4,CFA_OFF+F4_OFF(%r15)
+	cfi_offset (f4, F4_OFF)
+	std    %f6,CFA_OFF+F6_OFF(%r15)
+	cfi_offset (f6, F6_OFF)
+	lmg    %r2,%r3,CFA_OFF+PLT1_OFF(%r15) # load args saved by PLT
 	lgr    %r0,%r15
 #ifdef RESTORE_VRS
-	aghi   %r15,-288        # create stack frame
-	cfi_adjust_cfa_offset (288)
+# define FRAME_SIZE (CFA_OFF + 128)
+	aghi   %r15,-FRAME_SIZE # create stack frame
+	cfi_adjust_cfa_offset (FRAME_SIZE)
 	.machine push
 	.machine "z13"
-	vstm   %v24,%v31,160(%r15)# store call-clobbered vector argument registers
-	cfi_offset (v24, -288)
-	cfi_offset (v25, -272)
-	cfi_offset (v26, -256)
-	cfi_offset (v27, -240)
-	cfi_offset (v28, -224)
-	cfi_offset (v29, -208)
-	cfi_offset (v30, -192)
-	cfi_offset (v31, -176)
+	vstm   %v24,%v31,FRAME_OFF+V24_OFF(%r15) # save call-clobbered vr args
+	cfi_offset (v24, V24_OFF)
+	cfi_offset (v25, V25_OFF)
+	cfi_offset (v26, V26_OFF)
+	cfi_offset (v27, V27_OFF)
+	cfi_offset (v28, V28_OFF)
+	cfi_offset (v29, V29_OFF)
+	cfi_offset (v30, V30_OFF)
+	cfi_offset (v31, V31_OFF)
 	.machine pop
 #else
-	aghi   %r15,-160        # create stack frame
-	cfi_adjust_cfa_offset (160)
+# define FRAME_SIZE CFA_OFF
+	aghi   %r15,-FRAME_SIZE # create stack frame
+	cfi_adjust_cfa_offset (FRAME_SIZE)
 #endif
 	stg    %r0,0(%r15)      # write backchain
 	brasl  %r14,_dl_fixup	# call _dl_fixup
@@ -85,22 +109,40 @@ _dl_runtime_resolve:
 #ifdef RESTORE_VRS
 	.machine push
 	.machine "z13"
-	vlm    %v24,%v31,160(%r15)# restore vector registers
+	vlm    %v24,%v31,FRAME_OFF+V24_OFF(%r15) # restore vector registers
 	.machine pop
-	lmg    %r14,%r15,384(%r15)# remove stack frame and restore registers
-#else
-	lmg    %r14,%r15,256(%r15)# remove stack frame and restore registers
 #endif
-	cfi_def_cfa_offset (160)
-	ld     %f0,112(%r15)
-	ld     %f2,120(%r15)
-	ld     %f4,128(%r15)
-	ld     %f6,136(%r15)
-	lmg    %r2,%r5,64(%r15)
+	lmg    %r14,%r15,FRAME_OFF+R14_OFF(%r15) # restore frame and registers
+#undef FRAME_SIZE
+	cfi_def_cfa_offset (CFA_OFF)
+	ld     %f0,CFA_OFF+F0_OFF(%r15)
+	ld     %f2,CFA_OFF+F2_OFF(%r15)
+	ld     %f4,CFA_OFF+F4_OFF(%r15)
+	ld     %f6,CFA_OFF+F6_OFF(%r15)
+	lmg    %r2,%r5,CFA_OFF+R2_OFF(%r15)
 	br     %r1
 	cfi_endproc
 	.size _dl_runtime_resolve, .-_dl_runtime_resolve
-
+#undef V24_OFF
+#undef V25_OFF
+#undef V26_OFF
+#undef V27_OFF
+#undef V28_OFF
+#undef V29_OFF
+#undef V30_OFF
+#undef V31_OFF
+#undef PLT1_OFF
+#undef PLT2_OFF
+#undef R2_OFF
+#undef R3_OFF
+#undef R4_OFF
+#undef R5_OFF
+#undef R14_OFF
+#undef R15_OFF
+#undef F0_OFF
+#undef F2_OFF
+#undef F4_OFF
+#undef F6_OFF
 
 #ifndef PROF
 	.globl _dl_runtime_profile
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 00/12] S390: Implement __fentry__
@ 2018-08-02  7:58 Ilya Leoshkevich
  2018-08-02  7:58 ` [PATCH 02/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_profile Ilya Leoshkevich
                   ` (13 more replies)
  0 siblings, 14 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:58 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli

This patch series adds the runtime support in glibc for the -mfentry
gcc feature introduced in [1] and [2].

Patches 1-9 deal with avoiding clobbering %r0 when calling lazily bound
functions, so that the new __fentry__ symbol could be called with return
address in that register.

Patch 10 removes the assumption that only Intel implements __fentry__.

Patch 11 adds __fentry__ implementation.

Patch 12 is a cleanup of problems in 31-bit mcount, which are similar to
those found while implementing 64-bit __fentry__.

[1] https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00784.html
[2] https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00912.html


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 02/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_profile
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
@ 2018-08-02  7:58 ` Ilya Leoshkevich
  2018-08-02  7:58 ` [PATCH 03/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_resolve Ilya Leoshkevich
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:58 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

Maintainability improvement.

         * sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile):
           Use symbolic offsets for stack variables.
---
 sysdeps/s390/s390-32/dl-trampoline.h | 213 +++++++++++++++++----------
 1 file changed, 135 insertions(+), 78 deletions(-)

diff --git a/sysdeps/s390/s390-32/dl-trampoline.h b/sysdeps/s390/s390-32/dl-trampoline.h
index 547e1ebaa3..fa83b79926 100644
--- a/sysdeps/s390/s390-32/dl-trampoline.h
+++ b/sysdeps/s390/s390-32/dl-trampoline.h
@@ -143,125 +143,182 @@ _dl_runtime_resolve:
 #undef F2_OFF
 
 #ifndef PROF
+# define SIZEOF_STRUCT_LA_S390_32_REGS 168
+# define REGS_OFF -264
+# define R2_OFF -264
+# define R3_OFF -260
+# define R4_OFF -256
+# define R5_OFF -252
+# define R6_OFF -248
+# define F0_OFF -240
+# define F2_OFF -232
+# define V24_OFF -224
+# define V25_OFF -208
+# define V26_OFF -192
+# define V27_OFF -176
+# define V28_OFF -160
+# define V29_OFF -144
+# define V30_OFF -128
+# define V31_OFF -112
+# define R12_OFF -84
+# define R14_OFF -80
+# define FRAMESIZE_OFF -76
+# define PLT1_OFF -72
+# define PLT2_OFF -68
+# define PREGS_OFF -64
+# define RETVAL_OFF -56
+# define RET_R2_OFF -56
+# define RET_R3_OFF -52
+# define RET_F0_OFF -48
+# define RET_V24_OFF -40
 	.globl _dl_runtime_profile
 	.type _dl_runtime_profile, @function
 	cfi_startproc
 	.align 16
 _dl_runtime_profile:
-	st     %r12,12(%r15)		# r12 is used as backup of r15
-	cfi_offset (r12, -84)
-	st     %r14,16(%r15)
-	cfi_offset (r14, -80)
-	lr     %r12,%r15		# backup stack pointer
+	st     %r12,CFA_OFF+R12_OFF(%r15)	# r12 is used as backup of r15
+	cfi_offset (r12, R12_OFF)
+	st     %r14,CFA_OFF+R14_OFF(%r15)
+	cfi_offset (r14, R14_OFF)
+	lr     %r12,%r15			# backup stack pointer
 	cfi_def_cfa_register (12)
-	ahi    %r15,-264		# create stack frame:
-					# 96 + sizeof(La_s390_32_regs)
-	st     %r12,0(%r15)		# save backchain
+# define FRAME_SIZE (CFA_OFF + SIZEOF_STRUCT_LA_S390_32_REGS)
+	ahi    %r15,-FRAME_SIZE			# create stack frame:
+	st     %r12,0(%r15)			# save backchain
 
-	stm    %r2,%r6,96(%r15)		# save registers
-	cfi_offset (r2, -264)		# + r6 needed as arg for
-	cfi_offset (r3, -260)		#  _dl_profile_fixup
-	cfi_offset (r4, -256)
-	cfi_offset (r5, -252)
-	cfi_offset (r6, -248)
-	std    %f0,120(%r15)
-	cfi_offset (f0, -240)
-	std    %f2,128(%r15)
-	cfi_offset (f2, -232)
-#ifdef RESTORE_VRS
+	stm    %r2,%r6,FRAME_OFF+R2_OFF(%r15)	# save registers
+	cfi_offset (r2, R2_OFF)			# + r6 needed as arg for
+	cfi_offset (r3, R3_OFF)			#  _dl_profile_fixup
+	cfi_offset (r4, R4_OFF)
+	cfi_offset (r5, R5_OFF)
+	cfi_offset (r6, R6_OFF)
+	std    %f0,FRAME_OFF+F0_OFF(%r15)
+	cfi_offset (f0, F0_OFF)
+	std    %f2,FRAME_OFF+F2_OFF(%r15)
+	cfi_offset (f2, F2_OFF)
+# ifdef RESTORE_VRS
 	.machine push
 	.machine "z13"
 	.machinemode "zarch_nohighgprs"
-	vstm   %v24,%v31,136(%r15)	# store call-clobbered vr arguments
-	cfi_offset (v24, -224)
-	cfi_offset (v25, -208)
-	cfi_offset (v26, -192)
-	cfi_offset (v27, -176)
-	cfi_offset (v28, -160)
-	cfi_offset (v29, -144)
-	cfi_offset (v30, -128)
-	cfi_offset (v31, -112)
+	vstm   %v24,%v31,FRAME_OFF+V24_OFF(%r15)	# store call-clobbered
+	cfi_offset (v24, V24_OFF)			# vr arguments
+	cfi_offset (v25, V25_OFF)
+	cfi_offset (v26, V26_OFF)
+	cfi_offset (v27, V27_OFF)
+	cfi_offset (v28, V28_OFF)
+	cfi_offset (v29, V29_OFF)
+	cfi_offset (v30, V30_OFF)
+	cfi_offset (v31, V31_OFF)
 	.machine pop
-#endif
+# endif
 
-	lm     %r2,%r3,24(%r12)		# load arguments saved by PLT
-	lr     %r4,%r14			# return address as third parameter
+	lm     %r2,%r3,CFA_OFF+PLT1_OFF(%r12)	# load arguments saved by PLT
+	lr     %r4,%r14				# return address as third parm
 	basr   %r1,0
 0:	l      %r14,6f-0b(%r1)
-	la     %r5,96(%r15)		# pointer to struct La_s390_32_regs
-	la     %r6,20(%r12)		# long int * framesize
-	bas    %r14,0(%r14,%r1)		# call resolver
-	lr     %r1,%r2			# function addr returned in r2
-	ld     %f0,120(%r15)		# restore call-clobbered arg fprs
-	ld     %f2,128(%r15)
-#ifdef RESTORE_VRS
+	la     %r5,FRAME_OFF+REGS_OFF(%r15)	# struct La_s390_32_regs *
+	la     %r6,CFA_OFF+FRAMESIZE_OFF(%r12)	# long int * framesize
+	bas    %r14,0(%r14,%r1)			# call resolver
+	lr     %r1,%r2				# function addr returned in r2
+	ld     %f0,FRAME_OFF+F0_OFF(%r15)	# restore call-clobbered
+	ld     %f2,FRAME_OFF+F2_OFF(%r15)	# arg fprs
+# ifdef RESTORE_VRS
 	.machine push
 	.machine "z13"
-	.machinemode "zarch_nohighgprs"
-	vlm    %v24,%v31,136(%r15)	# restore call-clobbered arg vrs
+	.machinemode "zarch_nohighgprs"		# restore call-clobbered
+	vlm    %v24,%v31,FRAME_OFF+V24_OFF(%r15)# arg vrs
 	.machine pop
-#endif
-	icm    %r0,15,20(%r12)		# load & test framesize
+# endif
+	icm    %r0,15,CFA_OFF+FRAMESIZE_OFF(%r12)	# load & test framesize
 	jnm    2f
-
-	lm     %r2,%r6,96(%r15)		# framesize < 0 means no pltexit call
-					# so we can do a tail call without
-					# copying the arg overflow area
-	lr     %r15,%r12		# remove stack frame
+						# framesize < 0 means no
+	lm     %r2,%r6,FRAME_OFF+R2_OFF(%r15)	# pltexit call, so we can do a
+						# tail call without
+						# copying the arg overflow area
+	lr     %r15,%r12			# remove stack frame
 	cfi_def_cfa_register (15)
-	l      %r14,16(%r15)		# restore registers
-	l      %r12,12(%r15)
-	br     %r1			# tail-call to the resolved function
+	l      %r14,CFA_OFF+R14_OFF(%r15)	# restore registers
+	l      %r12,CFA_OFF+R12_OFF(%r15)
+	br     %r1				# tail call
 
 	cfi_def_cfa_register (12)
-2:	la     %r4,96(%r15)		# pointer to struct La_s390_32_regs
-	st     %r4,32(%r12)
-	jz     4f			# framesize == 0 ?
-	ahi    %r0,7			# align framesize to 8
+2:	la     %r4,FRAME_OFF+REGS_OFF(%r15)	# struct La_s390_32_regs *
+	st     %r4,CFA_OFF+PREGS_OFF(%r12)
+	jz     4f				# framesize == 0 ?
+	ahi    %r0,7				# align framesize to 8
 	lhi    %r2,-8
 	nr     %r0,%r2
-	slr    %r15,%r0			# make room for framesize bytes
-	st     %r12,0(%r15)		# save backchain
-	la     %r2,96(%r15)
-	la     %r3,96(%r12)
+	slr    %r15,%r0				# make room for framesize bytes
+	st     %r12,0(%r15)			# save backchain
+	la     %r2,FRAME_OFF+REGS_OFF(%r15)
+	la     %r3,CFA_OFF(%r12)
 	srl    %r0,3
-3:	mvc    0(8,%r2),0(%r3)		# copy additional parameters
+3:	mvc    0(8,%r2),0(%r3)			# copy additional parameters
 	la     %r2,8(%r2)
 	la     %r3,8(%r3)
 	brct   %r0,3b
-4:	lm     %r2,%r6,0(%r4)		# load register parameters
-	basr   %r14,%r1			# call resolved function
-	stm    %r2,%r3,40(%r12)		# store return values r2, r3, f0
-	std    %f0,48(%r12)		# to struct La_s390_32_retval
-#ifdef RESTORE_VRS
+4:	lm     %r2,%r6,0(%r4)			# load register parameters
+	basr   %r14,%r1				# call resolved function
+	stm    %r2,%r3,CFA_OFF+RET_R2_OFF(%r12)	# store return vals r2, r3, f0
+	std    %f0,CFA_OFF+RET_F0_OFF(%r12)	# to struct La_s390_32_retval
+# ifdef RESTORE_VRS
 	.machine push
 	.machine "z13"
-	vst    %v24,56(%r12)		# store return value v24
+	vst    %v24,CFA_OFF+RET_V24_OFF(%r12)	# store return value v24
 	.machine pop
-#endif
-	lm     %r2,%r4,24(%r12)		# r2, r3: load arguments saved by PLT
-					# r4: pointer to struct La_s390_32_regs
+# endif
+	lm     %r2,%r4,CFA_OFF+PLT1_OFF(%r12)	# r2, r3: args saved by PLT
+						# r4: struct La_s390_32_regs *
 	basr   %r1,0
 5:	l      %r14,7f-5b(%r1)
-	la     %r5,40(%r12)		# pointer to struct La_s390_32_retval
-	bas    %r14,0(%r14,%r1)		# call _dl_call_pltexit
+	la     %r5,CFA_OFF+RETVAL_OFF(%r12)	# struct La_s390_32_retval *
+	bas    %r14,0(%r14,%r1)			# call _dl_call_pltexit
 
-	lr     %r15,%r12		# remove stack frame
+	lr     %r15,%r12			# remove stack frame
+# undef FRAME_SIZE
 	cfi_def_cfa_register (15)
-	l      %r14,16(%r15)		# restore registers
-	l      %r12,12(%r15)
-	lm     %r2,%r3,40(%r15)		# restore return values
-	ld     %f0,48(%r15)
-#ifdef RESTORE_VRS
+	l      %r14,CFA_OFF+R14_OFF(%r15)	# restore registers
+	l      %r12,CFA_OFF+R12_OFF(%r15)
+	lm     %r2,%r3,CFA_OFF+RET_R2_OFF(%r15)	# restore return values
+	ld     %f0,CFA_OFF+RET_F0_OFF(%r15)
+# ifdef RESTORE_VRS
 	.machine push
 	.machine "z13"
-	vl    %v24,56(%r15)		# restore return value v24
+	vl    %v24,CFA_OFF+RET_V24_OFF(%r15)	# restore return value v24
 	.machine pop
-#endif
+# endif
 	br     %r14
 
 6:	.long  _dl_profile_fixup - 0b
 7:	.long  _dl_call_pltexit - 5b
 	cfi_endproc
 	.size _dl_runtime_profile, .-_dl_runtime_profile
+# undef SIZEOF_STRUCT_LA_S390_32_REGS
+# undef REGS_OFF
+# undef R2_OFF
+# undef R3_OFF
+# undef R4_OFF
+# undef R5_OFF
+# undef R6_OFF
+# undef F0_OFF
+# undef F2_OFF
+# undef V24_OFF
+# undef V25_OFF
+# undef V26_OFF
+# undef V27_OFF
+# undef V28_OFF
+# undef V29_OFF
+# undef V30_OFF
+# undef V31_OFF
+# undef R12_OFF
+# undef R14_OFF
+# undef FRAMESIZE_OFF
+# undef PLT1_OFF
+# undef PLT2_OFF
+# undef PREGS_OFF
+# undef RETVAL_OFF
+# undef RET_R2_OFF
+# undef RET_R3_OFF
+# undef RET_F0_OFF
+# undef RET_V24_OFF
 #endif
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 09/12] S390: Test that lazy binding does not clobber R0
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (2 preceding siblings ...)
  2018-08-02  7:58 ` [PATCH 01/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_resolve Ilya Leoshkevich
@ 2018-08-02  7:59 ` Ilya Leoshkevich
  2018-08-02  7:59 ` [PATCH 07/12] S390: Do not clobber R0 in 64-bit _dl_runtime_resolve Ilya Leoshkevich
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:59 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

The following combinations need to be tested:
* 32- (g5, esa and zarch) and 64-bit
  * linux32 glibc/configure CC='gcc -m31 -march=g5'
  * linux32 glibc/configure CC='gcc -m31'
  * linux32 glibc/configure CC='gcc -m31 -mzarch'
* With and without VX:
  * glibc/configure libc_cv_asm_s390_vx=no
* With and without profiling (using LD_PROFILE)
* With and without pltexit (using LD_AUDIT)

         * sysdeps/s390/Makefile: Register the new tests.
         * sysdeps/s390/tst-dl-runtime-mod.S: New file.
         * sysdeps/s390/tst-dl-runtime-profile-audit.c: New file.
         * sysdeps/s390/tst-dl-runtime-profile-noaudit.c: New file.
         * sysdeps/s390/tst-dl-runtime-resolve-audit.c: New file.
         * sysdeps/s390/tst-dl-runtime-resolve-noaudit.c: New file.
         * sysdeps/s390/tst-dl-runtime.c: New file.
---
 sysdeps/s390/Makefile                         | 23 +++++
 sysdeps/s390/tst-dl-runtime-mod.S             | 30 ++++++
 sysdeps/s390/tst-dl-runtime-profile-audit.c   | 19 ++++
 sysdeps/s390/tst-dl-runtime-profile-noaudit.c | 19 ++++
 sysdeps/s390/tst-dl-runtime-resolve-audit.c   | 19 ++++
 sysdeps/s390/tst-dl-runtime-resolve-noaudit.c | 19 ++++
 sysdeps/s390/tst-dl-runtime.c                 | 91 +++++++++++++++++++
 7 files changed, 220 insertions(+)
 create mode 100644 sysdeps/s390/tst-dl-runtime-mod.S
 create mode 100644 sysdeps/s390/tst-dl-runtime-profile-audit.c
 create mode 100644 sysdeps/s390/tst-dl-runtime-profile-noaudit.c
 create mode 100644 sysdeps/s390/tst-dl-runtime-resolve-audit.c
 create mode 100644 sysdeps/s390/tst-dl-runtime-resolve-noaudit.c
 create mode 100644 sysdeps/s390/tst-dl-runtime.c

diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
index 8a54f88cd7..496ab51973 100644
--- a/sysdeps/s390/Makefile
+++ b/sysdeps/s390/Makefile
@@ -29,3 +29,26 @@ $(inst_gconvdir)/%.so: $(objpfx)%.so $(+force)
 
 sysdeps-gconv-modules = ../sysdeps/s390/gconv-modules
 endif
+
+ifeq ($(subdir),elf)
+ifeq ($(build-shared),yes)
+tests += tst-dl-runtime-resolve-noaudit tst-dl-runtime-resolve-audit \
+	tst-dl-runtime-profile-noaudit
+# FIXME: When both LD_PROFILE and LD_AUDIT are set, a segfault occurs.
+#tests += tst-dl-runtime-profile-audit
+modules-names += tst-dl-runtime-mod
+$(objpfx)tst-dl-runtime-resolve-noaudit: $(objpfx)tst-dl-runtime-mod.so
+$(objpfx)tst-dl-runtime-resolve-audit: $(objpfx)tst-dl-runtime-mod.so
+$(objpfx)tst-dl-runtime-profile-noaudit: $(objpfx)tst-dl-runtime-mod.so
+$(objpfx)tst-dl-runtime-profile-audit: $(objpfx)tst-dl-runtime-mod.so
+$(objpfx)tst-dl-runtime-resolve-audit.out: $(objpfx)tst-auditmod1.so
+$(objpfx)tst-dl-runtime-profile-audit.out: $(objpfx)tst-auditmod1.so
+# The profiling output goes to $LD_PROFILE_OUTPUT/$LD_PROFILE.profile
+env-profile = LD_PROFILE=$(objpfx)tst-dl-runtime-mod.so \
+	LD_PROFILE_OUTPUT=/
+env-audit = LD_AUDIT=$(objpfx)tst-auditmod1.so
+tst-dl-runtime-resolve-audit-ENV = $(env-audit)
+tst-dl-runtime-profile-noaudit-ENV = $(env-profile)
+tst-dl-runtime-profile-audit-ENV = $(env-profile) $(env-audit)
+endif
+endif
diff --git a/sysdeps/s390/tst-dl-runtime-mod.S b/sysdeps/s390/tst-dl-runtime-mod.S
new file mode 100644
index 0000000000..5568524db9
--- /dev/null
+++ b/sysdeps/s390/tst-dl-runtime-mod.S
@@ -0,0 +1,30 @@
+/* Shared library for the lazy binding tests.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+	.globl	r0x2
+	.type	r0x2, @function
+r0x2:
+	.cfi_startproc
+#if defined (__s390x__)
+	agr %r0,%r0
+#else
+	ar %r0,%r0
+#endif
+	br %r14
+	.cfi_endproc
+	.size	r0x2, .-r0x2
diff --git a/sysdeps/s390/tst-dl-runtime-profile-audit.c b/sysdeps/s390/tst-dl-runtime-profile-audit.c
new file mode 100644
index 0000000000..a797e720b1
--- /dev/null
+++ b/sysdeps/s390/tst-dl-runtime-profile-audit.c
@@ -0,0 +1,19 @@
+/* Lazy binding test with profiling and auditing.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "tst-dl-runtime.c"
diff --git a/sysdeps/s390/tst-dl-runtime-profile-noaudit.c b/sysdeps/s390/tst-dl-runtime-profile-noaudit.c
new file mode 100644
index 0000000000..fedae9d0bb
--- /dev/null
+++ b/sysdeps/s390/tst-dl-runtime-profile-noaudit.c
@@ -0,0 +1,19 @@
+/* Lazy binding test with profiling.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "tst-dl-runtime.c"
diff --git a/sysdeps/s390/tst-dl-runtime-resolve-audit.c b/sysdeps/s390/tst-dl-runtime-resolve-audit.c
new file mode 100644
index 0000000000..a4fb189b3d
--- /dev/null
+++ b/sysdeps/s390/tst-dl-runtime-resolve-audit.c
@@ -0,0 +1,19 @@
+/* Lazy binding test with auditing.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "tst-dl-runtime.c"
diff --git a/sysdeps/s390/tst-dl-runtime-resolve-noaudit.c b/sysdeps/s390/tst-dl-runtime-resolve-noaudit.c
new file mode 100644
index 0000000000..472724c1c8
--- /dev/null
+++ b/sysdeps/s390/tst-dl-runtime-resolve-noaudit.c
@@ -0,0 +1,19 @@
+/* Lazy binding test.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "tst-dl-runtime.c"
diff --git a/sysdeps/s390/tst-dl-runtime.c b/sysdeps/s390/tst-dl-runtime.c
new file mode 100644
index 0000000000..7ab3c076ba
--- /dev/null
+++ b/sysdeps/s390/tst-dl-runtime.c
@@ -0,0 +1,91 @@
+/* Test that lazy binding does not clobber r0.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <assert.h>
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#if defined (__s390x__)
+static const unsigned long magic_value = 0x0011223344556677UL;
+#else
+static const unsigned long magic_value = 0x00112233;
+#endif
+
+unsigned long r0x2_trampoline (unsigned long);
+
+/* Invoke r0x2, which doubles the value in r0.  If we get
+   value * 2 back, this means nothing clobbers r0, particularly,
+   _dl_runtime_resolve and _dl_runtime_profile.  */
+asm ("    .type r0x2_trampoline, @function\n"
+     "r0x2_trampoline:\n"
+#if defined (__s390x__)
+     "    lgr %r0,%r2\n"
+     "    stg %r14,112(%r15)\n"
+     "    aghi %r15,-160\n"
+     "    brasl %r14,r0x2@plt\n"
+     "    aghi %r15,160\n"
+     "    lg %r14,112(%r15)\n"
+     "    lgr %r2,%r0\n"
+     "    br %r14\n"
+#elif defined (__zarch__)
+     "    lr %r0,%r2\n"
+     "    st %r14,56(%r15)\n"
+     "    ahi %r15,-96\n"
+     "    brasl %r14,r0x2@plt\n"
+     "    ahi %r15,96\n"
+     "    l %r14,56(%r15)\n"
+     "    lr %r2,%r0\n"
+     "    br %r14\n"
+#else
+     "    lr %r0,%r2\n"
+     "    st %r14,56(%r15)\n"
+     "    ahi %r15,-96\n"
+     "    balr %r14,0\n"
+     "    l %r14,1f-.(%r14)\n"
+     "    basr %r14,%r14\n"
+     "    ahi %r15,96\n"
+     "    l %r14,56(%r15)\n"
+     "    lr %r2,%r0\n"
+     "    br %r14\n"
+     "1: .long r0x2\n"
+#endif
+     );
+
+static int
+do_test (void)
+{
+  int i;
+  unsigned long r0;
+  const char *run;
+
+  for (i = 0; i < 2; i++)
+    {
+      run = (i == 0) ? "lazy" : "non-lazy";
+      r0 = magic_value;
+      printf ("-> %s r0 = 0x%lx\n", run, r0);
+      r0 = r0x2_trampoline (r0);
+      printf ("<- %s r0 * 2 = 0x%lx\n", run, r0);
+      if (r0 != magic_value * 2)
+	return EXIT_FAILURE;
+    }
+  return EXIT_SUCCESS;
+}
+
+#include <support/test-driver.c>
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 08/12] S390: Do not clobber R0 in 64-bit _dl_runtime_profile
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (6 preceding siblings ...)
  2018-08-02  7:59 ` [PATCH 05/12] S390: Do not clobber R0 in 32-bit _dl_runtime_resolve Ilya Leoshkevich
@ 2018-08-02  7:59 ` Ilya Leoshkevich
  2018-08-02  7:59 ` [PATCH 11/12] S390: Implement 64-bit __fentry__ Ilya Leoshkevich
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:59 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

Preparation for the usage of R0 by __fentry__.

         * sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_profile):
           Do not clobber R0.
---
 sysdeps/s390/s390-64/dl-trampoline.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/s390-64/dl-trampoline.h
index a9d56a6925..fc5ba23563 100644
--- a/sysdeps/s390/s390-64/dl-trampoline.h
+++ b/sysdeps/s390/s390-64/dl-trampoline.h
@@ -170,6 +170,7 @@ _dl_runtime_resolve:
 # define V29_OFF -208
 # define V30_OFF -192
 # define V31_OFF -176
+# define R0_OFF -144
 # define R12_OFF -136
 # define R14_OFF -128
 # define FRAMESIZE_OFF -120
@@ -185,6 +186,8 @@ _dl_runtime_resolve:
 	cfi_startproc
 	.align 16
 _dl_runtime_profile:
+	stg     %r0,CFA_OFF+R0_OFF(%r15)
+	cfi_offset (r0, R0_OFF)
 	stg    %r12,CFA_OFF+R12_OFF(%r15)	# r12 is used as backup of r15
 	cfi_offset (r12, R12_OFF)
 	stg    %r14,CFA_OFF+R14_OFF(%r15)
@@ -250,6 +253,7 @@ _dl_runtime_profile:
 	cfi_def_cfa_register (15)
 	lg     %r14,CFA_OFF+R14_OFF(%r15)	# restore registers
 	lg     %r12,CFA_OFF+R12_OFF(%r15)
+	lg     %r0,CFA_OFF+R0_OFF(%r15)
 	br     %r1				# tail call
 
 	cfi_def_cfa_register (12)
@@ -287,6 +291,7 @@ _dl_runtime_profile:
 	cfi_def_cfa_register (15)
 	lg     %r14,CFA_OFF+R14_OFF(%r15)	# restore registers
 	lg     %r12,CFA_OFF+R12_OFF(%r15)
+	lg     %r0,CFA_OFF+R0_OFF(%r15)
 	lg     %r2,CFA_OFF+RET_R2_OFF(%r15)	# restore return values
 	ld     %f0,CFA_OFF+RET_F0_OFF(%r15)
 # ifdef RESTORE_VRS
@@ -318,6 +323,7 @@ _dl_runtime_profile:
 # undef V29_OFF
 # undef V30_OFF
 # undef V31_OFF
+# undef R0_OFF
 # undef R12_OFF
 # undef R14_OFF
 # undef FRAMESIZE_OFF
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 07/12] S390: Do not clobber R0 in 64-bit _dl_runtime_resolve
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (3 preceding siblings ...)
  2018-08-02  7:59 ` [PATCH 09/12] S390: Test that lazy binding does not clobber R0 Ilya Leoshkevich
@ 2018-08-02  7:59 ` Ilya Leoshkevich
  2018-08-02  7:59 ` [PATCH 12/12] S390: Fix unwind in 32-bit _mcount Ilya Leoshkevich
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:59 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

Preparation for the usage of R0 by __fentry__.

         * sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
           Do not clobber R0.
---
 sysdeps/s390/s390-64/dl-trampoline.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/s390-64/dl-trampoline.h
index e05974322c..a9d56a6925 100644
--- a/sysdeps/s390/s390-64/dl-trampoline.h
+++ b/sysdeps/s390/s390-64/dl-trampoline.h
@@ -23,8 +23,9 @@
  *   v24, v26, v28, v30, v25, v27, v29, v31 : vector parameter registers
  *   48(r15), 56(r15) : PLT arguments PLT1, PLT2
  *   160(r15) : additional stack parameters
- * The normal clobber rules for function calls apply:
- *   r0 - r5 : call clobbered
+ * The slightly tightened normal clobber rules for function calls apply:
+ *   r0 : call saved (for __fentry__)
+ *   r1 - r5 : call clobbered
  *   r6 - r13 :	 call saved
  *   r14 : return address (call clobbered)
  *   r15 : stack pointer (call saved)
@@ -47,6 +48,7 @@
 #define V29_OFF -208
 #define V30_OFF -192
 #define V31_OFF -176
+#define R0_OFF -120
 #define PLT1_OFF -112
 #define PLT2_OFF -104
 #define R2_OFF -96
@@ -64,6 +66,8 @@
 	cfi_startproc
 	.align 16
 _dl_runtime_resolve:
+	stg    %r0,CFA_OFF+R0_OFF(%r15)
+	cfi_offset (r0, R0_OFF)
 	stmg   %r2,%r5,CFA_OFF+R2_OFF(%r15) # save registers
 	cfi_offset (r2, R2_OFF)
 	cfi_offset (r3, R3_OFF)
@@ -120,6 +124,7 @@ _dl_runtime_resolve:
 	ld     %f4,CFA_OFF+F4_OFF(%r15)
 	ld     %f6,CFA_OFF+F6_OFF(%r15)
 	lmg    %r2,%r5,CFA_OFF+R2_OFF(%r15)
+	lg     %r0,CFA_OFF+R0_OFF(%r15)
 	br     %r1
 	cfi_endproc
 	.size _dl_runtime_resolve, .-_dl_runtime_resolve
@@ -131,6 +136,7 @@ _dl_runtime_resolve:
 #undef V29_OFF
 #undef V30_OFF
 #undef V31_OFF
+#undef R0_OFF
 #undef PLT1_OFF
 #undef PLT2_OFF
 #undef R2_OFF
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 11/12] S390: Implement 64-bit __fentry__
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (7 preceding siblings ...)
  2018-08-02  7:59 ` [PATCH 08/12] S390: Do not clobber R0 in 64-bit _dl_runtime_profile Ilya Leoshkevich
@ 2018-08-02  7:59 ` Ilya Leoshkevich
  2018-08-02  8:10 ` [PATCH 10/12] Move __fentry__ version definition to sysdeps/{i386,x86_64} Ilya Leoshkevich
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:59 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

* Since __fentry__ is almost the same as _mcount, reuse the code by
  #including it twice with different #defines around.
* Remove LA usages - they are needed in 31-bit mode to clear the top
  bit, but in 64-bit they appear to do nothing.
* Add CFI rule for the nonstandard return register. This rule applies
  to the current function (binutils generates a new CIE - see
  gas/dw2gencfi.c:select_cie_for_fde()), so it is not necessary to put
  __fentry__ into a new file.
* Fix CFI offset for %r14.
* Add CFI rule for %r0.
* Fix unwound value of %r15 being off by 244 bytes.
* Unwinding in __fentry__@plt does not work, no plan to fix it - it
  would require asking linker to generate CFI for return address in
  %r0.  From functional perspective keeping it broken is fine, since
  the callee did not have a chance to do anything yet.  From
  convenience perspective it would be possible to enhance GDB in the
  future to treat __fentry__@plt in a special way.
* Fix whitespace.
* Fix offsets in comments, which were copied from 32-bit code.
* 32-bit version will not be implemented, since it's not compatible
  with the corresponding PLT stubs: they assume %r12 points to GOT,
  which is not the case for gcc-emitted __fentry__ stub, which runs
  before the prolog.

         * sysdeps/s390/s390-64/Versions (__fentry__): Add.
         * sysdeps/s390/s390-64/s390x-mcount.S: Move the common
         code to s390x-mcount.h and #include it.
         * sysdeps/s390/s390-64/s390x-mcount.h: New file.
         * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
         (__fentry__): Add.
---
 sysdeps/s390/s390-64/Versions                 |  5 +
 sysdeps/s390/s390-64/s390x-mcount.S           | 77 ++++-----------
 sysdeps/s390/s390-64/s390x-mcount.h           | 99 +++++++++++++++++++
 .../unix/sysv/linux/s390/s390-64/libc.abilist |  1 +
 4 files changed, 125 insertions(+), 57 deletions(-)
 create mode 100644 sysdeps/s390/s390-64/Versions
 create mode 100644 sysdeps/s390/s390-64/s390x-mcount.h

diff --git a/sysdeps/s390/s390-64/Versions b/sysdeps/s390/s390-64/Versions
new file mode 100644
index 0000000000..ec1d68313d
--- /dev/null
+++ b/sysdeps/s390/s390-64/Versions
@@ -0,0 +1,5 @@
+libc {
+  GLIBC_2.29 {
+    __fentry__;
+  }
+}
diff --git a/sysdeps/s390/s390-64/s390x-mcount.S b/sysdeps/s390/s390-64/s390x-mcount.S
index c6b5d65e17..6c1271032b 100644
--- a/sysdeps/s390/s390-64/s390x-mcount.S
+++ b/sysdeps/s390/s390-64/s390x-mcount.S
@@ -1,6 +1,5 @@
 /* 64 bit S/390-specific implementation of profiling support.
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
-   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com)
+   Copyright (C) 2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,61 +16,25 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
-
-/* How profiling works on 64 bit S/390:
-   On the start of each function _mcount is called with the address of a
-   data word in %r1 (initialized to 0, used for counting). The compiler
-   with the option -p generates code of the form:
-
-           STM    6,15,24(15)
-           BRAS   13,.LTN0_0
-   .LT0_0:
-   .LC13:  .long  .LP0
-           .data
-           .align 4
-   .LP0:   .long  0
-           .text
-   # function profiler
-           stg    14,4(15)
-           lg     1,.LC13-.LT0_0(13)
-           brasl  14,_mcount
-           lg     14,4(15)
-
-   The _mcount implementation now has to call __mcount_internal with the
-   address of .LP0 as first parameter and the return address as second
-   parameter. &.LP0 was loaded to %r1 and the return address is in %r14.
-   _mcount may not modify any register.  */
-
-	.globl C_SYMBOL_NAME(_mcount)
-	.type C_SYMBOL_NAME(_mcount), @function
-	cfi_startproc
-	.align ALIGNARG(4)
-C_LABEL(_mcount)
-	/* Save the caller-clobbered registers.  */
-        aghi  %r15,-224
-	cfi_adjust_cfa_offset (224)
-        stmg  %r14,%r5,160(%r15)
-	cfi_offset (r14, 0)
-	cfi_offset (r15, 8)
-        lg    %r2,232(%r15)       # callers address  = first parameter
-        la    %r2,0(%r2)          # clear bit 0
-        la    %r3,0(%r14)         # callees address  = second parameter
-
-#ifdef PIC
-	brasl %r14,__mcount_internal@PLT
-#else
-	brasl %r14,__mcount_internal
-#endif
-
-	/* Pop the saved registers.  Please note that `mcount' has no
-	   return value.  */
-	lmg   %r14,%r5,160(%r15)
-        aghi   %r15,224
-	cfi_adjust_cfa_offset (-224)
-        br    %r14
-	cfi_endproc
-	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
+#define MCOUNT_SYMBOL _mcount
+#define MCOUNT_CALLER_OFF 232	/* Pushed by the _mcount stub.  */
+#define MCOUNT_CALLEE_REG 14	/* Normal calling convention.  */
+#define MCOUNT_RETURN_REG 14
+#include "s390x-mcount.h"
+#undef MCOUNT_SYMBOL
+#undef MCOUNT_CALLER_OFF
+#undef MCOUNT_CALLEE_REG
+#undef MCOUNT_RETURN_REG
+
+#define MCOUNT_SYMBOL __fentry__
+#define MCOUNT_CALLER_OFF 160	/* Saved %r14.  */
+#define MCOUNT_CALLEE_REG 0	/* __fentry__ calling convention.  */
+#define MCOUNT_RETURN_REG 1	/* Cannot return via %r0.  */
+#include "s390x-mcount.h"
+#undef MCOUNT_SYMBOL
+#undef MCOUNT_CALLER_OFF
+#undef MCOUNT_CALLEE_REG
+#undef MCOUNT_RETURN_REG
 
 #undef mcount
 weak_alias (_mcount, mcount)
diff --git a/sysdeps/s390/s390-64/s390x-mcount.h b/sysdeps/s390/s390-64/s390x-mcount.h
new file mode 100644
index 0000000000..f936149447
--- /dev/null
+++ b/sysdeps/s390/s390-64/s390x-mcount.h
@@ -0,0 +1,99 @@
+/* 64 bit S/390-specific implementation of profiling support.
+   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com)
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+/* How profiling works on 64 bit S/390:
+   On the start of each function _mcount is called with the address of a
+   data word in %r1 (initialized to 0, used for counting). The compiler
+   with the option -p generates code of the form:
+
+           STM    6,15,24(15)
+           BRAS   13,.LTN0_0
+   .LT0_0:
+   .LC13:  .long  .LP0
+           .data
+           .align 4
+   .LP0:   .long  0
+           .text
+   # function profiler
+           stg    14,8(15)
+           lg     1,.LC13-.LT0_0(13)
+           brasl  14,_mcount
+           lg     14,8(15)
+
+   The _mcount implementation now has to call __mcount_internal with the
+   address of .LP0 as first parameter and the return address as second
+   parameter. &.LP0 was loaded to %r1 and the return address is in %r14.
+   _mcount may not modify any register.
+
+   Alternatively, at the start of each function __fentry__ is called using a
+   single
+
+   # function profiler
+           brasl  0,__fentry__
+
+   instruction.  In this case %r0 points to the callee, and %r14 points to the
+   caller.  These values need to be passed to __mcount_internal using the same
+   sequence as for _mcount, so the code below is shared between both functions.
+   The only major difference is that __fentry__ cannot return through %r0, in
+   which the return address is located, because br instruction is a no-op with
+   this register.  Therefore %r1, which is clobbered by the PLT anyway, is
+   used.  */
+
+#define xglue(x, y) x ## y
+#define glue(x, y) xglue(x, y)
+
+	.globl C_SYMBOL_NAME(MCOUNT_SYMBOL)
+	.type C_SYMBOL_NAME(MCOUNT_SYMBOL), @function
+	cfi_startproc
+	.align ALIGNARG(4)
+C_LABEL(MCOUNT_SYMBOL)
+	cfi_return_column (glue(r, MCOUNT_CALLEE_REG))
+	/* Save the caller-clobbered registers.  */
+	aghi  %r15,-224
+	cfi_adjust_cfa_offset (224)
+	/* binutils 2.28+: .cfi_val_offset r15, -160 */
+	.cfi_escape \
+		/* DW_CFA_val_offset */ 0x14, \
+		/* r15 */               0x0f, \
+		/* scaled offset */     0x14
+	stmg  %r14,%r5,160(%r15)
+	cfi_offset (r14, -224)
+	cfi_offset (r0, -224+16)
+	lg    %r2,MCOUNT_CALLER_OFF(%r15)	# callers address  = 1st param
+	lgr   %r3,glue(%r, MCOUNT_CALLEE_REG)	# callees address  = 2nd param
+
+#ifdef PIC
+	brasl %r14,__mcount_internal@PLT
+#else
+	brasl %r14,__mcount_internal
+#endif
+
+	/* Pop the saved registers.  Please note that `mcount' has no
+	   return value.  */
+	lmg   %r14,%r5,160(%r15)
+	aghi  %r15,224
+	cfi_adjust_cfa_offset (-224)
+#if MCOUNT_RETURN_REG != MCOUNT_CALLEE_REG
+	lgr   glue(%r, MCOUNT_RETURN_REG),glue(%r, MCOUNT_CALLEE_REG)
+#endif
+	br    glue(%r, MCOUNT_RETURN_REG)
+	cfi_endproc
+	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(MCOUNT_SYMBOL))
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index 3b5465558b..04a539ff02 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1907,6 +1907,7 @@ GLIBC_2.28 thrd_current F
 GLIBC_2.28 thrd_equal F
 GLIBC_2.28 thrd_sleep F
 GLIBC_2.28 thrd_yield F
+GLIBC_2.29 __fentry__ F
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
 GLIBC_2.3 __ctype_toupper_loc F
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 12/12] S390: Fix unwind in 32-bit _mcount
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (4 preceding siblings ...)
  2018-08-02  7:59 ` [PATCH 07/12] S390: Do not clobber R0 in 64-bit _dl_runtime_resolve Ilya Leoshkevich
@ 2018-08-02  7:59 ` Ilya Leoshkevich
  2018-08-02  7:59 ` [PATCH 05/12] S390: Do not clobber R0 in 32-bit _dl_runtime_resolve Ilya Leoshkevich
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:59 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

* Fix CFI offset for %r14.
* Fix unwound value of %r15 being off by 128 bytes.

         * sysdeps/s390/s390-32/s390-mcount.S (_mcount):
         Fix unwind.
---
 sysdeps/s390/s390-32/s390-mcount.S | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sysdeps/s390/s390-32/s390-mcount.S b/sysdeps/s390/s390-32/s390-mcount.S
index 153777e1b8..84f48a20fc 100644
--- a/sysdeps/s390/s390-32/s390-mcount.S
+++ b/sysdeps/s390/s390-32/s390-mcount.S
@@ -55,9 +55,13 @@ C_LABEL(_mcount)
 	/* Save the caller-clobbered registers.  */
 	ahi   %r15,-128
 	cfi_adjust_cfa_offset (128)
+	/* binutils 2.28+: .cfi_val_offset r15, -96 */
+	.cfi_escape \
+		/* DW_CFA_val_offset */ 0x14, \
+		/* r15 */               0x0f, \
+		/* scaled offset */     0x18
 	stm   %r14,%r5,96(%r15)
-	cfi_offset (r14, 0)
-	cfi_offset (r15, 4)
+	cfi_offset (r14, -128)
 	l     %r2,132(%r15)       # callers address  = first parameter
 	la    %r2,0(%r2)          # clear bit 0
 	la    %r3,0(%r14)         # callees address  = second parameter
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 05/12] S390: Do not clobber R0 in 32-bit _dl_runtime_resolve
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (5 preceding siblings ...)
  2018-08-02  7:59 ` [PATCH 12/12] S390: Fix unwind in 32-bit _mcount Ilya Leoshkevich
@ 2018-08-02  7:59 ` Ilya Leoshkevich
  2018-08-02  7:59 ` [PATCH 08/12] S390: Do not clobber R0 in 64-bit _dl_runtime_profile Ilya Leoshkevich
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  7:59 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

Preparation for the usage of R0 by __fentry__.

         * sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
           Do not clobber R0.
---
 sysdeps/s390/s390-32/dl-trampoline.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sysdeps/s390/s390-32/dl-trampoline.h b/sysdeps/s390/s390-32/dl-trampoline.h
index fa83b79926..da50d9e9dc 100644
--- a/sysdeps/s390/s390-32/dl-trampoline.h
+++ b/sysdeps/s390/s390-32/dl-trampoline.h
@@ -26,8 +26,9 @@
  *   v24, v26, v28, v30, v25, v27, v29, v31 : vector parameter registers
  *   24(r15), 28(r15) : PLT arguments PLT1, PLT2
  *   96(r15) : additional stack parameters
- * The normal clobber rules for function calls apply:
- *   r0 - r5 : call clobbered
+ * The slightly tightened normal clobber rules for function calls apply:
+ *   r0 : call saved (for __fentry__)
+ *   r1 - r5 : call clobbered
  *   r6 - r13 :	call saved
  *   r14 : return address (call clobbered)
  *   r15 : stack pointer (call saved)
@@ -50,6 +51,7 @@
 #define V29_OFF -144
 #define V30_OFF -128
 #define V31_OFF -112
+#define R0_OFF -76
 #define PLT1_OFF -72
 #define PLT2_OFF -68
 #define R2_OFF -64
@@ -65,6 +67,8 @@
 	cfi_startproc
 	.align 16
 _dl_runtime_resolve:
+	st     %r0,CFA_OFF+R0_OFF(%r15)
+	cfi_offset (r0, R0_OFF)
 	stm    %r2,%r5,CFA_OFF+R2_OFF(%r15) # save registers
 	cfi_offset (r2, R2_OFF)
 	cfi_offset (r3, R3_OFF)
@@ -119,6 +123,7 @@ _dl_runtime_resolve:
 	ld     %f0,CFA_OFF+F0_OFF(%r15)
 	ld     %f2,CFA_OFF+F2_OFF(%r15)
 	lm     %r2,%r5,CFA_OFF+R2_OFF(%r15)
+	l      %r0,CFA_OFF+R0_OFF(%r15)
 	br     %r1
 1:	.long  _dl_fixup - 0b
 	cfi_endproc
@@ -131,6 +136,7 @@ _dl_runtime_resolve:
 #undef V29_OFF
 #undef V30_OFF
 #undef V31_OFF
+#undef R0_OFF
 #undef PLT1_OFF
 #undef PLT2_OFF
 #undef R2_OFF
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 10/12] Move __fentry__ version definition to sysdeps/{i386,x86_64}
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (8 preceding siblings ...)
  2018-08-02  7:59 ` [PATCH 11/12] S390: Implement 64-bit __fentry__ Ilya Leoshkevich
@ 2018-08-02  8:10 ` Ilya Leoshkevich
  2018-08-02  8:41 ` [PATCH 06/12] S390: Do not clobber R0 in 32-bit _dl_runtime_profile Ilya Leoshkevich
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  8:10 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

__fentry__ symbol is currently not defined for other architectures.
Attempts to introduce it cause abicheck to fail, because it will be
available since 2.29 earliest, and not 2.13, which is the case for
Intel.  With the new code, abicheck passes for i686-linux-gnu,
x86_64-linux-gnu and x86_64-linux-gnu32 triples.

             * stdlib/Versions: Remove __fentry__.
             * sysdeps/i386/Versions: Add __fentry__.
             * sysdeps/x86_64/Versions: Add __fentry__.
---
 stdlib/Versions         | 3 ---
 sysdeps/i386/Versions   | 3 +++
 sysdeps/x86_64/Versions | 3 +++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/stdlib/Versions b/stdlib/Versions
index a2dfa322ed..9e665d4c26 100644
--- a/stdlib/Versions
+++ b/stdlib/Versions
@@ -105,9 +105,6 @@ libc {
   GLIBC_2.10 {
     quick_exit; __cxa_at_quick_exit;
   }
-  GLIBC_2.13 {
-    __fentry__;
-  }
   GLIBC_2.17 {
     secure_getenv;
   }
diff --git a/sysdeps/i386/Versions b/sysdeps/i386/Versions
index 7be44aad7a..36e23b466a 100644
--- a/sysdeps/i386/Versions
+++ b/sysdeps/i386/Versions
@@ -25,6 +25,9 @@ libc {
     __strpbrk_cg; __strpbrk_g; __strrchr_c; __strrchr_g; __strspn_c1;
     __strspn_cg; __strspn_g; __strstr_cg; __strstr_g;
   }
+  GLIBC_2.13 {
+    __fentry__;
+  }
 }
 libm {
   GLIBC_2.1 {
diff --git a/sysdeps/x86_64/Versions b/sysdeps/x86_64/Versions
index a437f85e6e..e94758b236 100644
--- a/sysdeps/x86_64/Versions
+++ b/sysdeps/x86_64/Versions
@@ -2,6 +2,9 @@ libc {
   GLIBC_2.14 {
     memcpy;
   }
+  GLIBC_2.13 {
+    __fentry__;
+  }
 }
 libm {
   GLIBC_2.1 {
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 06/12] S390: Do not clobber R0 in 32-bit _dl_runtime_profile
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (9 preceding siblings ...)
  2018-08-02  8:10 ` [PATCH 10/12] Move __fentry__ version definition to sysdeps/{i386,x86_64} Ilya Leoshkevich
@ 2018-08-02  8:41 ` Ilya Leoshkevich
  2018-08-02  9:00 ` [PATCH 04/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_profile Ilya Leoshkevich
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  8:41 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

Preparation for the usage of R0 by __fentry__.

         * sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile):
           Do not clobber R0.
---
 sysdeps/s390/s390-32/dl-trampoline.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sysdeps/s390/s390-32/dl-trampoline.h b/sysdeps/s390/s390-32/dl-trampoline.h
index da50d9e9dc..f67a47c5d0 100644
--- a/sysdeps/s390/s390-32/dl-trampoline.h
+++ b/sysdeps/s390/s390-32/dl-trampoline.h
@@ -166,6 +166,7 @@ _dl_runtime_resolve:
 # define V29_OFF -144
 # define V30_OFF -128
 # define V31_OFF -112
+# define R0_OFF -88
 # define R12_OFF -84
 # define R14_OFF -80
 # define FRAMESIZE_OFF -76
@@ -182,6 +183,8 @@ _dl_runtime_resolve:
 	cfi_startproc
 	.align 16
 _dl_runtime_profile:
+	st     %r0,CFA_OFF+R0_OFF(%r15)
+	cfi_offset (r0, R0_OFF)
 	st     %r12,CFA_OFF+R12_OFF(%r15)	# r12 is used as backup of r15
 	cfi_offset (r12, R12_OFF)
 	st     %r14,CFA_OFF+R14_OFF(%r15)
@@ -245,6 +248,7 @@ _dl_runtime_profile:
 	cfi_def_cfa_register (15)
 	l      %r14,CFA_OFF+R14_OFF(%r15)	# restore registers
 	l      %r12,CFA_OFF+R12_OFF(%r15)
+	l      %r0,CFA_OFF+R0_OFF(%r15)
 	br     %r1				# tail call
 
 	cfi_def_cfa_register (12)
@@ -285,6 +289,7 @@ _dl_runtime_profile:
 	cfi_def_cfa_register (15)
 	l      %r14,CFA_OFF+R14_OFF(%r15)	# restore registers
 	l      %r12,CFA_OFF+R12_OFF(%r15)
+	l      %r0,CFA_OFF+R0_OFF(%r15)
 	lm     %r2,%r3,CFA_OFF+RET_R2_OFF(%r15)	# restore return values
 	ld     %f0,CFA_OFF+RET_F0_OFF(%r15)
 # ifdef RESTORE_VRS
@@ -316,6 +321,7 @@ _dl_runtime_profile:
 # undef V29_OFF
 # undef V30_OFF
 # undef V31_OFF
+# undef R0_OFF
 # undef R12_OFF
 # undef R14_OFF
 # undef FRAMESIZE_OFF
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 04/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_profile
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (10 preceding siblings ...)
  2018-08-02  8:41 ` [PATCH 06/12] S390: Do not clobber R0 in 32-bit _dl_runtime_profile Ilya Leoshkevich
@ 2018-08-02  9:00 ` Ilya Leoshkevich
  2018-08-02  9:17 ` [PATCH 00/12] S390: Implement __fentry__ Florian Weimer
  2018-08-07  8:27 ` Stefan Liebler
  13 siblings, 0 replies; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02  9:00 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, Ilya Leoshkevich

Maintainability improvement.

         * sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_profile):
           Use symbolic offsets for stack variables.
---
 sysdeps/s390/s390-64/dl-trampoline.h | 227 +++++++++++++++++----------
 1 file changed, 143 insertions(+), 84 deletions(-)

diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/s390-64/dl-trampoline.h
index 0a74694fad..e05974322c 100644
--- a/sysdeps/s390/s390-64/dl-trampoline.h
+++ b/sysdeps/s390/s390-64/dl-trampoline.h
@@ -145,122 +145,181 @@ _dl_runtime_resolve:
 #undef F6_OFF
 
 #ifndef PROF
+# define SIZEOF_STRUCT_LA_S390_64_REGS 200
+# define REGS_OFF -360
+# define R2_OFF -360
+# define R3_OFF -352
+# define R4_OFF -344
+# define R5_OFF -336
+# define R6_OFF -328
+# define F0_OFF -320
+# define F2_OFF -312
+# define F4_OFF -304
+# define F6_OFF -296
+# define V24_OFF -288
+# define V25_OFF -272
+# define V26_OFF -256
+# define V27_OFF -240
+# define V28_OFF -224
+# define V29_OFF -208
+# define V30_OFF -192
+# define V31_OFF -176
+# define R12_OFF -136
+# define R14_OFF -128
+# define FRAMESIZE_OFF -120
+# define PLT1_OFF -112
+# define PLT2_OFF -104
+# define PREGS_OFF -96
+# define RETVAL_OFF -88
+# define RET_R2_OFF -88
+# define RET_F0_OFF -80
+# define RET_V24_OFF -72
 	.globl _dl_runtime_profile
 	.type _dl_runtime_profile, @function
 	cfi_startproc
 	.align 16
 _dl_runtime_profile:
-	stg    %r12,24(%r15)		# r12 is used as backup of r15
-	cfi_offset (r12, -136)
-	stg    %r14,32(%r15)
-	cfi_offset (r14, -128)
-	lgr    %r12,%r15		# backup stack pointer
+	stg    %r12,CFA_OFF+R12_OFF(%r15)	# r12 is used as backup of r15
+	cfi_offset (r12, R12_OFF)
+	stg    %r14,CFA_OFF+R14_OFF(%r15)
+	cfi_offset (r14, R14_OFF)
+	lgr    %r12,%r15			# backup stack pointer
 	cfi_def_cfa_register (12)
-	aghi   %r15,-360		# create stack frame:
-					# 160 + sizeof(La_s390_64_regs)
-	stg    %r12,0(%r15)		# save backchain
+# define FRAME_SIZE (CFA_OFF + SIZEOF_STRUCT_LA_S390_64_REGS)
+	aghi   %r15,-FRAME_SIZE			# create stack frame:
+	stg    %r12,0(%r15)			# save backchain
 
-	stmg   %r2,%r6,160(%r15)	# save call-clobbered arg regs
-	cfi_offset (r2, -360)		# + r6 needed as arg for
-	cfi_offset (r3, -352)		#  _dl_profile_fixup
-	cfi_offset (r4, -344)
-	cfi_offset (r5, -336)
-	cfi_offset (r6, -328)
-	std    %f0,200(%r15)
-	cfi_offset (f0, -320)
-	std    %f2,208(%r15)
-	cfi_offset (f2, -312)
-	std    %f4,216(%r15)
-	cfi_offset (f4, -304)
-	std    %f6,224(%r15)
-	cfi_offset (f6, -296)
-#ifdef RESTORE_VRS
+	stmg   %r2,%r6,FRAME_OFF+R2_OFF(%r15)	# save call-clobbered arg regs
+	cfi_offset (r2, R2_OFF)			# + r6 needed as arg for
+	cfi_offset (r3, R3_OFF)			#  _dl_profile_fixup
+	cfi_offset (r4, R4_OFF)
+	cfi_offset (r5, R5_OFF)
+	cfi_offset (r6, R6_OFF)
+	std    %f0,FRAME_OFF+F0_OFF(%r15)
+	cfi_offset (f0, F0_OFF)
+	std    %f2,FRAME_OFF+F2_OFF(%r15)
+	cfi_offset (f2, F2_OFF)
+	std    %f4,FRAME_OFF+F4_OFF(%r15)
+	cfi_offset (f4, F4_OFF)
+	std    %f6,FRAME_OFF+F6_OFF(%r15)
+	cfi_offset (f6, F6_OFF)
+# ifdef RESTORE_VRS
 	.machine push
 	.machine "z13"
-	vstm   %v24,%v31,232(%r15)      # store call-clobbered vector arguments
-	cfi_offset (v24, -288)
-	cfi_offset (v25, -272)
-	cfi_offset (v26, -256)
-	cfi_offset (v27, -240)
-	cfi_offset (v28, -224)
-	cfi_offset (v29, -208)
-	cfi_offset (v30, -192)
-	cfi_offset (v31, -176)
+	vstm   %v24,%v31,FRAME_OFF+V24_OFF(%r15)	# store call-clobbered
+	cfi_offset (v24, V24_OFF)			# vr arguments
+	cfi_offset (v25, V25_OFF)
+	cfi_offset (v26, V26_OFF)
+	cfi_offset (v27, V27_OFF)
+	cfi_offset (v28, V28_OFF)
+	cfi_offset (v29, V29_OFF)
+	cfi_offset (v30, V30_OFF)
+	cfi_offset (v31, V31_OFF)
 	.machine pop
-#endif
-	lmg    %r2,%r3,48(%r12)		# load arguments saved by PLT
-	lgr    %r4,%r14			# return address as third parameter
-	la     %r5,160(%r15)		# pointer to struct La_s390_64_regs
-	la     %r6,40(%r12)		# long int * framesize
-	brasl  %r14,_dl_profile_fixup	# call resolver
-	lgr    %r1,%r2			# function addr returned in r2
-	ld     %f0,200(%r15)		# restore call-clobbered arg fprs
-	ld     %f2,208(%r15)
-	ld     %f4,216(%r15)
-	ld     %f6,224(%r15)
-#ifdef RESTORE_VRS
+# endif
+	lmg    %r2,%r3,CFA_OFF+PLT1_OFF(%r12)	# load arguments saved by PLT
+	lgr    %r4,%r14				# return address as 3rd parameter
+	la     %r5,FRAME_OFF+REGS_OFF(%r15)	# struct La_s390_64_regs *
+	la     %r6,CFA_OFF+FRAMESIZE_OFF(%r12)	# long int * framesize
+	brasl  %r14,_dl_profile_fixup		# call resolver
+	lgr    %r1,%r2				# function addr returned in r2
+	ld     %f0,FRAME_OFF+F0_OFF(%r15)	# restore call-clobbered
+	ld     %f2,FRAME_OFF+F2_OFF(%r15)	# arg fprs
+	ld     %f4,FRAME_OFF+F4_OFF(%r15)
+	ld     %f6,FRAME_OFF+F6_OFF(%r15)
+# ifdef RESTORE_VRS
 	.machine push
-	.machine "z13"
-	vlm    %v24,%v31,232(%r15)	# restore call-clobbered arg vrs
+	.machine "z13"				# restore call-clobbered
+	vlm    %v24,%v31,FRAME_OFF+V24_OFF(%r15)# arg vrs
 	.machine pop
-#endif
-	lg     %r0,40(%r12)		# load framesize
+# endif
+	lg     %r0,CFA_OFF+FRAMESIZE_OFF(%r12)	# load framesize
 	ltgr   %r0,%r0
 	jnm    1f
-
-	lmg    %r2,%r6,160(%r15)	# framesize < 0 means no pltexit call
-					# so we can do a tail call without
-					# copying the arg overflow area
-	lgr    %r15,%r12		# remove stack frame
+						# framesize < 0 means no
+	lmg    %r2,%r6,FRAME_OFF+R2_OFF(%r15)	# pltexit call, so we can do a
+						# tail call without copying the
+						# arg overflow area
+	lgr    %r15,%r12			# remove stack frame
 	cfi_def_cfa_register (15)
-	lg     %r14,32(%r15)		# restore registers
-	lg     %r12,24(%r15)
-	br     %r1			# tail-call to resolved function
+	lg     %r14,CFA_OFF+R14_OFF(%r15)	# restore registers
+	lg     %r12,CFA_OFF+R12_OFF(%r15)
+	br     %r1				# tail call
 
 	cfi_def_cfa_register (12)
-1:	la     %r4,160(%r15)		# pointer to struct La_s390_64_regs
-	stg    %r4,64(%r12)
-	jz     4f			# framesize == 0 ?
-	aghi   %r0,7			# align framesize to 8
+1:	la     %r4,FRAME_OFF+REGS_OFF(%r15)	# struct La_s390_64_regs *
+	stg    %r4,CFA_OFF+PREGS_OFF(%r12)
+	jz     4f				# framesize == 0 ?
+	aghi   %r0,7				# align framesize to 8
 	nill   %r0,0xfff8
-	slgr   %r15,%r0			# make room for framesize bytes
-	stg    %r12,0(%r15)		# save backchain
-	la     %r2,160(%r15)
-	la     %r3,160(%r12)
+	slgr   %r15,%r0				# make room for framesize bytes
+	stg    %r12,0(%r15)			# save backchain
+	la     %r2,FRAME_OFF+REGS_OFF(%r15)
+	la     %r3,CFA_OFF(%r12)
 	srlg   %r0,%r0,3
-3:	mvc    0(8,%r2),0(%r3)		# copy additional parameters
-	la     %r2,8(%r2)		# depending on framesize
+3:	mvc    0(8,%r2),0(%r3)			# copy additional parameters
+	la     %r2,8(%r2)			# depending on framesize
 	la     %r3,8(%r3)
 	brctg  %r0,3b
-4:	lmg    %r2,%r6,0(%r4)		# restore call-clobbered arg gprs
-	basr   %r14,%r1			# call resolved function
-	stg    %r2,72(%r12)		# store return values r2, f0
-	std    %f0,80(%r12)		# to struct La_s390_64_retval
-#ifdef RESTORE_VRS
+4:	lmg    %r2,%r6,0(%r4)			# load register parameters
+	basr   %r14,%r1				# call resolved function
+	stg    %r2,CFA_OFF+RET_R2_OFF(%r12)	# store return values r2, f0
+	std    %f0,CFA_OFF+RET_F0_OFF(%r12)	# to struct La_s390_64_retval
+# ifdef RESTORE_VRS
 	.machine push
 	.machine "z13"
-	vst    %v24,88(%r12)		# store return value v24
+	vst    %v24,CFA_OFF+RET_V24_OFF(%r12)	# store return value v24
 	.machine pop
-#endif
-	lmg    %r2,%r4,48(%r12)		# r2, r3: load arguments saved by PLT
-					# r4: pointer to struct La_s390_64_regs
-	la     %r5,72(%r12)		# pointer to struct La_s390_64_retval
+# endif
+	lmg    %r2,%r4,CFA_OFF+PLT1_OFF(%r12)	# r2, r3: args saved by PLT
+						# r4: struct La_s390_64_regs *
+	la     %r5,CFA_OFF+RETVAL_OFF(%r12)	# struct La_s390_64_retval *
 	brasl  %r14,_dl_call_pltexit
 
-	lgr    %r15,%r12		# remove stack frame
+	lgr    %r15,%r12			# remove stack frame
+# undef FRAME_SIZE
 	cfi_def_cfa_register (15)
-	lg     %r14,32(%r15)		# restore registers
-	lg     %r12,24(%r15)
-	lg     %r2,72(%r15)		# restore return values
-	ld     %f0,80(%r15)
-#ifdef RESTORE_VRS
+	lg     %r14,CFA_OFF+R14_OFF(%r15)	# restore registers
+	lg     %r12,CFA_OFF+R12_OFF(%r15)
+	lg     %r2,CFA_OFF+RET_R2_OFF(%r15)	# restore return values
+	ld     %f0,CFA_OFF+RET_F0_OFF(%r15)
+# ifdef RESTORE_VRS
 	.machine push
 	.machine "z13"
-	vl    %v24,88(%r15)		# restore return value v24
+	vl    %v24,CFA_OFF+RET_V24_OFF(%r15)	# restore return value v24
 	.machine pop
-#endif
+# endif
 	br     %r14			# Jump back to caller
 
 	cfi_endproc
 	.size _dl_runtime_profile, .-_dl_runtime_profile
+# undef SIZEOF_STRUCT_LA_S390_64_REGS
+# undef REGS_OFF
+# undef R2_OFF
+# undef R3_OFF
+# undef R4_OFF
+# undef R5_OFF
+# undef R6_OFF
+# undef F0_OFF
+# undef F2_OFF
+# undef F4_OFF
+# undef F6_OFF
+# undef V24_OFF
+# undef V25_OFF
+# undef V26_OFF
+# undef V27_OFF
+# undef V28_OFF
+# undef V29_OFF
+# undef V30_OFF
+# undef V31_OFF
+# undef R12_OFF
+# undef R14_OFF
+# undef FRAMESIZE_OFF
+# undef PLT1_OFF
+# undef PLT2_OFF
+# undef PREGS_OFF
+# undef RETVAL_OFF
+# undef RET_R2_OFF
+# undef RET_F0_OFF
+# undef RET_V24_OFF
 #endif
-- 
2.18.0

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 00/12] S390: Implement __fentry__
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (11 preceding siblings ...)
  2018-08-02  9:00 ` [PATCH 04/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_profile Ilya Leoshkevich
@ 2018-08-02  9:17 ` Florian Weimer
  2018-08-02 10:43   ` Ilya Leoshkevich
  2018-08-07  8:27 ` Stefan Liebler
  13 siblings, 1 reply; 18+ messages in thread
From: Florian Weimer @ 2018-08-02  9:17 UTC (permalink / raw)
  To: Ilya Leoshkevich, libc-alpha; +Cc: stli

On 08/02/2018 09:57 AM, Ilya Leoshkevich wrote:
> This patch series adds the runtime support in glibc for the -mfentry
> gcc feature introduced in [1] and [2].
> 
> Patches 1-9 deal with avoiding clobbering %r0 when calling lazily bound
> functions, so that the new __fentry__ symbol could be called with return
> address in that register.

Should GCC arrange for suitable ABI markup if -mfentry is used?  I'm 
worried that unexpected clobbers of r0 could be quite difficult to 
figure out otherwise.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 00/12] S390: Implement __fentry__
  2018-08-02  9:17 ` [PATCH 00/12] S390: Implement __fentry__ Florian Weimer
@ 2018-08-02 10:43   ` Ilya Leoshkevich
  2018-08-02 18:32     ` Florian Weimer
  0 siblings, 1 reply; 18+ messages in thread
From: Ilya Leoshkevich @ 2018-08-02 10:43 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha, stli


> Am 02.08.2018 um 11:17 schrieb Florian Weimer <fweimer@redhat.com>:
> 
> On 08/02/2018 09:57 AM, Ilya Leoshkevich wrote:
>> This patch series adds the runtime support in glibc for the -mfentry
>> gcc feature introduced in [1] and [2].
>> Patches 1-9 deal with avoiding clobbering %r0 when calling lazily bound
>> functions, so that the new __fentry__ symbol could be called with return
>> address in that register.
> 
> Should GCC arrange for suitable ABI markup if -mfentry is used?  I'm worried that unexpected clobbers of r0 could be quite difficult to figure out otherwise.

I don’t think we need to do anything ABI-related at this point.

__fentry__ itself is being newly introduced, so there is no old ABI to
comply with. Instrumented functions’ ABI does not change, particularly,
%r0, being a volatile register, used to be clobbered anyway.

Are there other cases that I’m missing?

> Thanks,
> Florian
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 00/12] S390: Implement __fentry__
  2018-08-02 10:43   ` Ilya Leoshkevich
@ 2018-08-02 18:32     ` Florian Weimer
  0 siblings, 0 replies; 18+ messages in thread
From: Florian Weimer @ 2018-08-02 18:32 UTC (permalink / raw)
  To: Ilya Leoshkevich; +Cc: libc-alpha, stli

On 08/02/2018 12:43 PM, Ilya Leoshkevich wrote:
> 
>> Am 02.08.2018 um 11:17 schrieb Florian Weimer <fweimer@redhat.com>:
>>
>> On 08/02/2018 09:57 AM, Ilya Leoshkevich wrote:
>>> This patch series adds the runtime support in glibc for the -mfentry
>>> gcc feature introduced in [1] and [2].
>>> Patches 1-9 deal with avoiding clobbering %r0 when calling lazily bound
>>> functions, so that the new __fentry__ symbol could be called with return
>>> address in that register.
>>
>> Should GCC arrange for suitable ABI markup if -mfentry is used?  I'm worried that unexpected clobbers of r0 could be quite difficult to figure out otherwise.
> 
> I don’t think we need to do anything ABI-related at this point.
> 
> __fentry__ itself is being newly introduced, so there is no old ABI to
> comply with. Instrumented functions’ ABI does not change, particularly,
> %r0, being a volatile register, used to be clobbered anyway.
> 
> Are there other cases that I’m missing?

Agreed, with the __fentry__ addition in the same release as the 
trampoline change, this should be safe and avoid the issue I was worried 
about.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 00/12] S390: Implement __fentry__
  2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
                   ` (12 preceding siblings ...)
  2018-08-02  9:17 ` [PATCH 00/12] S390: Implement __fentry__ Florian Weimer
@ 2018-08-07  8:27 ` Stefan Liebler
  2018-08-10  7:15   ` [COMMITTED] " Stefan Liebler
  13 siblings, 1 reply; 18+ messages in thread
From: Stefan Liebler @ 2018-08-07  8:27 UTC (permalink / raw)
  To: Ilya Leoshkevich, libc-alpha; +Cc: Florian Weimer

On 08/02/2018 09:57 AM, Ilya Leoshkevich wrote:
> This patch series adds the runtime support in glibc for the -mfentry
> gcc feature introduced in [1] and [2].
> 
> Patches 1-9 deal with avoiding clobbering %r0 when calling lazily bound
> functions, so that the new __fentry__ symbol could be called with return
> address in that register.
> 
> Patch 10 removes the assumption that only Intel implements __fentry__.
> 
> Patch 11 adds __fentry__ implementation.
> 
> Patch 12 is a cleanup of problems in 31-bit mcount, which are similar to
> those found while implementing 64-bit __fentry__.
> 
> [1] https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00784.html
> [2] https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00912.html
> 
> 

Hi,

I've reviewed the s390-specific patches. They are all okay.

I think the move of the Intel-specific __fentry__ defintion into the 
Versions-files of the corresponding sysdeps directories is okay, too.
Do anybody complain about that?

If not, I plan to commit this patch-series at the end of this week.
Thank you for implementing the __fentry__ support for s390x.

Bye
Stefan

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [COMMITTED] [PATCH 00/12] S390: Implement __fentry__
  2018-08-07  8:27 ` Stefan Liebler
@ 2018-08-10  7:15   ` Stefan Liebler
  0 siblings, 0 replies; 18+ messages in thread
From: Stefan Liebler @ 2018-08-10  7:15 UTC (permalink / raw)
  To: libc-alpha

On 08/07/2018 10:27 AM, Stefan Liebler wrote:
> On 08/02/2018 09:57 AM, Ilya Leoshkevich wrote:
>> This patch series adds the runtime support in glibc for the -mfentry
>> gcc feature introduced in [1] and [2].
>>
>> Patches 1-9 deal with avoiding clobbering %r0 when calling lazily bound
>> functions, so that the new __fentry__ symbol could be called with return
>> address in that register.
>>
>> Patch 10 removes the assumption that only Intel implements __fentry__.
>>
>> Patch 11 adds __fentry__ implementation.
>>
>> Patch 12 is a cleanup of problems in 31-bit mcount, which are similar to
>> those found while implementing 64-bit __fentry__.
>>
>> [1] https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00784.html
>> [2] https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00912.html
>>
>>
> 
> Hi,
> 
> I've reviewed the s390-specific patches. They are all okay.
> 
> I think the move of the Intel-specific __fentry__ defintion into the 
> Versions-files of the corresponding sysdeps directories is okay, too.
> Do anybody complain about that?
> 
> If not, I plan to commit this patch-series at the end of this week.
> Thank you for implementing the __fentry__ support for s390x.
> 
> Bye
> Stefan
> 

Committed.

Thanks
Stefan

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-08-10  7:15 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-02  7:58 [PATCH 00/12] S390: Implement __fentry__ Ilya Leoshkevich
2018-08-02  7:58 ` [PATCH 02/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_profile Ilya Leoshkevich
2018-08-02  7:58 ` [PATCH 03/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_resolve Ilya Leoshkevich
2018-08-02  7:58 ` [PATCH 01/12] S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_resolve Ilya Leoshkevich
2018-08-02  7:59 ` [PATCH 09/12] S390: Test that lazy binding does not clobber R0 Ilya Leoshkevich
2018-08-02  7:59 ` [PATCH 07/12] S390: Do not clobber R0 in 64-bit _dl_runtime_resolve Ilya Leoshkevich
2018-08-02  7:59 ` [PATCH 12/12] S390: Fix unwind in 32-bit _mcount Ilya Leoshkevich
2018-08-02  7:59 ` [PATCH 05/12] S390: Do not clobber R0 in 32-bit _dl_runtime_resolve Ilya Leoshkevich
2018-08-02  7:59 ` [PATCH 08/12] S390: Do not clobber R0 in 64-bit _dl_runtime_profile Ilya Leoshkevich
2018-08-02  7:59 ` [PATCH 11/12] S390: Implement 64-bit __fentry__ Ilya Leoshkevich
2018-08-02  8:10 ` [PATCH 10/12] Move __fentry__ version definition to sysdeps/{i386,x86_64} Ilya Leoshkevich
2018-08-02  8:41 ` [PATCH 06/12] S390: Do not clobber R0 in 32-bit _dl_runtime_profile Ilya Leoshkevich
2018-08-02  9:00 ` [PATCH 04/12] S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_profile Ilya Leoshkevich
2018-08-02  9:17 ` [PATCH 00/12] S390: Implement __fentry__ Florian Weimer
2018-08-02 10:43   ` Ilya Leoshkevich
2018-08-02 18:32     ` Florian Weimer
2018-08-07  8:27 ` Stefan Liebler
2018-08-10  7:15   ` [COMMITTED] " Stefan Liebler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).