init-mixed.c 2.1 KB

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