* elf/tst-tls8.c (do_test): Use $ORIGIN in module names.
[glibc.git] / sysdeps / powerpc / powerpc32 / dl-trampoline.S
blob392c109d4c7d9fd2213b4027c2b14abe12ddf9b4
1 /* PLT trampolines.  PPC32 version.
2    Copyright (C) 2005, 2006 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
18    02110-1301 USA.  */
20 #include <sysdep.h>
22         .section ".text"
23         .align 2
24         .globl _dl_runtime_resolve
25         .type _dl_runtime_resolve,@function
26 _dl_runtime_resolve:
27         cfi_startproc
28  # We need to save the registers used to pass parameters, and register 0,
29  # which is used by _mcount; the registers are saved in a stack frame.
30         stwu r1,-64(r1)
31         cfi_adjust_cfa_offset (64)
32         stw r0,12(r1)
33         stw r3,16(r1)
34         stw r4,20(r1)
35  # The code that calls this has put parameters for `fixup' in r12 and r11.
36         mr r3,r12
37         stw r5,24(r1)
38         mr r4,r11
39         stw r6,28(r1)
40         mflr r0
41  # We also need to save some of the condition register fields
42         stw r7,32(r1)
43         stw r0,68(r1)
44         cfi_offset (lr, 4)
45         stw r8,36(r1)
46         mfcr r0
47         stw r9,40(r1)
48         stw r10,44(r1)
49         stw r0,8(r1)
50         bl _dl_fixup@local
51  # 'fixup' returns the address we want to branch to.
52         mtctr r3
53  # Put the registers back...
54         lwz r0,68(r1)
55         lwz r10,44(r1)
56         lwz r9,40(r1)
57         mtlr r0
58         lwz r8,36(r1)
59         lwz r0,8(r1)
60         lwz r7,32(r1)
61         lwz r6,28(r1)
62         mtcrf 0xFF,r0
63         lwz r5,24(r1)
64         lwz r4,20(r1)
65         lwz r3,16(r1)
66         lwz r0,12(r1)
67  # ...unwind the stack frame, and jump to the PLT entry we updated.
68         addi r1,r1,64
69         bctr
70         cfi_endproc
71         .size    _dl_runtime_resolve,.-_dl_runtime_resolve
73 #ifndef PROF
74         .align 2
75         .globl _dl_prof_resolve
76         .type _dl_prof_resolve,@function
77 _dl_prof_resolve:
78         cfi_startproc
79  # We need to save the registers used to pass parameters, and register 0,
80  # which is used by _mcount; the registers are saved in a stack frame.
81         stwu r1,-320(r1)
82         cfi_adjust_cfa_offset (320)
83         /* Stack layout:
85           +312   stackframe
86           +308   lr
87           +304   r1
88           +288   v12
89           +272   v11
90           +256   v10
91           +240   v9
92           +224   v8
93           +208   v7
94           +192   v6
95           +176   v5
96           +160   v4
97           +144   v3
98           +128   v2
99           +112   v1
100           +104   fp8
101           +96    fp7
102           +88    fp6
103           +80    fp5
104           +72    fp4
105           +64    fp3
106           +56    fp2
107           +48    fp1
108           +44    r10
109           +40    r9
110           +36    r8
111           +32    r7
112           +28    r6
113           +24    r5
114           +20    r4
115           +16    r3
116           +12    r0
117           +8     cr
118            r1    link
119         */
120         stw r0,12(r1)
121         stw r3,16(r1)
122         stw r4,20(r1)
123  # The code that calls this has put parameters for `fixup' in r12 and r11.
124         mr r3,r12
125         stw r5,24(r1)
126         mr r4,r11
127         stw r6,28(r1)
128         mflr r5
129  # We also need to save some of the condition register fields.
130         stw r7,32(r1)
131         stw r5,324(r1)
132         cfi_offset (lr, 4)
133         stw r8,36(r1)
134         mfcr r0
135         stw r9,40(r1)
136         stw r10,44(r1)
137         stw r0,8(r1)
138  # Save the floating point registers
139         stfd fp1,48(r1)
140         stfd fp2,56(r1)
141         stfd fp3,64(r1)
142         stfd fp4,72(r1)
143         stfd fp5,80(r1)
144         stfd fp6,88(r1)
145         stfd fp7,96(r1)
146         stfd fp8,104(r1)
147  # XXX TODO: store vmx registers
148  # Load the extra parameters.
149         addi r6,r1,16
150         addi r7,r1,312
151         li r0,-1
152         stw r0,0(r7)
153         bl _dl_profile_fixup@local
154  # 'fixup' returns the address we want to branch to.
155         mtctr r3
156  # Put the registers back...
157         lwz r0,324(r1)
158         lwz r10,44(r1)
159         lwz r9,40(r1)
160         mtlr r0
161         lwz r8,36(r1)
162         lwz r0,8(r1)
163         lwz r7,32(r1)
164         lwz r6,28(r1)
165         mtcrf 0xFF,r0
166         lwz r5,24(r1)
167         lwz r4,20(r1)
168         lwz r3,16(r1)
169         lwz r0,12(r1)
170  # Load the floating point registers.
171         lfd fp1,48(r1)
172         lfd fp2,56(r1)
173         lfd fp3,64(r1)
174         lfd fp4,72(r1)
175         lfd fp5,80(r1)
176         lfd fp6,88(r1)
177         lfd fp7,96(r1)
178         lfd fp8,104(r1)
179  # ...unwind the stack frame, and jump to the PLT entry we updated.
180         addi r1,r1,320
181         bctr
182         cfi_endproc
183         .size    _dl_prof_resolve,.-_dl_prof_resolve
184 #endif