1 #include "config.h" 2 #include <stdio.h> 3 #include <stdlib.h> 4 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 29 ctor1007a () 30 { 31 if (count != 1005) 32 abort (); 33 count = 1006; 34 } 35 static void 36 ctor1007b () 37 { 38 if (count != 1006) 39 abort (); 40 count = 1007; 41 } 42 void (*const ctors1007[]) () 43 __attribute__ ((section (".ctors.64528"), aligned (sizeof (void *)))) 44 = { ctor1007b, ctor1007a }; 45 static void 46 dtor1007a () 47 { 48 if (count != 1006) 49 abort (); 50 count = 1005; 51 } 52 static void 53 dtor1007b () 54 { 55 if (count != 1007) 56 abort (); 57 count = 1006; 58 } 59 void (*const dtors1007[]) () 60 __attribute__ ((section (".dtors.64528"), aligned (sizeof (void *)))) 61 = { dtor1007b, dtor1007a }; 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 85 ctor65535a () 86 { 87 if (count != 65530) 88 abort (); 89 count = 65535; 90 } 91 static void 92 ctor65535b () 93 { 94 if (count != 65535) 95 abort (); 96 count = 65536; 97 } 98 void (*const ctors65535[]) () 99 __attribute__ ((section (".ctors"), aligned (sizeof (void *)))) 100 = { ctor65535b, ctor65535a }; 101 static void 102 dtor65535b () 103 { 104 if (count != 65536) 105 abort (); 106 count = 65535; 107 } 108 static void 109 dtor65535a () 110 { 111 if (count != 65535) 112 abort (); 113 count = 65530; 114 } 115 void (*const dtors65535[]) () 116 __attribute__ ((section (".dtors"), aligned (sizeof (void *)))) 117 = { dtor65535b, dtor65535a }; 118 #endif 119 120 int 121 main () 122 { 123 printf ("OK\n"); 124 return 0; 125 } 126