ld: Update function prototypes for compilers defaulting to -std=gnu23
[binutils-gdb.git] / ld / testsuite / ld-elf / init-mixed.c
blobf401ded4d702be49669ecdc7893f65cc70e9fa7c
1 #include "config.h"
2 #include <stdio.h>
3 #include <stdlib.h>
5 #ifdef HAVE_INITFINI_ARRAY
6 static int count;
8 static void
9 init1005 ()
11 if (count != 0)
12 abort ();
13 count = 1005;
15 void (*const init_array1005[]) ()
16 __attribute__ ((section (".init_array.01005"), aligned (sizeof (void *))))
17 = { init1005 };
18 static void
19 fini1005 ()
21 if (count != 1005)
22 abort ();
24 void (*const fini_array1005[]) ()
25 __attribute__ ((section (".fini_array.01005"), aligned (sizeof (void *))))
26 = { fini1005 };
28 static void
29 ctor1007a ()
31 if (count != 1005)
32 abort ();
33 count = 1006;
35 static void
36 ctor1007b ()
38 if (count != 1006)
39 abort ();
40 count = 1007;
42 void (*const ctors1007[]) ()
43 __attribute__ ((section (".ctors.64528"), aligned (sizeof (void *))))
44 = { ctor1007b, ctor1007a };
45 static void
46 dtor1007a ()
48 if (count != 1006)
49 abort ();
50 count = 1005;
52 static void
53 dtor1007b ()
55 if (count != 1007)
56 abort ();
57 count = 1006;
59 void (*const dtors1007[]) ()
60 __attribute__ ((section (".dtors.64528"), aligned (sizeof (void *))))
61 = { dtor1007b, dtor1007a };
63 static void
64 init65530 ()
66 if (count != 1007)
67 abort ();
68 count = 65530;
70 void (*const init_array65530[]) ()
71 __attribute__ ((section (".init_array.65530"), aligned (sizeof (void *))))
72 = { init65530 };
73 static void
74 fini65530 ()
76 if (count != 65530)
77 abort ();
78 count = 1007;
80 void (*const fini_array65530[]) ()
81 __attribute__ ((section (".fini_array.65530"), aligned (sizeof (void *))))
82 = { fini65530 };
84 static void
85 ctor65535a ()
87 if (count != 65530)
88 abort ();
89 count = 65535;
91 static void
92 ctor65535b ()
94 if (count != 65535)
95 abort ();
96 count = 65536;
98 void (*const ctors65535[]) ()
99 __attribute__ ((section (".ctors"), aligned (sizeof (void *))))
100 = { ctor65535b, ctor65535a };
101 static void
102 dtor65535b ()
104 if (count != 65536)
105 abort ();
106 count = 65535;
108 static void
109 dtor65535a ()
111 if (count != 65535)
112 abort ();
113 count = 65530;
115 void (*const dtors65535[]) ()
116 __attribute__ ((section (".dtors"), aligned (sizeof (void *))))
117 = { dtor65535b, dtor65535a };
118 #endif
121 main ()
123 printf ("OK\n");
124 return 0;