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

Side by Side Diff: sysdeps/x86_64/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
« make_sysd_rules.py ('K') | « sysdeps/nacl/start.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Machine-dependent ELF dynamic relocation inline functions. x86-64 version. 1 /* Machine-dependent ELF dynamic relocation inline functions. x86-64 version.
2 Copyright (C) 2001-2005, 2006 Free Software Foundation, Inc. 2 Copyright (C) 2001-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 Contributed by Andreas Jaeger <aj@suse.de>. 4 Contributed by Andreas Jaeger <aj@suse.de>.
5 5
6 The GNU C Library is free software; you can redistribute it and/or 6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public 7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version. 9 version 2.1 of the License, or (at your option) any later version.
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 = (Elf64_Addr) &_dl_tlsdesc_resolve_rela; 145 = (Elf64_Addr) &_dl_tlsdesc_resolve_rela;
146 146
147 return lazy; 147 return lazy;
148 } 148 }
149 149
150 /* Initial entry point code for the dynamic linker. 150 /* Initial entry point code for the dynamic linker.
151 The C function `_dl_start' is the real entry point; 151 The C function `_dl_start' is the real entry point;
152 its return value is the user program's entry point. */ 152 its return value is the user program's entry point. */
153 153
154 #ifdef __native_client__ 154 #ifdef __native_client__
155 #define ARGV_ENTRY_SIZE_STR "4" 155
156 #define ARGC_SIZE_PLUS_ARGV_ENTRY_SIZE_STR "12" 156 /* We're started with the normal C ABI for a one-argument function.
157 #define ADJUST_SP \ 157 Our version of _dl_start runs the user's entry point directly, rather
158 "leaq (%rsp,%rax,"ARGV_ENTRY_SIZE_STR"), %r13\n" \ 158 than returning it. Since the NaCl trusted runtime starts us up with
159 "naclrestsp %r13d, %r15" 159 the registers set up for a normal C function call of one argument,
160 #define CLEAR_BP "naclrestbp $0, %r15" 160 we can just go directly into _dl_start with no adjustment. */
161 #define MOV_R13_SP "naclrestsp %r13d, %r15" 161
162 #define JMP_R12 "nacljmp %r12d, %r15" 162 #define RTLD_START asm("\n\
163 .globl _start\n\
164 .set _start, _dl_start\n\
165 ");
163 166
164 #else 167 #else
165 #define ARGV_ENTRY_SIZE_STR "8"
166 #define ARGC_SIZE_PLUS_ARGV_ENTRY_SIZE_STR "16"
167 #define ADJUST_SP \
168 "leaq (%rsp,%rax,"ARGV_ENTRY_SIZE_STR"), %rsp"
169 #define CLEAR_BP "xorl %ebp, %ebp"
170 #define MOV_R13_SP "movq %r13, %rsp"
171 #define JMP_R12 "jmp *%r12"
172 #endif
173 168
174 #define RTLD_START asm ("\n\ 169 #define RTLD_START asm ("\n\
175 .text\n\ 170 .text\n\
176 .align 16\n\ 171 .align 16\n\
177 .globl _start\n\ 172 .globl _start\n\
178 .globl _dl_start_user\n\ 173 .globl _dl_start_user\n\
179 _start:\n\ 174 _start:\n\
180 movq %rsp, %rdi\n\ 175 movq %rsp, %rdi\n\
181 call _dl_start\n\ 176 call _dl_start\n\
182 _dl_start_user:\n\ 177 _dl_start_user:\n\
(...skipping 29 matching lines...) Expand all
212 call _dl_init_internal@PLT\n\ 207 call _dl_init_internal@PLT\n\
213 # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\ 208 # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
214 leaq _dl_fini(%rip), %rdx\n\ 209 leaq _dl_fini(%rip), %rdx\n\
215 # And make sure %rsp points to argc stored on the stack.\n\ 210 # And make sure %rsp points to argc stored on the stack.\n\
216 "MOV_R13_SP"\n\ 211 "MOV_R13_SP"\n\
217 # Jump to the user's entry point.\n\ 212 # Jump to the user's entry point.\n\
218 "JMP_R12"\n\ 213 "JMP_R12"\n\
219 .previous\n\ 214 .previous\n\
220 "); 215 ");
221 216
217 #endif
218
222 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or 219 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
223 TLS variable, so undefined references should not be allowed to 220 TLS variable, so undefined references should not be allowed to
224 define the value. 221 define the value.
225 ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one 222 ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
226 of the main executable's symbols, as for a COPY reloc. */ 223 of the main executable's symbols, as for a COPY reloc. */
227 #if !defined RTLD_BOOTSTRAP || USE___THREAD 224 #if !defined RTLD_BOOTSTRAP || USE___THREAD
228 # define elf_machine_type_class(type) \ 225 # define elf_machine_type_class(type) \
229 ((((type) == R_X86_64_JUMP_SLOT \ 226 ((((type) == R_X86_64_JUMP_SLOT \
230 || (type) == R_X86_64_DTPMOD64 \ 227 || (type) == R_X86_64_DTPMOD64 \
231 || (type) == R_X86_64_DTPOFF64 \ 228 || (type) == R_X86_64_DTPOFF64 \
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 514
518 td->arg = (void*)reloc; 515 td->arg = (void*)reloc;
519 td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)]) 516 td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
520 + map->l_addr); 517 + map->l_addr);
521 } 518 }
522 else 519 else
523 _dl_reloc_bad_type (map, r_type, 1); 520 _dl_reloc_bad_type (map, r_type, 1);
524 } 521 }
525 522
526 #endif /* RESOLVE_MAP */ 523 #endif /* RESOLVE_MAP */
OLDNEW
« make_sysd_rules.py ('K') | « sysdeps/nacl/start.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698