arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

Blame SOURCES/glibc-rh1505492-s390x-sotruss.patch

147e83
commit 7a02cfade80b2b6ed2562e74105bebfee90a87ec
147e83
Author: Mike Frysinger <vapier@gentoo.org>
147e83
Date:   Tue Dec 24 04:31:22 2013 -0500
147e83
147e83
    s390: implement sotruss support
147e83
    
147e83
    See commit 41b1792698a335d3a85381921a84a16e9635f36a for testcase.
147e83
    
147e83
    Note: while this works on s390x, the s390 code hangs when using -e.
147e83
    But it hangs regardless of this code (the hang seems to occur before
147e83
    the exit func is even called).  I didn't look too closely at it as
147e83
    it seems to be an issue external to this file, so this code shouldn't
147e83
    make the situation any worse.
147e83
    
147e83
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
147e83
    Signed-off-by: Mike Frysinger <vapier@gentoo.org>
147e83
147e83
diff --git a/sysdeps/s390/sotruss-lib.c b/sysdeps/s390/sotruss-lib.c
147e83
new file mode 100644
147e83
index 0000000000000000..ded98db08dcf525b
147e83
--- /dev/null
147e83
+++ b/sysdeps/s390/sotruss-lib.c
147e83
@@ -0,0 +1,62 @@
147e83
+/* Override generic sotruss-lib.c to define actual functions for s390.
147e83
+   Copyright (C) 2012-2014 Free Software Foundation, Inc.
147e83
+
147e83
+   This file is part of the GNU C Library.
147e83
+
147e83
+   The GNU C Library is free software; you can redistribute it and/or
147e83
+   modify it under the terms of the GNU Lesser General Public
147e83
+   License as published by the Free Software Foundation; either
147e83
+   version 2.1 of the License, or (at your option) any later version.
147e83
+
147e83
+   The GNU C Library is distributed in the hope that it will be useful,
147e83
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
147e83
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
147e83
+   Lesser General Public License for more details.
147e83
+
147e83
+   You should have received a copy of the GNU Lesser General Public
147e83
+   License along with the GNU C Library.  If not, see
147e83
+   <http://www.gnu.org/licenses/>.  */
147e83
+
147e83
+#define HAVE_ARCH_PLTENTER
147e83
+#define HAVE_ARCH_PLTEXIT
147e83
+
147e83
+#include <elf/sotruss-lib.c>
147e83
+
147e83
+#if __ELF_NATIVE_CLASS == 32
147e83
+# define la_s390_gnu_pltenter	la_s390_32_gnu_pltenter
147e83
+# define la_s390_gnu_pltexit	la_s390_32_gnu_pltexit
147e83
+# define La_s390_regs		La_s390_32_regs
147e83
+# define La_s390_retval		La_s390_32_retval
147e83
+#else
147e83
+# define la_s390_gnu_pltenter	la_s390_64_gnu_pltenter
147e83
+# define la_s390_gnu_pltexit	la_s390_64_gnu_pltexit
147e83
+# define La_s390_regs		La_s390_64_regs
147e83
+# define La_s390_retval		La_s390_64_retval
147e83
+#endif
147e83
+
147e83
+ElfW(Addr)
147e83
+la_s390_gnu_pltenter (ElfW(Sym) *sym,
147e83
+		      unsigned int ndx __attribute__ ((unused)),
147e83
+		      uintptr_t *refcook, uintptr_t *defcook,
147e83
+		      La_s390_regs *regs, unsigned int *flags,
147e83
+		      const char *symname, long int *framesizep)
147e83
+{
147e83
+  print_enter (refcook, defcook, symname,
147e83
+	       regs->lr_r2, regs->lr_r3, regs->lr_r4, *flags);
147e83
+
147e83
+  /* No need to copy anything, we will not need the parameters in any case.  */
147e83
+  *framesizep = 0;
147e83
+
147e83
+  return sym->st_value;
147e83
+}
147e83
+
147e83
+unsigned int
147e83
+la_s390_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
147e83
+		     uintptr_t *defcook,
147e83
+		     const struct La_s390_regs *inregs,
147e83
+		     struct La_s390_retval *outregs, const char *symname)
147e83
+{
147e83
+  print_exit (refcook, defcook, symname, outregs->lrv_r2);
147e83
+
147e83
+  return 0;
147e83
+}