summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2001-06-29 17:51:27 +0000
committerAndreas Jaeger <aj@suse.de>2001-06-29 17:51:27 +0000
commit33e25d26e7ac71e0cfba55a34475cc0ac3570f61 (patch)
treecc99360bbb234c4dc4a091113ab6607b09494e85 /sysdeps
parent2995f70ed7f3292edf0942e76128b7b0d5d1d165 (diff)
downloadglibc-33e25d26e7ac71e0cfba55a34475cc0ac3570f61.tar.gz
glibc-33e25d26e7ac71e0cfba55a34475cc0ac3570f61.tar.xz
glibc-33e25d26e7ac71e0cfba55a34475cc0ac3570f61.zip
Update.
2001-06-19  Andreas Jaeger  <aj@suse.de>

	* sysdeps/powerpc/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE):
	Handle profiling.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/powerpc/dl-machine.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h
index f3f6a138e2..ace7aab8e9 100644
--- a/sysdeps/powerpc/dl-machine.h
+++ b/sysdeps/powerpc/dl-machine.h
@@ -102,6 +102,7 @@ elf_machine_load_address (void)
 /* This code is used in dl-runtime.c to call the `fixup' function
    and then redirect to the address it returns.  It is called
    from code built in the PLT by elf_machine_runtime_setup.  */
+#if !defined PROF
 #define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
 	.section \".text\"	\n\
 	.align 2	\n\
@@ -198,6 +199,59 @@ _dl_prof_resolve:	\n\
  # Undo '.section text'.\n\
 	.previous	\n\
 ");
+#else
+# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
+	.section \".text\"	\n\
+	.align 2	\n\
+	.globl _dl_runtime_resolve	\n\
+	.globl _dl_prof_resolve	\n\
+	.type _dl_runtime_resolve,@function	\n\
+	.type _dl_prof_resolve,@function	\n\
+_dl_runtime_resolve:	\n\
+_dl_prof_resolve:	\n\
+ # We need to save the registers used to pass parameters, and register 0,\n\
+ # which is used by _mcount; the registers are saved in a stack frame.\n\
+	stwu 1,-64(1)	\n\
+	stw 0,12(1)	\n\
+	stw 3,16(1)	\n\
+	stw 4,20(1)	\n\
+ # The code that calls this has put parameters for `fixup' in r12 and r11.\n\
+	mr 3,12	\n\
+	stw 5,24(1)	\n\
+	mr 4,11	\n\
+	stw 6,28(1)	\n\
+	mflr 0	\n\
+ # We also need to save some of the condition register fields.\n\
+	stw 7,32(1)	\n\
+	stw 0,48(1)	\n\
+	stw 8,36(1)	\n\
+	mfcr 0	\n\
+	stw 9,40(1)	\n\
+	stw 10,44(1)	\n\
+	stw 0,8(1)	\n\
+	bl fixup@local	\n\
+ # 'fixup' returns the address we want to branch to.\n\
+	mtctr 3	\n\
+ # Put the registers back...\n\
+	lwz 0,48(1)	\n\
+	lwz 10,44(1)	\n\
+	lwz 9,40(1)	\n\
+	mtlr 0	\n\
+	lwz 8,36(1)	\n\
+	lwz 0,8(1)	\n\
+	lwz 7,32(1)	\n\
+	lwz 6,28(1)	\n\
+	mtcrf 0xFF,0	\n\
+	lwz 5,24(1)	\n\
+	lwz 4,20(1)	\n\
+	lwz 3,16(1)	\n\
+	lwz 0,12(1)	\n\
+ # ...unwind the stack frame, and jump to the PLT entry we updated.\n\
+	addi 1,1,64	\n\
+	bctr	\n\
+	.size	 _dl_runtime_resolve,.-_dl_runtime_resolve	\n\
+");
+#endif
 
 /* The actual _start code is in dl-start.S.  Use a really
    ugly bit of assembler to let dl-start.o see _dl_start.  */