Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: sysdeps/i386/dl-machine.h

Issue 7282019: Adjust for new NaCl startup ABI (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* Machine-dependent ELF dynamic relocation inline functions. i386 version. 1 /* Machine-dependent ELF dynamic relocation inline functions. i386 version.
2 Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc. 2 Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 4
5 The GNU C Library is free software; you can redistribute it and/or 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 6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version. 8 version 2.1 of the License, or (at your option) any later version.
9 9
10 The GNU C Library is distributed in the hope that it will be useful, 10 The GNU C Library is distributed in the hope that it will be useful,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 #endif 176 #endif
177 177
178 /* Mask identifying addresses reserved for the user program, 178 /* Mask identifying addresses reserved for the user program,
179 where the dynamic linker should not map anything. */ 179 where the dynamic linker should not map anything. */
180 #define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL 180 #define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL
181 181
182 /* Initial entry point code for the dynamic linker. 182 /* Initial entry point code for the dynamic linker.
183 The C function `_dl_start' is the real entry point; 183 The C function `_dl_start' is the real entry point;
184 its return value is the user program's entry point. */ 184 its return value is the user program's entry point. */
185 185
186 #ifdef __native_client__
187
188 /* We're started with the normal C (stack) ABI for a one-argument function.
189 But _dl_start uses regparm, so we have to fetch the argument for it.
190 Our version of _dl_start runs the user's entry point directly, rather
191 than returning it. */
192
193 #define RTLD_START asm("\n\
194 .text\n\
195 .p2align NACLENTRYALIGN\n\
196 .globl _start\n\
197 _start:\n\
198 movl 4(%esp), %eax\n\
199 jmp _dl_start\n\
200 .previous\n\
201 ");
202
203 #else
204
186 #define RTLD_START asm ("\n\ 205 #define RTLD_START asm ("\n\
187 .text\n\ 206 .text\n\
188 .p2align NACLENTRYALIGN\n\ 207 .p2align NACLENTRYALIGN\n\
189 0: movl (%esp), %ebx\n\ 208 0: movl (%esp), %ebx\n\
190 popl %ecx; nacljmp %ecx\n\ 209 popl %ecx; nacljmp %ecx\n\
191 .p2align NACLENTRYALIGN\n\ 210 .p2align NACLENTRYALIGN\n\
192 .globl _start\n\ 211 .globl _start\n\
193 .globl _dl_start_user\n\ 212 .globl _dl_start_user\n\
194 _start:\n\ 213 _start:\n\
195 # Note that _dl_start gets the parameter in %eax.\n\ 214 # Note that _dl_start gets the parameter in %eax.\n\
(...skipping 27 matching lines...) Expand all
223 call _dl_init_internal@PLT\n\ 242 call _dl_init_internal@PLT\n\
224 # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\ 243 # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
225 leal _dl_fini@GOTOFF(%ebx), %edx\n\ 244 leal _dl_fini@GOTOFF(%ebx), %edx\n\
226 # Restore %esp _start expects.\n\ 245 # Restore %esp _start expects.\n\
227 movl (%esp), %esp\n\ 246 movl (%esp), %esp\n\
228 # Jump to the user's entry point.\n\ 247 # Jump to the user's entry point.\n\
229 nacljmp %edi\n\ 248 nacljmp %edi\n\
230 .previous\n\ 249 .previous\n\
231 "); 250 ");
232 251
252 #endif
253
233 /* Native client PLT does not save %ecx so we cannot use regparm(3). We use 254 /* Native client PLT does not save %ecx so we cannot use regparm(3). We use
234 regparm(2) instead. */ 255 regparm(2) instead. */
235 256
236 #ifdef __native_client__ 257 #ifdef __native_client__
237 #define RTLD_LOAD_DL_INIT_PARAMETERS \ 258 #define RTLD_LOAD_DL_INIT_PARAMETERS \
238 "# Load the parameters again.\n\ 259 "# Load the parameters again.\n\
239 # (eax, edx, *--esp, *--esp) = (_dl_loaded, argc, argv, envp)\n\ 260 # (eax, edx, *--esp, *--esp) = (_dl_loaded, argc, argv, envp)\n\
240 movl _rtld_local@GOTOFF(%ebx), %eax\n\ 261 movl _rtld_local@GOTOFF(%ebx), %eax\n\
241 leal 8(%esp,%edx,4), %esi\n\ 262 leal 8(%esp,%edx,4), %esi\n\
242 leal 4(%esp), %ecx\n\ 263 leal 4(%esp), %ecx\n\
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 td->arg = (void*)reloc; 766 td->arg = (void*)reloc;
746 td->entry = _dl_tlsdesc_resolve_rela; 767 td->entry = _dl_tlsdesc_resolve_rela;
747 } 768 }
748 else 769 else
749 _dl_reloc_bad_type (map, r_type, 1); 770 _dl_reloc_bad_type (map, r_type, 1);
750 } 771 }
751 772
752 #endif /* !RTLD_BOOTSTRAP */ 773 #endif /* !RTLD_BOOTSTRAP */
753 774
754 #endif /* RESOLVE_MAP */ 775 #endif /* RESOLVE_MAP */
OLDNEW
« make_sysd_rules.py ('K') | « make_sysd_rules.py ('k') | sysdeps/nacl/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698