This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch master updated. glibc-2.28.9000-41-g8f135ef


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  8f135efcad9f32daaa560b7403ab8c1498c0c659 (commit)
       via  71c01af52fdf643abe3946f934693a55887a8ead (commit)
       via  8d997d2253e742546db2b27c8ee56edbbe4c906c (commit)
       via  69e2444ab1444ab8210598abbcb4822701d368b9 (commit)
       via  bde6320f39cfe56fe3cbafe55fc498d7b329ff05 (commit)
       via  5755f5e4ccc97f6a502d4a176ccec87a98f1c866 (commit)
       via  c8ad85225bd5968e45c716519d88743811dbdb3e (commit)
       via  b215eee1e1dca1ed76678afff2710ed7a38aedc4 (commit)
       via  329c6fec8b8c72e43948730d93ad80bf7447b36a (commit)
       via  0fb7afa2f9087696fb31e4831c9f46010c185843 (commit)
       via  6954059ad6a8ccdf52bddf498c011c8ca1db7d80 (commit)
       via  c7099673aa9db8ce89fbbc937301d77672c4af6c (commit)
      from  2813e41e9049ccd0c75edc19c4fdefb21213b495 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8f135efcad9f32daaa560b7403ab8c1498c0c659

commit 8f135efcad9f32daaa560b7403ab8c1498c0c659
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:44 2018 +0200

    S390: Fix unwind in 32-bit _mcount
    
    * Fix CFI offset for %r14.
    * Fix unwound value of %r15 being off by 128 bytes.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-32/s390-mcount.S (_mcount):
    	Fix unwind.

diff --git a/ChangeLog b/ChangeLog
index c3a085e..bcbeb8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* sysdeps/s390/s390-32/s390-mcount.S (_mcount):
+	Fix unwind.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* 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.
diff --git a/sysdeps/s390/s390-32/s390-mcount.S b/sysdeps/s390/s390-32/s390-mcount.S
index 153777e..84f48a2 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

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=71c01af52fdf643abe3946f934693a55887a8ead

commit 71c01af52fdf643abe3946f934693a55887a8ead
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:44 2018 +0200

    S390: Implement 64-bit __fentry__
    
    * 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.
    
    This patch adds the runtime support in glibc for the -mfentry
    gcc feature introduced in [1] and [2].
    
    [1] https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00784.html
    [2] https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00912.html
    
    ChangeLog:
    
    	* 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.

diff --git a/ChangeLog b/ChangeLog
index 1d71d93..c3a085e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* 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.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* stdlib/Versions: Remove __fentry__.
 	* sysdeps/i386/Versions: Add __fentry__.
 	* sysdeps/x86_64/Versions: Add __fentry__.
diff --git a/sysdeps/s390/s390-64/Versions b/sysdeps/s390/s390-64/Versions
new file mode 100644
index 0000000..ec1d683
--- /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 c6b5d65..6c12710 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.S b/sysdeps/s390/s390-64/s390x-mcount.h
similarity index 56%
copy from sysdeps/s390/s390-64/s390x-mcount.S
copy to sysdeps/s390/s390-64/s390x-mcount.h
index c6b5d65..f936149 100644
--- a/sysdeps/s390/s390-64/s390x-mcount.S
+++ b/sysdeps/s390/s390-64/s390x-mcount.h
@@ -33,30 +33,52 @@
    .LP0:   .long  0
            .text
    # function profiler
-           stg    14,4(15)
+           stg    14,8(15)
            lg     1,.LC13-.LT0_0(13)
            brasl  14,_mcount
-           lg     14,4(15)
+           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.  */
+   _mcount may not modify any register.
 
-	.globl C_SYMBOL_NAME(_mcount)
-	.type C_SYMBOL_NAME(_mcount), @function
+   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)
+C_LABEL(MCOUNT_SYMBOL)
+	cfi_return_column (glue(r, MCOUNT_CALLEE_REG))
 	/* Save the caller-clobbered registers.  */
-        aghi  %r15,-224
+	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
+	/* 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
@@ -67,11 +89,11 @@ C_LABEL(_mcount)
 	/* Pop the saved registers.  Please note that `mcount' has no
 	   return value.  */
 	lmg   %r14,%r5,160(%r15)
