OLD | NEW |
1 // Copyright 2012 The Go Authors. All rights reserved. | 1 // Copyright 2012 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include "runtime.h" | 5 #include "runtime.h" |
6 | 6 |
| 7 #define AT_RANDOM 25 |
7 #define AT_SYSINFO_EHDR 33 | 8 #define AT_SYSINFO_EHDR 33 |
8 #define AT_NULL 0 /* End of vector */ | 9 #define AT_NULL 0 /* End of vector */ |
9 #define PT_LOAD 1 /* Loadable program segment */ | 10 #define PT_LOAD 1 /* Loadable program segment */ |
10 #define PT_DYNAMIC 2 /* Dynamic linking information */ | 11 #define PT_DYNAMIC 2 /* Dynamic linking information */ |
11 #define DT_NULL 0 /* Marks end of dynamic section */ | 12 #define DT_NULL 0 /* Marks end of dynamic section */ |
12 #define DT_STRTAB 5 /* Address of string table */ | 13 #define DT_STRTAB 5 /* Address of string table */ |
13 #define DT_SYMTAB 6 /* Address of symbol table */ | 14 #define DT_SYMTAB 6 /* Address of symbol table */ |
14 #define DT_VERSYM 0x6ffffff0 | 15 #define DT_VERSYM 0x6ffffff0 |
15 #define DT_VERDEF 0x6ffffffc | 16 #define DT_VERDEF 0x6ffffffc |
16 | 17 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // skip NULL separator | 313 // skip NULL separator |
313 p++; | 314 p++; |
314 | 315 |
315 // now, p points to auxv | 316 // now, p points to auxv |
316 Elf64_auxv_t *elf_auxv = (Elf64_auxv_t*) p; | 317 Elf64_auxv_t *elf_auxv = (Elf64_auxv_t*) p; |
317 | 318 |
318 for(int32 i=0; elf_auxv[i].a_type!=AT_NULL; i++) { | 319 for(int32 i=0; elf_auxv[i].a_type!=AT_NULL; i++) { |
319 if(elf_auxv[i].a_type == AT_SYSINFO_EHDR) { | 320 if(elf_auxv[i].a_type == AT_SYSINFO_EHDR) { |
320 if(elf_auxv[i].a_un.a_val == 0) { | 321 if(elf_auxv[i].a_un.a_val == 0) { |
321 // Something went wrong | 322 // Something went wrong |
322 » » » » return; | 323 » » » » continue; |
323 } | 324 } |
324 vdso_init_from_sysinfo_ehdr(&vdso_info, (Elf64_Ehdr*)elf
_auxv[i].a_un.a_val); | 325 vdso_init_from_sysinfo_ehdr(&vdso_info, (Elf64_Ehdr*)elf
_auxv[i].a_un.a_val); |
325 vdso_parse_symbols(&vdso_info, vdso_find_version(&vdso_i
nfo, &linux26)); | 326 vdso_parse_symbols(&vdso_info, vdso_find_version(&vdso_i
nfo, &linux26)); |
326 » » » return; | 327 » » » continue; |
| 328 » » } |
| 329 » » if(elf_auxv[i].a_type == AT_RANDOM) { |
| 330 » » runtime·startup_random_data = (byte*)elf_auxv[i].a_un.a_
val; |
| 331 » » runtime·startup_random_data_len = 16; |
| 332 » » » continue; |
327 } | 333 } |
328 } | 334 } |
329 } | 335 } |
330 | 336 |
331 void (*runtime·sysargs)(int32, uint8**) = runtime·linux_setup_vdso; | 337 void (*runtime·sysargs)(int32, uint8**) = runtime·linux_setup_vdso; |
OLD | NEW |