Small optimization of alloca handling.
[glibc.git] / elf / tst-array2dep.c
blobe1596b5b37b544fcb9cd9ec395b85add2d138faf
1 #include <unistd.h>
3 static void init (void) __attribute__ ((constructor));
5 static void
6 init (void)
8 write (STDOUT_FILENO, "DSO init\n", 9);
11 static void fini (void) __attribute__ ((destructor));
13 static void
14 fini (void)
16 write (STDOUT_FILENO, "DSO fini\n", 9);
19 static void
20 init_0 (void)
22 write (STDOUT_FILENO, "DSO init array 0\n", 17);
25 static void
26 init_1 (void)
28 write (STDOUT_FILENO, "DSO init array 1\n", 17);
31 static void
32 init_2 (void)
34 write (STDOUT_FILENO, "DSO init array 2\n", 17);
37 void (*const init_array []) (void)
38 __attribute__ ((section (".init_array"), aligned (sizeof (void *)))) =
40 &init_0,
41 &init_1,
42 &init_2
45 static void
46 fini_0 (void)
48 write (STDOUT_FILENO, "DSO fini array 0\n", 17);
51 static void
52 fini_1 (void)
54 write (STDOUT_FILENO, "DSO fini array 1\n", 17);
57 static void
58 fini_2 (void)
60 write (STDOUT_FILENO, "DSO fini array 2\n", 17);
63 void (*const fini_array []) (void)
64 __attribute__ ((section (".fini_array"), aligned (sizeof (void *)))) =
66 &fini_0,
67 &fini_1,
68 &fini_2