1 /* PLT trampolines. hppa 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., 59 Temple Place, Suite 330, Boston, MA
22 /* This code gets called via the .plt stub, and is used in
23 dl-runtime.c to call the `_dl_fixup' function and then redirect
24 to the address it returns. `_dl_fixup' takes two arguments, however
25 `_dl_profile_fixup' takes a number of parameters for use with
26 library auditing (LA).
28 WARNING: This template is also used by gcc's __cffc, and expects
29 that the "bl" for _dl_runtime_resolve exist at a particular offset.
30 Do not change this template without changing gcc, while the prefix
31 "bl" should fix everything so gcc finds the right spot, it will
32 slow down __cffc when it attempts to call fixup to resolve function
33 descriptor references. Please refer to gcc/gcc/config/pa/fptr.c
35 Enter with r19 = reloc offset, r20 = got-8, r21 = fixup ltp. */
37 /* RELOCATION MARKER: bl to provide gcc's __cffc with fixup loc. */
39 /* THIS CODE DOES NOT EXECUTE */
42 .global _dl_runtime_resolve
43 .type _dl_runtime_resolve,@function
48 .CALLINFO FRAME=128,CALLS,SAVE_RP,ENTRY_GR=3
50 /* SAVE_RP says we do */
53 /* Save static link register */
55 /* Save argument registers */
61 /* Build a call frame, and save structure pointer. */
62 copy %sp, %r1 /* Copy previous sp */
63 /* Save function result address (on entry) */
65 /* Fillin some frame info to follow ABI */
66 stw %r1,-4(%sp) /* Previous sp */
67 stw %r21,-32(%sp) /* PIC register value */
69 /* Save input floating point registers. This must be done
70 in the new frame since the previous frame doesn't have
78 /* Set up args to fixup func, needs only two arguments */
79 ldw 8+4(%r20),%r26 /* (1) got[1] == struct link_map */
80 copy %r19,%r25 /* (2) reloc offset */
82 /* Call the real address resolver. */
84 copy %r21,%r19 /* set fixup func ltp */
86 /* Load up the returned func descriptor */
90 /* Reload arguments fp args */
97 /* Adjust sp, and restore function result address*/
100 /* Reload static link register */
102 /* Reload general args */
108 /* Jump to new function, but return to previous function */
114 .size _dl_runtime_resolve, . - _dl_runtime_resolve
117 .global _dl_runtime_profile
118 .type _dl_runtime_profile,@function
123 .CALLINFO FRAME=192,CALLS,SAVE_RP,ENTRY_GR=3
126 /* SAVE_RP says we do */
128 /* Save static link register */
131 /* Build a call frame, and save structure pointer. */
132 copy %sp, %r1 /* Copy previous sp */
133 /* Save function result address (on entry) */
135 /* Fillin some frame info to follow ABI */
136 stw %r1,-4(%sp) /* Previous sp */
137 stw %r21,-32(%sp) /* PIC register value */
139 /* Create La_hppa_retval */
143 -128, lr_fr4 (8 bytes) */
145 /* Create save space for _dl_profile_fixup arguments
146 -120, Saved reloc offset
147 -116, Saved struct link_map
150 /* Create La_hppa_regs */
151 /* 32-bit registers */
156 /* -92, 4 byte pad */
157 /* 64-bit floating point registers */
163 /* 32-bit stack pointer and return register */
168 /* Set up args to fixup func, needs five arguments */
169 ldw 8+4(%r20),%r26 /* (1) got[1] == struct link_map */
170 stw %r26,-116(%sp) /* Save struct link_map */
171 copy %r19,%r25 /* (2) reloc offset */
172 stw %r25,-120(%sp) /* Save reloc offset */
173 copy %rp,%r24 /* (3) profile_fixup needs rp */
174 ldo -56(%sp),%r23 /* (4) La_hppa_regs */
176 stw %r1, -52(%sp) /* (5) long int *framesizep */
178 /* Call the real address resolver. */
179 bl _dl_profile_fixup,%rp
180 copy %r21,%r19 /* set fixup func ltp */
182 /* Load up the returned function descriptor */
186 /* Restore gr/fr/sp/rp */
191 /* -92, 4 byte pad, skip */
199 /* Reload static link register -(192+16) without adjusting stack */
202 /* *framesizep is >= 0 if we have to run pltexit */
204 cmpb,>>=,N %r0,%r28,L(cpe)
206 /* Adjust sp, and restore function result address*/
208 /* Jump to new function, but return to previous function */
214 /* Call the returned function descriptor */
220 /* We are going to call the resolved function, but we have a
221 stack frame in the middle. We use the value of framesize to
222 guess how much extra frame we need, and how much frame to
225 /* Round to nearest multiple of 64 */
229 /* Calcualte start of stack copy */
232 /* Increate the stack by *framesizep */
235 /* Save stack pointer */
238 /* Single byte copy of prevous stack onto newly allocated stack */
239 1: ldb %r28(%r2), %r1
245 /* Retore r28 and r27 and r2 already points at -192(%sp) */
249 /* Calculate address of L(cont) */
253 /* Undo fake stack */
257 /* Arguments to _dl_call_pltexit */
258 ldw -116(%sp), %r26 /* (1) got[1] == struct link_map */
259 ldw -120(%sp), %r25 /* (2) reloc offsets */
260 ldo -56(%sp), %r24 /* (3) *La_hppa_regs */
261 ldo -124(%sp), %r23 /* (4) *La_hppa_retval */
263 /* Fill *La_hppa_retval */
269 /* Call _dl_call_pltexit */
270 bl _dl_call_pltexit,%rp
273 /* Restore *La_hppa_retval */
279 /* Unwind the stack */
281 /* Retore callers rp */
288 .size _dl_runtime_profile, . - _dl_runtime_profile