PowerPC: Fix nearbyintl failure for few inputs
[glibc.git] / elf / tst-array1.c
blobe998932b369fd5b76a7d344add49e61c266c014c
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, "init\n", 5);
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, "fini\n", 5);
21 static void
22 preinit_0 (void)
24 write (STDOUT_FILENO, "preinit array 0\n", 16);
27 static void
28 preinit_1 (void)
30 write (STDOUT_FILENO, "preinit array 1\n", 16);
33 static void
34 preinit_2 (void)
36 write (STDOUT_FILENO, "preinit array 2\n", 16);
39 void (*const preinit_array []) (void)
40 __attribute__ ((section (".preinit_array"), aligned (sizeof (void *)))) =
42 &preinit_0,
43 &preinit_1,
44 &preinit_2
47 static void
48 init_0 (void)
50 write (STDOUT_FILENO, "init array 0\n", 13);
53 static void
54 init_1 (void)
56 write (STDOUT_FILENO, "init array 1\n", 13);
59 static void
60 init_2 (void)
62 write (STDOUT_FILENO, "init array 2\n", 13);
65 void (*init_array []) (void)
66 __attribute__ ((section (".init_array"), aligned (sizeof (void *)))) =
68 &init_0,
69 &init_1,
70 &init_2
73 static void
74 fini_0 (void)
76 write (STDOUT_FILENO, "fini array 0\n", 13);
79 static void
80 fini_1 (void)
82 write (STDOUT_FILENO, "fini array 1\n", 13);
85 static void
86 fini_2 (void)
88 write (STDOUT_FILENO, "fini array 2\n", 13);
91 void (*fini_array []) (void)
92 __attribute__ ((section (".fini_array"), aligned (sizeof (void *)))) =
94 &fini_0,
95 &fini_1,
96 &fini_2
99 int
100 main (void)
102 return 0;