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

Side by Side Diff: newlib/libc/misc/init.c

Issue 1533383004: Explicitly enable the use of init/fini array under PNaCl (Closed) Base URL: https://chromium.googlesource.com/native_client/nacl-newlib.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « newlib/libc/misc/fini.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 /* 1 /*
2 * Copyright (C) 2004 CodeSourcery, LLC 2 * Copyright (C) 2004 CodeSourcery, LLC
3 * 3 *
4 * Permission to use, copy, modify, and distribute this file 4 * Permission to use, copy, modify, and distribute this file
5 * for any purpose is hereby granted without fee, provided that 5 * for any purpose is hereby granted without fee, provided that
6 * the above copyright notice and this notice appears in all 6 * the above copyright notice and this notice appears in all
7 * copies. 7 * copies.
8 * 8 *
9 * This file is distributed WITHOUT ANY WARRANTY; without even the implied 9 * This file is distributed WITHOUT ANY WARRANTY; without even the implied
10 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 */ 11 */
12 12
13 /* Handle ELF .{pre_init,init,fini}_array sections. */ 13 /* Handle ELF .{pre_init,init,fini}_array sections. */
14 #include <sys/types.h> 14 #include <sys/types.h>
15 15
16 #ifdef HAVE_INITFINI_ARRAY 16 #if defined(HAVE_INITFINI_ARRAY) || defined(__pnacl__)
17 17
18 /* These magic symbols are provided by the linker. */ 18 /* These magic symbols are provided by the linker. */
19 extern void (*__preinit_array_start []) (void) __attribute__((weak)); 19 extern void (*__preinit_array_start []) (void) __attribute__((weak));
20 extern void (*__preinit_array_end []) (void) __attribute__((weak)); 20 extern void (*__preinit_array_end []) (void) __attribute__((weak));
21 extern void (*__init_array_start []) (void) __attribute__((weak)); 21 extern void (*__init_array_start []) (void) __attribute__((weak));
22 extern void (*__init_array_end []) (void) __attribute__((weak)); 22 extern void (*__init_array_end []) (void) __attribute__((weak));
23 23
24 extern void _init (void); 24 extern void _init (void);
25 25
26 /* Iterate over all the init routines. */ 26 /* Iterate over all the init routines. */
27 void 27 void
28 __libc_init_array (void) 28 __libc_init_array (void)
29 { 29 {
30 size_t count; 30 size_t count;
31 size_t i; 31 size_t i;
32 32
33 count = __preinit_array_end - __preinit_array_start; 33 count = __preinit_array_end - __preinit_array_start;
34 for (i = 0; i < count; i++) 34 for (i = 0; i < count; i++)
35 __preinit_array_start[i] (); 35 __preinit_array_start[i] ();
36 36
37 _init (); 37 _init ();
38 38
39 count = __init_array_end - __init_array_start; 39 count = __init_array_end - __init_array_start;
40 for (i = 0; i < count; i++) 40 for (i = 0; i < count; i++)
41 __init_array_start[i] (); 41 __init_array_start[i] ();
42 } 42 }
43 #endif 43 #endif
OLDNEW
« no previous file with comments | « newlib/libc/misc/fini.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698