Tweak realloc/MREMAP comment to be more accurate.
[glibc.git] / elf / tst-array2dep.c
blob2f920cdc8d06382c3884c2fab8244792a3004003
1 #include <unistd.h>
3 /* Give init non-default priority so that it runs before init_array. */
4 static void init (void) __attribute__ ((constructor (1000)));
6 static void
7 init (void)
9 write (STDOUT_FILENO, "DSO init\n", 9);
12 /* Give fini the same priority as init. */
13 static void fini (void) __attribute__ ((destructor (1000)));
15 static void
16 fini (void)
18 write (STDOUT_FILENO, "DSO fini\n", 9);
21 static void
22 init_0 (void)
24 write (STDOUT_FILENO, "DSO init array 0\n", 17);
27 static void
28 init_1 (void)
30 write (STDOUT_FILENO, "DSO init array 1\n", 17);
33 static void
34 init_2 (void)
36 write (STDOUT_FILENO, "DSO init array 2\n", 17);
39 void (*init_array []) (void)
40 __attribute__ ((section (".init_array"), aligned (sizeof (void *)))) =
42 &init_0,
43 &init_1,
44 &init_2
47 static void
48 fini_0 (void)
50 write (STDOUT_FILENO, "DSO fini array 0\n", 17);
53 static void
54 fini_1 (void)
56 write (STDOUT_FILENO, "DSO fini array 1\n", 17);
59 static void
60 fini_2 (void)
62 write (STDOUT_FILENO, "DSO fini array 2\n", 17);
65 void (*fini_array []) (void)
66 __attribute__ ((section (".fini_array"), aligned (sizeof (void *)))) =
68 &fini_0,
69 &fini_1,
70 &fini_2