arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

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

147e83
commit 2393fc0119fa291ff01b7b912dda2069257c8600
147e83
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
147e83
Date:   Wed Jan 15 11:05:00 2014 -0600
147e83
147e83
    PowerPC: sotruss-lib implementation
147e83
    
147e83
    This patch add the missing sotruss-lib interfaces for PowerPC.
147e83
147e83
diff --git a/sysdeps/powerpc/sotruss-lib.c b/sysdeps/powerpc/sotruss-lib.c
147e83
new file mode 100644
147e83
index 0000000000000000..2e52053ed1a9fa4a
147e83
--- /dev/null
147e83
+++ b/sysdeps/powerpc/sotruss-lib.c
147e83
@@ -0,0 +1,69 @@
147e83
+/* PowerPC specific sotruss-lib functions.
147e83
+   Copyright (C) 2013 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
+#ifdef __powerpc64__
147e83
+# if _CALL_ELF != 2
147e83
+#  define LA_PPC_REGS          La_ppc64_regs
147e83
+#  define LA_PPC_RETVAL        La_ppc64_retval
147e83
+#  define LA_PPC_GNU_PLTENTER  la_ppc64_gnu_pltenter
147e83
+#  define LA_PPC_GNU_PLTEXIT   la_ppc64_gnu_pltexit
147e83
+# else
147e83
+#  define LA_PPC_REGS          La_ppc64v2_regs
147e83
+#  define LA_PPC_RETVAL        La_ppc64v2_retval
147e83
+#  define LA_PPC_GNU_PLTENTER  la_ppc64v2_gnu_pltenter
147e83
+#  define LA_PPC_GNU_PLTEXIT   la_ppc64v2_gnu_pltexit
147e83
+# endif
147e83
+# else
147e83
+# define LA_PPC_REGS           La_ppc32_regs
147e83
+# define LA_PPC_RETVAL         La_ppc32_retval
147e83
+# define LA_PPC_GNU_PLTENTER   la_ppc32_gnu_pltenter
147e83
+# define LA_PPC_GNU_PLTEXIT    la_ppc32_gnu_pltexit
147e83
+#endif
147e83
+
147e83
+ElfW(Addr)
147e83
+LA_PPC_GNU_PLTENTER (ElfW(Sym) *sym __attribute__ ((unused)),
147e83
+		     unsigned int ndx __attribute__ ((unused)),
147e83
+		     uintptr_t *refcook, uintptr_t *defcook,
147e83
+		     LA_PPC_REGS *regs, unsigned int *flags,
147e83
+		     const char *symname, long int *framesizep)
147e83
+{
147e83
+  print_enter (refcook, defcook, symname,
147e83
+	       regs->lr_reg[0], regs->lr_reg[1], regs->lr_reg[2], *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_PPC_GNU_PLTEXIT (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
147e83
+		    uintptr_t *defcook,
147e83
+		    const struct LA_PPC_REGS *inregs,
147e83
+		    struct LA_PPC_RETVAL *outregs, const char *symname)
147e83
+{
147e83
+  print_exit (refcook, defcook, symname, outregs->lrv_r3);
147e83
+
147e83
+  return 0;
147e83
+}