-        aghi   %r15,224
+	aghi  %r15,224
 	cfi_adjust_cfa_offset (-224)
-        br    %r14
+#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))
-
-#undef mcount
-weak_alias (_mcount, mcount)
+	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 3b54655..04a539f 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

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8d997d2253e742546db2b27c8ee56edbbe4c906c

commit 8d997d2253e742546db2b27c8ee56edbbe4c906c
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:44 2018 +0200

    Move __fentry__ version definition to sysdeps/{i386,x86_64}
    
    __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.
    
    ChangeLog:
    
    	* stdlib/Versions: Remove __fentry__.
    	* sysdeps/i386/Versions: Add __fentry__.
    	* sysdeps/x86_64/Versions: Add __fentry__.

diff --git a/ChangeLog b/ChangeLog
index ae2868f..1d71d93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* stdlib/Versions: Remove __fentry__.
+	* sysdeps/i386/Versions: Add __fentry__.
+	* sysdeps/x86_64/Versions: Add __fentry__.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* 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.
diff --git a/stdlib/Versions b/stdlib/Versions
index a2dfa32..9e665d4 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 7be44aa..36e23b4 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 a437f85..e94758b 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 {

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=69e2444ab1444ab8210598abbcb4822701d368b9

commit 69e2444ab1444ab8210598abbcb4822701d368b9
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:43 2018 +0200

    S390: Test that lazy binding does not clobber R0
    
    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)
    
    ChangeLog:
    
    	* 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.

diff --git a/ChangeLog b/ChangeLog
index 87e3288..ae2868f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* 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.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_profile):
 	Do not clobber R0.
 
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
index 8a54f88..496ab51 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 0000000..5568524
--- /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 0000000..a797e72
--- /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 0000000..fedae9d
--- /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 0000000..a4fb189
--- /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 0000000..472724c
--- /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 0000000..7ab3c07
--- /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>

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bde6320f39cfe56fe3cbafe55fc498d7b329ff05

commit bde6320f39cfe56fe3cbafe55fc498d7b329ff05
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:43 2018 +0200

    S390: Do not clobber R0 in 64-bit _dl_runtime_profile
    
    Preparation for the usage of R0 by __fentry__.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_profile):
    	Do not clobber R0.

diff --git a/ChangeLog b/ChangeLog
index fb04742..87e3288 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_profile):
+	Do not clobber R0.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
 	Do not clobber R0.
 
diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/s390-64/dl-trampoline.h
index a9d56a6..fc5ba23 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

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5755f5e4ccc97f6a502d4a176ccec87a98f1c866

commit 5755f5e4ccc97f6a502d4a176ccec87a98f1c866
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:43 2018 +0200

    S390: Do not clobber R0 in 64-bit _dl_runtime_resolve
    
    Preparation for the usage of R0 by __fentry__.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
    	Do not clobber R0.

diff --git a/ChangeLog b/ChangeLog
index 5452201..fb04742 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
+	Do not clobber R0.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile):
 	Do not clobber R0.
 
diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/s390-64/dl-trampoline.h
index e059743..a9d56a6 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

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c8ad85225bd5968e45c716519d88743811dbdb3e

commit c8ad85225bd5968e45c716519d88743811dbdb3e
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:43 2018 +0200

    S390: Do not clobber R0 in 32-bit _dl_runtime_profile
    
    Preparation for the usage of R0 by __fentry__.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile):
    	Do not clobber R0.

diff --git a/ChangeLog b/ChangeLog
index 8dd0059..5452201 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile):
+	Do not clobber R0.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
 	Do not clobber R0.
 
diff --git a/sysdeps/s390/s390-32/dl-trampoline.h b/sysdeps/s390/s390-32/dl-trampoline.h
index da50d9e..f67a47c 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

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b215eee1e1dca1ed76678afff2710ed7a38aedc4

commit b215eee1e1dca1ed76678afff2710ed7a38aedc4
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:42 2018 +0200

    S390: Do not clobber R0 in 32-bit _dl_runtime_resolve
    
    Preparation for the usage of R0 by __fentry__.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
    	Do not clobber R0.

diff --git a/ChangeLog b/ChangeLog
index 751186d..8dd0059 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
+	Do not clobber R0.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_profile):
 	Use symbolic offsets for stack variables.
 
