Commit | Line | Data |
---|---|---|
397b19d7 | 1 | #include "config.h" |
02ecc8e9 L |
2 | #include <stdio.h> |
3 | #include <stdlib.h> | |
4 | ||
02ecc8e9 L |
5 | #ifdef HAVE_INITFINI_ARRAY |
6 | static int count; | |
7 | ||
8 | static void | |
9 | init1005 () | |
10 | { | |
11 | if (count != 0) | |
12 | abort (); | |
13 | count = 1005; | |
14 | } | |
15 | void (*const init_array1005[]) () | |
16 | __attribute__ ((section (".init_array.01005"), aligned (sizeof (void *)))) | |
17 | = { init1005 }; | |
18 | static void | |
19 | fini1005 () | |
20 | { | |
21 | if (count != 1005) | |
22 | abort (); | |
23 | } | |
24 | void (*const fini_array1005[]) () | |
25 | __attribute__ ((section (".fini_array.01005"), aligned (sizeof (void *)))) | |
26 | = { fini1005 }; | |
27 | ||
28 | static void | |
310fd250 | 29 | ctor1007a () |
02ecc8e9 L |
30 | { |
31 | if (count != 1005) | |
32 | abort (); | |
310fd250 L |
33 | count = 1006; |
34 | } | |
35 | static void | |
36 | ctor1007b () | |
37 | { | |
38 | if (count != 1006) | |
39 | abort (); | |
02ecc8e9 L |
40 | count = 1007; |
41 | } | |
42 | void (*const ctors1007[]) () | |
43 | __attribute__ ((section (".ctors.64528"), aligned (sizeof (void *)))) | |
310fd250 | 44 | = { ctor1007b, ctor1007a }; |
02ecc8e9 | 45 | static void |
310fd250 | 46 | dtor1007a () |
02ecc8e9 | 47 | { |
310fd250 | 48 | if (count != 1006) |
02ecc8e9 L |
49 | abort (); |
50 | count = 1005; | |
51 | } | |
310fd250 L |
52 | static void |
53 | dtor1007b () | |
54 | { | |
55 | if (count != 1007) | |
56 | abort (); | |
57 | count = 1006; | |
58 | } | |
02ecc8e9 L |
59 | void (*const dtors1007[]) () |
60 | __attribute__ ((section (".dtors.64528"), aligned (sizeof (void *)))) | |
310fd250 | 61 | = { dtor1007b, dtor1007a }; |
02ecc8e9 L |
62 | |
63 | static void | |
64 | init65530 () | |
65 | { | |
66 | if (count != 1007) | |
67 | abort (); | |
68 | count = 65530; | |
69 | } | |
70 | void (*const init_array65530[]) () | |
71 | __attribute__ ((section (".init_array.65530"), aligned (sizeof (void *)))) | |
72 | = { init65530 }; | |
73 | static void | |
74 | fini65530 () | |
75 | { | |
76 | if (count != 65530) | |
77 | abort (); | |
78 | count = 1007; | |
79 | } | |
80 | void (*const fini_array65530[]) () | |
81 | __attribute__ ((section (".fini_array.65530"), aligned (sizeof (void *)))) | |
82 | = { fini65530 }; | |
83 | ||
84 | static void | |
310fd250 | 85 | ctor65535a () |
02ecc8e9 L |
86 | { |
87 | if (count != 65530) | |
88 | abort (); | |
89 | count = 65535; | |
90 | } | |
310fd250 L |
91 | static void |
92 | ctor65535b () | |
93 | { | |
94 | if (count != 65535) | |
95 | abort (); | |
96 | count = 65536; | |
97 | } | |
02ecc8e9 L |
98 | void (*const ctors65535[]) () |
99 | __attribute__ ((section (".ctors"), aligned (sizeof (void *)))) | |
310fd250 L |
100 | = { ctor65535b, ctor65535a }; |
101 | static void | |
102 | dtor65535b () | |
103 | { | |
104 | if (count != 65536) | |
105 | abort (); | |
106 | count = 65535; | |
107 | } | |
02ecc8e9 | 108 | static void |
310fd250 | 109 | dtor65535a () |
02ecc8e9 L |
110 | { |
111 | if (count != 65535) | |
112 | abort (); | |
113 | count = 65530; | |
114 | } | |
115 | void (*const dtors65535[]) () | |
116 | __attribute__ ((section (".dtors"), aligned (sizeof (void *)))) | |
310fd250 | 117 | = { dtor65535b, dtor65535a }; |
02ecc8e9 L |
118 | #endif |
119 | ||
120 | int | |
121 | main () | |
122 | { | |
123 | printf ("OK\n"); | |
124 | return 0; | |
125 | } |