about summary refs log tree commit diff
path: root/elf/sotruss-lib.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-03-09 20:48:06 -0800
committerDavid S. Miller <davem@davemloft.net>2012-03-09 20:48:06 -0800
commit2d2cd51564c7fa6f82677e9f4baab8e6996380b5 (patch)
tree0a4ddd2c985725ef6138a1cc38b652df985834d5 /elf/sotruss-lib.c
parent9a07f9d01f1689e99e89bbb5ec48e6930da755f1 (diff)
downloadglibc-2d2cd51564c7fa6f82677e9f4baab8e6996380b5.tar.gz
glibc-2d2cd51564c7fa6f82677e9f4baab8e6996380b5.tar.xz
glibc-2d2cd51564c7fa6f82677e9f4baab8e6996380b5.zip
Fix bugs in sparc PLT profiling register management, and add sparc sotruss support.
	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Protect local
	variables with appropriate CPP guards.
	* sysdeps/sparc/sparc32/dl-trampoline.S: Propagate the stack_ptr from the
	frame pointer, not the stack pointer.  Correct layout comments.  Fix test
	on resulting framesize and the management of the outregs buffer for pltexit.
	Preserve floating point return values across _dl_call_pltexit call.
	* sysdeps/sparc/sparc64/dl-trampoline.S: Fix test on resulting
	framesize and the management of the outregs buffer for pltexit.
	Preserve floating point return values across _dl_call_pltexit
	call.
	* elf/sotruss-lib.c (la_sparc32_gnu_pltenter, la_sparc64_gnu_pltenter,
	la_sparc32_gnu_pltexit, la_sparc64_gnu_pltexit): New functions.
	(print_exit): Fix format string for return register value.
Diffstat (limited to 'elf/sotruss-lib.c')
-rw-r--r--elf/sotruss-lib.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/elf/sotruss-lib.c b/elf/sotruss-lib.c
index 542672692f..c2ab7330d4 100644
--- a/elf/sotruss-lib.c
+++ b/elf/sotruss-lib.c
@@ -1,5 +1,5 @@
 /* Trace calls through PLTs and show caller, callee, and parameters.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
 
@@ -288,6 +288,40 @@ la_x86_64_gnu_pltenter (Elf64_Sym *sym __attribute__ ((unused)),
 
   return sym->st_value;
 }
+#elif defined __sparc__ && !defined __arch64__
+Elf32_Addr
+la_sparc32_gnu_pltenter (Elf32_Sym *sym __attribute__ ((unused)),
+			 unsigned int ndx __attribute__ ((unused)),
+			 uintptr_t *refcook, uintptr_t *defcook,
+			 La_sparc32_regs *regs, unsigned int *flags,
+			 const char *symname, long int *framesizep)
+{
+  print_enter (refcook, defcook, symname,
+	       regs->lr_reg[0], regs->lr_reg[1], regs->lr_reg[2],
+	       *flags);
+
+  /* No need to copy anything, we will not need the parameters in any case.  */
+  *framesizep = 0;
+
+  return sym->st_value;
+}
+#elif defined __sparc__ && defined __arch64__
+Elf64_Addr
+la_sparc64_gnu_pltenter (Elf64_Sym *sym __attribute__ ((unused)),
+			 unsigned int ndx __attribute__ ((unused)),
+			 uintptr_t *refcook, uintptr_t *defcook,
+			 La_sparc64_regs *regs, unsigned int *flags,
+			 const char *symname, long int *framesizep)
+{
+  print_enter (refcook, defcook, symname,
+	       regs->lr_reg[0], regs->lr_reg[1], regs->lr_reg[2],
+	       *flags);
+
+  /* No need to copy anything, we will not need the parameters in any case.  */
+  *framesizep = 0;
+
+  return sym->st_value;
+}
 #elif !defined HAVE_ARCH_PLTENTER
 # warning "pltenter for architecture not supported"
 #endif
@@ -302,7 +336,7 @@ print_exit (uintptr_t *refcook, uintptr_t *defcook, const char *symname,
   if (print_pid)
     snprintf (buf, sizeof (buf), "%5ld: ", (long int) getpid ());
 
-  fprintf (out_file, "%s%15s -> %-15s:%s%s - 0x%lu\n",
+  fprintf (out_file, "%s%15s -> %-15s:%s%s - 0x%lx\n",
 	   buf, (char *) *refcook, (char *) *defcook, " ", symname, reg);
 }
 
@@ -327,6 +361,26 @@ la_x86_64_gnu_pltexit (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
 
   return 0;
 }
+#elif defined __sparc__ && !defined __arch64__
+unsigned int
+la_sparc32_gnu_pltexit (Elf32_Sym *sym, unsigned int ndx, uintptr_t *refcook,
+			uintptr_t *defcook, const struct La_sparc32_regs *inregs,
+			struct La_sparc32_retval *outregs, const char *symname)
+{
+  print_exit (refcook, defcook, symname, outregs->lrv_reg[0]);
+
+  return 0;
+}
+#elif defined __sparc__ && defined __arch64__
+unsigned int
+la_sparc64_gnu_pltexit (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
+			uintptr_t *defcook, const struct La_sparc64_regs *inregs,
+			struct La_sparc64_retval *outregs, const char *symname)
+{
+  print_exit (refcook, defcook, symname, outregs->lrv_reg[0]);
+
+  return 0;
+}
 #elif !defined HAVE_ARCH_PLTEXIT
 # warning "pltexit for architecture not supported"
 #endif