diff --git a/sysdeps/s390/s390-32/dl-trampoline.h b/sysdeps/s390/s390-32/dl-trampoline.h
index fa83b79..da50d9e 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

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=329c6fec8b8c72e43948730d93ad80bf7447b36a

commit 329c6fec8b8c72e43948730d93ad80bf7447b36a
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:42 2018 +0200

    S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_profile
    
    Maintainability improvement.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_profile):
    	Use symbolic offsets for stack variables.

diff --git a/ChangeLog b/ChangeLog
index 49b69c8..751186d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_profile):
+	Use symbolic offsets for stack variables.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
 	Use symbolic offsets for stack variables.
 
diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/s390-64/dl-trampoline.h
index 0a74694..e059743 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

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0fb7afa2f9087696fb31e4831c9f46010c185843

commit 0fb7afa2f9087696fb31e4831c9f46010c185843
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:42 2018 +0200

    S390: Use symbolic offsets for stack variables in 64-bit _dl_runtime_resolve
    
    Maintainability improvement.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
    	Use symbolic offsets for stack variables.

diff --git a/ChangeLog b/ChangeLog
index 7014892..49b69c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
+	Use symbolic offsets for stack variables.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile):
 	Use symbolic offsets for stack variables.
 
diff --git a/sysdeps/s390/s390-64/dl-trampoline.h b/sysdeps/s390/s390-64/dl-trampoline.h
index d313fd5..0a74694 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

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6954059ad6a8ccdf52bddf498c011c8ca1db7d80

commit 6954059ad6a8ccdf52bddf498c011c8ca1db7d80
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:41 2018 +0200

    S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_profile
    
    Maintainability improvement.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile):
    	Use symbolic offsets for stack variables.

diff --git a/ChangeLog b/ChangeLog
index af62cc2..7014892 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
 
+	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile):
+	Use symbolic offsets for stack variables.
+
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
 	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
 	Use symbolic offsets for stack variables.
 
diff --git a/sysdeps/s390/s390-32/dl-trampoline.h b/sysdeps/s390/s390-32/dl-trampoline.h
index 547e1eb..fa83b79 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

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c7099673aa9db8ce89fbbc937301d77672c4af6c

commit c7099673aa9db8ce89fbbc937301d77672c4af6c
Author: Ilya Leoshkevich <iii@linux.ibm.com>
Date:   Fri Aug 10 09:07:41 2018 +0200

    S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_resolve
    
    Maintainability improvement.
    
    ChangeLog:
    
    	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
    	Use symbolic offsets for stack variables.

diff --git a/ChangeLog b/ChangeLog
index a912870..af62cc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-10  Ilya Leoshkevich  <iii@linux.ibm.com>
+
+	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
+	Use symbolic offsets for stack variables.
+
 2018-08-09  Joseph Myers  <joseph@codesourcery.com>
 
 	* math/gen-libm-test.py: New file.
diff --git a/sysdeps/s390/s390-32/dl-trampoline.h b/sysdeps/s390/s390-32/dl-trampoline.h
index d36c002..547e1eb 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

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                         |   70 ++++
 stdlib/Versions                                   |    3 -
 sysdeps/i386/Versions                             |    3 +
 sysdeps/s390/Makefile                             |   23 ++
 sysdeps/s390/s390-32/dl-trampoline.h              |  338 +++++++++++++-------
 sysdeps/s390/s390-32/s390-mcount.S                |    8 +-
 sysdeps/s390/s390-64/Versions                     |    5 +
 sysdeps/s390/s390-64/dl-trampoline.h              |  367 ++++++++++++++-------
 sysdeps/s390/s390-64/s390x-mcount.S               |   77 ++----
 sysdeps/s390/s390-64/s390x-mcount.h               |   99 ++++++
 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 +++++
 sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist |    1 +
 sysdeps/x86_64/Versions                           |    3 +
 18 files changed, 889 insertions(+), 305 deletions(-)
 create mode 100644 sysdeps/s390/s390-64/Versions
 create mode 100644 sysdeps/s390/s390-64/s390x-mcount.h
 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


hooks/post-receive
-- 
GNU C Library master sources


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