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