1 /* PLT trampolines. i386 version.
2 Copyright (C) 2004, 2005, 2007 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
23 .globl _dl_runtime_resolve
24 .type _dl_runtime_resolve, @function
28 # This no longer preserves registers %eax, %ecx and %edx, but we
29 # cannot preserve all registers because at least one is needed
30 # to perform address alignment when jumping in NaCl.
31 # This means functions called via the PLT can't use the "regparm"
32 # attribute. See "regparm" in the gcc docs.
33 cfi_adjust_cfa_offset (8)
35 cfi_adjust_cfa_offset (-4)
37 cfi_adjust_cfa_offset (-4)
41 .size _dl_runtime_resolve, .-_dl_runtime_resolve
45 .globl _dl_runtime_profile
46 .type _dl_runtime_profile, @function
50 cfi_adjust_cfa_offset (8)
52 cfi_adjust_cfa_offset (4)
53 addl $8, (%esp) # Account for the pushed PLT data
55 cfi_adjust_cfa_offset (4)
56 pushl %eax # Preserve registers otherwise clobbered.
57 cfi_adjust_cfa_offset (4)
59 cfi_adjust_cfa_offset (4)
61 cfi_adjust_cfa_offset (4)
64 cfi_adjust_cfa_offset (8)
68 pushl %ecx # Address of the register structure
69 cfi_adjust_cfa_offset (4)
70 movl 40(%esp), %ecx # Load return address
71 movl 36(%esp), %edx # Copy args pushed by PLT in register. Note
72 movl 32(%esp), %eax # that `fixup' takes its parameters in regs.
73 call _dl_profile_fixup # Call resolver.
74 cfi_adjust_cfa_offset (-8)
79 cfi_adjust_cfa_offset (-4)
80 popl %edx # Get register content back.
81 cfi_adjust_cfa_offset (-4)
83 movl %eax, (%esp) # Store the function address.
85 # Fix this when we are in a position to test it.
87 # ret $20 # Jump to function address.
100 cfi_adjust_cfa_offset (12)
102 cfi_rel_offset (ebx, 0)
103 movl %edx, %ebx # This is the frame buffer size
105 cfi_adjust_cfa_offset (4)
106 cfi_rel_offset (edi, 0)
108 cfi_adjust_cfa_offset (4)
109 cfi_rel_offset (esi, 0)
112 orl $4, %ebx # Increase frame size if necessary to align
113 # stack for the function call
118 cfi_def_cfa_register (ebx)
128 %ebx+40 return address
139 %esp copied stack frame
147 cfi_def_cfa_register (esp)
164 cfi_adjust_cfa_offset (20)
170 cfi_adjust_cfa_offset (4)
174 call _dl_call_pltexit
180 cfi_adjust_cfa_offset (-60)
181 popl %ecx; nacljmp %ecx
183 .size _dl_runtime_profile, .-_dl_runtime_profile