* config/arm/arm.c (arm_expand_epilogue): Count blocks of 4 regs.
[official-gcc.git] / gcc / libgcc2.c
blob34171ad90023c432b4b4d49933b0811da4663cbc
1 /* More subroutines needed by GCC output code on some machines. */
2 /* Compile this one with gcc. */
3 /* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
13 In addition to the permissions in the GNU General Public License, the
14 Free Software Foundation gives you unlimited permission to link the
15 compiled version of this file into combinations with other programs,
16 and to distribute those combinations without any restriction coming
17 from the use of this file. (The General Public License restrictions
18 do apply in other respects; for example, they cover modification of
19 the file, and distribution when not linked into a combine
20 executable.)
22 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
23 WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 for more details.
27 You should have received a copy of the GNU General Public License
28 along with GCC; see the file COPYING. If not, write to the Free
29 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
30 02111-1307, USA. */
33 /* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is
34 supposedly valid even though this is a "target" file. */
35 #include "auto-host.h"
37 /* It is incorrect to include config.h here, because this file is being
38 compiled for the target, and hence definitions concerning only the host
39 do not apply. */
40 #include "tconfig.h"
41 #include "tsystem.h"
42 #include "coretypes.h"
43 #include "tm.h"
45 /* Don't use `fancy_abort' here even if config.h says to use it. */
46 #ifdef abort
47 #undef abort
48 #endif
50 #ifdef HAVE_GAS_HIDDEN
51 #define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
52 #else
53 #define ATTRIBUTE_HIDDEN
54 #endif
56 #include "libgcc2.h"
58 #ifdef DECLARE_LIBRARY_RENAMES
59 DECLARE_LIBRARY_RENAMES
60 #endif
62 #if defined (L_negdi2)
63 DWtype
64 __negdi2 (DWtype u)
66 const DWunion uu = {.ll = u};
67 const DWunion w = { {.low = -uu.s.low,
68 .high = -uu.s.high - ((UWtype) -uu.s.low > 0) } };
70 return w.ll;
72 #endif
74 #ifdef L_addvsi3
75 Wtype
76 __addvsi3 (Wtype a, Wtype b)
78 const Wtype w = a + b;
80 if (b >= 0 ? w < a : w > a)
81 abort ();
83 return w;
85 #endif
87 #ifdef L_addvdi3
88 DWtype
89 __addvdi3 (DWtype a, DWtype b)
91 const DWtype w = a + b;
93 if (b >= 0 ? w < a : w > a)
94 abort ();
96 return w;
98 #endif
100 #ifdef L_subvsi3
101 Wtype
102 __subvsi3 (Wtype a, Wtype b)
104 const DWtype w = a - b;
106 if (b >= 0 ? w > a : w < a)
107 abort ();
109 return w;
111 #endif
113 #ifdef L_subvdi3
114 DWtype
115 __subvdi3 (DWtype a, DWtype b)
117 const DWtype w = a - b;
119 if (b >= 0 ? w > a : w < a)
120 abort ();
122 return w;
124 #endif
126 #ifdef L_mulvsi3
127 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
128 Wtype
129 __mulvsi3 (Wtype a, Wtype b)
131 const DWtype w = (DWtype) a * (DWtype) b;
133 if (((a >= 0) == (b >= 0))
134 ? (UDWtype) w > (UDWtype) (((DWtype) 1 << (WORD_SIZE - 1)) - 1)
135 : (UDWtype) w < (UDWtype) ((DWtype) -1 << (WORD_SIZE - 1)))
136 abort ();
138 return w;
140 #endif
142 #ifdef L_negvsi2
143 Wtype
144 __negvsi2 (Wtype a)
146 const Wtype w = -a;
148 if (a >= 0 ? w > 0 : w < 0)
149 abort ();
151 return w;
153 #endif
155 #ifdef L_negvdi2
156 DWtype
157 __negvdi2 (DWtype a)
159 const DWtype w = -a;
161 if (a >= 0 ? w > 0 : w < 0)
162 abort ();
164 return w;
166 #endif
168 #ifdef L_absvsi2
169 Wtype
170 __absvsi2 (Wtype a)
172 Wtype w = a;
174 if (a < 0)
175 #ifdef L_negvsi2
176 w = __negvsi2 (a);
177 #else
178 w = -a;
180 if (w < 0)
181 abort ();
182 #endif
184 return w;
186 #endif
188 #ifdef L_absvdi2
189 DWtype
190 __absvdi2 (DWtype a)
192 DWtype w = a;
194 if (a < 0)
195 #ifdef L_negvdi2
196 w = __negvdi2 (a);
197 #else
198 w = -a;
200 if (w < 0)
201 abort ();
202 #endif
204 return w;
206 #endif
208 #ifdef L_mulvdi3
209 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
210 DWtype
211 __mulvdi3 (DWtype u, DWtype v)
213 /* The unchecked multiplication needs 3 Wtype x Wtype multiplications,
214 but the checked multiplication needs only two. */
215 const DWunion uu = {.ll = u};
216 const DWunion vv = {.ll = v};
218 if (__builtin_expect (uu.s.high == uu.s.low >> (WORD_SIZE - 1), 1))
220 /* u fits in a single Wtype. */
221 if (__builtin_expect (vv.s.high == vv.s.low >> (WORD_SIZE - 1), 1))
223 /* v fits in a single Wtype as well. */
224 /* A single multiplication. No overflow risk. */
225 return (DWtype) uu.s.low * (DWtype) vv.s.low;
227 else
229 /* Two multiplications. */
230 DWunion w0 = {.ll = (UDWtype) (UWtype) uu.s.low
231 * (UDWtype) (UWtype) vv.s.low};
232 DWunion w1 = {.ll = (UDWtype) (UWtype) uu.s.low
233 * (UDWtype) (UWtype) vv.s.high};
235 if (vv.s.high < 0)
236 w1.s.high -= uu.s.low;
237 if (uu.s.low < 0)
238 w1.ll -= vv.ll;
239 w1.ll += (UWtype) w0.s.high;
240 if (__builtin_expect (w1.s.high == w1.s.low >> (WORD_SIZE - 1), 1))
242 w0.s.high = w1.s.low;
243 return w0.ll;
247 else
249 if (__builtin_expect (vv.s.high == vv.s.low >> (WORD_SIZE - 1), 1))
251 /* v fits into a single Wtype. */
252 /* Two multiplications. */
253 DWunion w0 = {.ll = (UDWtype) (UWtype) uu.s.low
254 * (UDWtype) (UWtype) vv.s.low};
255 DWunion w1 = {.ll = (UDWtype) (UWtype) uu.s.high
256 * (UDWtype) (UWtype) vv.s.low};
258 if (uu.s.high < 0)
259 w1.s.high -= vv.s.low;
260 if (vv.s.low < 0)
261 w1.ll -= uu.ll;
262 w1.ll += (UWtype) w0.s.high;
263 if (__builtin_expect (w1.s.high == w1.s.low >> (WORD_SIZE - 1), 1))
265 w0.s.high = w1.s.low;
266 return w0.ll;
269 else
271 /* A few sign checks and a single multiplication. */
272 if (uu.s.high >= 0)
274 if (vv.s.high >= 0)
276 if (uu.s.high == 0 && vv.s.high == 0)
278 const DWtype w = (UDWtype) (UWtype) uu.s.low
279 * (UDWtype) (UWtype) vv.s.low;
280 if (__builtin_expect (w >= 0, 1))
281 return w;
284 else
286 if (uu.s.high == 0 && vv.s.high == (Wtype) -1)
288 DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low
289 * (UDWtype) (UWtype) vv.s.low};
291 ww.s.high -= uu.s.low;
292 if (__builtin_expect (ww.s.high < 0, 1))
293 return ww.ll;
297 else
299 if (vv.s.high >= 0)
301 if (uu.s.high == (Wtype) -1 && vv.s.high == 0)
303 DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low
304 * (UDWtype) (UWtype) vv.s.low};
306 ww.s.high -= vv.s.low;
307 if (__builtin_expect (ww.s.high < 0, 1))
308 return ww.ll;
311 else
313 if (uu.s.high == (Wtype) -1 && vv.s.high == (Wtype) - 1)
315 DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low
316 * (UDWtype) (UWtype) vv.s.low};
318 ww.s.high -= uu.s.low;
319 ww.s.high -= vv.s.low;
320 if (__builtin_expect (ww.s.high >= 0, 1))
321 return ww.ll;
328 /* Overflow. */
329 abort ();
331 #endif
334 /* Unless shift functions are defined with full ANSI prototypes,
335 parameter b will be promoted to int if word_type is smaller than an int. */
336 #ifdef L_lshrdi3
337 DWtype
338 __lshrdi3 (DWtype u, word_type b)
340 if (b == 0)
341 return u;
343 const DWunion uu = {.ll = u};
344 const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
345 DWunion w;
347 if (bm <= 0)
349 w.s.high = 0;
350 w.s.low = (UWtype) uu.s.high >> -bm;
352 else
354 const UWtype carries = (UWtype) uu.s.high << bm;
356 w.s.high = (UWtype) uu.s.high >> b;
357 w.s.low = ((UWtype) uu.s.low >> b) | carries;
360 return w.ll;
362 #endif
364 #ifdef L_ashldi3
365 DWtype
366 __ashldi3 (DWtype u, word_type b)
368 if (b == 0)
369 return u;
371 const DWunion uu = {.ll = u};
372 const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
373 DWunion w;
375 if (bm <= 0)
377 w.s.low = 0;
378 w.s.high = (UWtype) uu.s.low << -bm;
380 else
382 const UWtype carries = (UWtype) uu.s.low >> bm;
384 w.s.low = (UWtype) uu.s.low << b;
385 w.s.high = ((UWtype) uu.s.high << b) | carries;
388 return w.ll;
390 #endif
392 #ifdef L_ashrdi3
393 DWtype
394 __ashrdi3 (DWtype u, word_type b)
396 if (b == 0)
397 return u;
399 const DWunion uu = {.ll = u};
400 const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b;
401 DWunion w;
403 if (bm <= 0)
405 /* w.s.high = 1..1 or 0..0 */
406 w.s.high = uu.s.high >> (sizeof (Wtype) * BITS_PER_UNIT - 1);
407 w.s.low = uu.s.high >> -bm;
409 else
411 const UWtype carries = (UWtype) uu.s.high << bm;
413 w.s.high = uu.s.high >> b;
414 w.s.low = ((UWtype) uu.s.low >> b) | carries;
417 return w.ll;
419 #endif
421 #ifdef L_ffssi2
422 #undef int
423 extern int __ffsSI2 (UWtype u);
425 __ffsSI2 (UWtype u)
427 UWtype count;
429 if (u == 0)
430 return 0;
432 count_trailing_zeros (count, u);
433 return count + 1;
435 #endif
437 #ifdef L_ffsdi2
438 #undef int
439 extern int __ffsDI2 (DWtype u);
441 __ffsDI2 (DWtype u)
443 const DWunion uu = {.ll = u};
444 UWtype word, count, add;
446 if (uu.s.low != 0)
447 word = uu.s.low, add = 0;
448 else if (uu.s.high != 0)
449 word = uu.s.high, add = BITS_PER_UNIT * sizeof (Wtype);
450 else
451 return 0;
453 count_trailing_zeros (count, word);
454 return count + add + 1;
456 #endif
458 #ifdef L_muldi3
459 DWtype
460 __muldi3 (DWtype u, DWtype v)
462 const DWunion uu = {.ll = u};
463 const DWunion vv = {.ll = v};
464 DWunion w = {.ll = __umulsidi3 (uu.s.low, vv.s.low)};
466 w.s.high += ((UWtype) uu.s.low * (UWtype) vv.s.high
467 + (UWtype) uu.s.high * (UWtype) vv.s.low);
469 return w.ll;
471 #endif
473 #if (defined (L_udivdi3) || defined (L_divdi3) || \
474 defined (L_umoddi3) || defined (L_moddi3))
475 #if defined (sdiv_qrnnd)
476 #define L_udiv_w_sdiv
477 #endif
478 #endif
480 #ifdef L_udiv_w_sdiv
481 #if defined (sdiv_qrnnd)
482 #if (defined (L_udivdi3) || defined (L_divdi3) || \
483 defined (L_umoddi3) || defined (L_moddi3))
484 static inline __attribute__ ((__always_inline__))
485 #endif
486 UWtype
487 __udiv_w_sdiv (UWtype *rp, UWtype a1, UWtype a0, UWtype d)
489 UWtype q, r;
490 UWtype c0, c1, b1;
492 if ((Wtype) d >= 0)
494 if (a1 < d - a1 - (a0 >> (W_TYPE_SIZE - 1)))
496 /* dividend, divisor, and quotient are nonnegative */
497 sdiv_qrnnd (q, r, a1, a0, d);
499 else
501 /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */
502 sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (W_TYPE_SIZE - 1));
503 /* Divide (c1*2^32 + c0) by d */
504 sdiv_qrnnd (q, r, c1, c0, d);
505 /* Add 2^31 to quotient */
506 q += (UWtype) 1 << (W_TYPE_SIZE - 1);
509 else
511 b1 = d >> 1; /* d/2, between 2^30 and 2^31 - 1 */
512 c1 = a1 >> 1; /* A/2 */
513 c0 = (a1 << (W_TYPE_SIZE - 1)) + (a0 >> 1);
515 if (a1 < b1) /* A < 2^32*b1, so A/2 < 2^31*b1 */
517 sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */
519 r = 2*r + (a0 & 1); /* Remainder from A/(2*b1) */
520 if ((d & 1) != 0)
522 if (r >= q)
523 r = r - q;
524 else if (q - r <= d)
526 r = r - q + d;
527 q--;
529 else
531 r = r - q + 2*d;
532 q -= 2;
536 else if (c1 < b1) /* So 2^31 <= (A/2)/b1 < 2^32 */
538 c1 = (b1 - 1) - c1;
539 c0 = ~c0; /* logical NOT */
541 sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */
543 q = ~q; /* (A/2)/b1 */
544 r = (b1 - 1) - r;
546 r = 2*r + (a0 & 1); /* A/(2*b1) */
548 if ((d & 1) != 0)
550 if (r >= q)
551 r = r - q;
552 else if (q - r <= d)
554 r = r - q + d;
555 q--;
557 else
559 r = r - q + 2*d;
560 q -= 2;
564 else /* Implies c1 = b1 */
565 { /* Hence a1 = d - 1 = 2*b1 - 1 */
566 if (a0 >= -d)
568 q = -1;
569 r = a0 + d;
571 else
573 q = -2;
574 r = a0 + 2*d;
579 *rp = r;
580 return q;
582 #else
583 /* If sdiv_qrnnd doesn't exist, define dummy __udiv_w_sdiv. */
584 UWtype
585 __udiv_w_sdiv (UWtype *rp __attribute__ ((__unused__)),
586 UWtype a1 __attribute__ ((__unused__)),
587 UWtype a0 __attribute__ ((__unused__)),
588 UWtype d __attribute__ ((__unused__)))
590 return 0;
592 #endif
593 #endif
595 #if (defined (L_udivdi3) || defined (L_divdi3) || \
596 defined (L_umoddi3) || defined (L_moddi3))
597 #define L_udivmoddi4
598 #endif
600 #ifdef L_clz
601 const UQItype __clz_tab[] =
603 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
604 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
605 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
606 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
607 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
608 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
609 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
610 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
612 #endif
614 #ifdef L_clzsi2
615 #undef int
616 extern int __clzSI2 (UWtype x);
618 __clzSI2 (UWtype x)
620 Wtype ret;
622 count_leading_zeros (ret, x);
624 return ret;
626 #endif
628 #ifdef L_clzdi2
629 #undef int
630 extern int __clzDI2 (UDWtype x);
632 __clzDI2 (UDWtype x)
634 const DWunion uu = {.ll = x};
635 UWtype word;
636 Wtype ret, add;
638 if (uu.s.high)
639 word = uu.s.high, add = 0;
640 else
641 word = uu.s.low, add = W_TYPE_SIZE;
643 count_leading_zeros (ret, word);
644 return ret + add;
646 #endif
648 #ifdef L_ctzsi2
649 #undef int
650 extern int __ctzSI2 (UWtype x);
652 __ctzSI2 (UWtype x)
654 Wtype ret;
656 count_trailing_zeros (ret, x);
658 return ret;
660 #endif
662 #ifdef L_ctzdi2
663 #undef int
664 extern int __ctzDI2 (UDWtype x);
666 __ctzDI2 (UDWtype x)
668 const DWunion uu = {.ll = x};
669 UWtype word;
670 Wtype ret, add;
672 if (uu.s.low)
673 word = uu.s.low, add = 0;
674 else
675 word = uu.s.high, add = W_TYPE_SIZE;
677 count_trailing_zeros (ret, word);
678 return ret + add;
680 #endif
682 #if (defined (L_popcountsi2) || defined (L_popcountdi2) \
683 || defined (L_popcount_tab))
684 extern const UQItype __popcount_tab[] ATTRIBUTE_HIDDEN;
685 #endif
687 #ifdef L_popcount_tab
688 const UQItype __popcount_tab[] =
690 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
691 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
692 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
693 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
694 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
695 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
696 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
697 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
699 #endif
701 #ifdef L_popcountsi2
702 #undef int
703 extern int __popcountSI2 (UWtype x);
705 __popcountSI2 (UWtype x)
707 UWtype i, ret = 0;
709 for (i = 0; i < W_TYPE_SIZE; i += 8)
710 ret += __popcount_tab[(x >> i) & 0xff];
712 return ret;
714 #endif
716 #ifdef L_popcountdi2
717 #undef int
718 extern int __popcountDI2 (UDWtype x);
720 __popcountDI2 (UDWtype x)
722 UWtype i, ret = 0;
724 for (i = 0; i < 2*W_TYPE_SIZE; i += 8)
725 ret += __popcount_tab[(x >> i) & 0xff];
727 return ret;
729 #endif
731 #ifdef L_paritysi2
732 #undef int
733 extern int __paritySI2 (UWtype x);
735 __paritySI2 (UWtype x)
737 #if W_TYPE_SIZE > 64
738 # error "fill out the table"
739 #endif
740 #if W_TYPE_SIZE > 32
741 x ^= x >> 32;
742 #endif
743 #if W_TYPE_SIZE > 16
744 x ^= x >> 16;
745 #endif
746 x ^= x >> 8;
747 x ^= x >> 4;
748 x &= 0xf;
749 return (0x6996 >> x) & 1;
751 #endif
753 #ifdef L_paritydi2
754 #undef int
755 extern int __parityDI2 (UDWtype x);
757 __parityDI2 (UDWtype x)
759 const DWunion uu = {.ll = x};
760 UWtype nx = uu.s.low ^ uu.s.high;
762 #if W_TYPE_SIZE > 64
763 # error "fill out the table"
764 #endif
765 #if W_TYPE_SIZE > 32
766 nx ^= nx >> 32;
767 #endif
768 #if W_TYPE_SIZE > 16
769 nx ^= nx >> 16;
770 #endif
771 nx ^= nx >> 8;
772 nx ^= nx >> 4;
773 nx &= 0xf;
774 return (0x6996 >> nx) & 1;
776 #endif
778 #ifdef L_udivmoddi4
780 #if (defined (L_udivdi3) || defined (L_divdi3) || \
781 defined (L_umoddi3) || defined (L_moddi3))
782 static inline __attribute__ ((__always_inline__))
783 #endif
784 UDWtype
785 __udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp)
787 const DWunion nn = {.ll = n};
788 const DWunion dd = {.ll = d};
789 DWunion rr;
790 UWtype d0, d1, n0, n1, n2;
791 UWtype q0, q1;
792 UWtype b, bm;
794 d0 = dd.s.low;
795 d1 = dd.s.high;
796 n0 = nn.s.low;
797 n1 = nn.s.high;
799 #if !UDIV_NEEDS_NORMALIZATION
800 if (d1 == 0)
802 if (d0 > n1)
804 /* 0q = nn / 0D */
806 udiv_qrnnd (q0, n0, n1, n0, d0);
807 q1 = 0;
809 /* Remainder in n0. */
811 else
813 /* qq = NN / 0d */
815 if (d0 == 0)
816 d0 = 1 / d0; /* Divide intentionally by zero. */
818 udiv_qrnnd (q1, n1, 0, n1, d0);
819 udiv_qrnnd (q0, n0, n1, n0, d0);
821 /* Remainder in n0. */
824 if (rp != 0)
826 rr.s.low = n0;
827 rr.s.high = 0;
828 *rp = rr.ll;
832 #else /* UDIV_NEEDS_NORMALIZATION */
834 if (d1 == 0)
836 if (d0 > n1)
838 /* 0q = nn / 0D */
840 count_leading_zeros (bm, d0);
842 if (bm != 0)
844 /* Normalize, i.e. make the most significant bit of the
845 denominator set. */
847 d0 = d0 << bm;
848 n1 = (n1 << bm) | (n0 >> (W_TYPE_SIZE - bm));
849 n0 = n0 << bm;
852 udiv_qrnnd (q0, n0, n1, n0, d0);
853 q1 = 0;
855 /* Remainder in n0 >> bm. */
857 else
859 /* qq = NN / 0d */
861 if (d0 == 0)
862 d0 = 1 / d0; /* Divide intentionally by zero. */
864 count_leading_zeros (bm, d0);
866 if (bm == 0)
868 /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
869 conclude (the most significant bit of n1 is set) /\ (the
870 leading quotient digit q1 = 1).
872 This special case is necessary, not an optimization.
873 (Shifts counts of W_TYPE_SIZE are undefined.) */
875 n1 -= d0;
876 q1 = 1;
878 else
880 /* Normalize. */
882 b = W_TYPE_SIZE - bm;
884 d0 = d0 << bm;
885 n2 = n1 >> b;
886 n1 = (n1 << bm) | (n0 >> b);
887 n0 = n0 << bm;
889 udiv_qrnnd (q1, n1, n2, n1, d0);
892 /* n1 != d0... */
894 udiv_qrnnd (q0, n0, n1, n0, d0);
896 /* Remainder in n0 >> bm. */
899 if (rp != 0)
901 rr.s.low = n0 >> bm;
902 rr.s.high = 0;
903 *rp = rr.ll;
906 #endif /* UDIV_NEEDS_NORMALIZATION */
908 else
910 if (d1 > n1)
912 /* 00 = nn / DD */
914 q0 = 0;
915 q1 = 0;
917 /* Remainder in n1n0. */
918 if (rp != 0)
920 rr.s.low = n0;
921 rr.s.high = n1;
922 *rp = rr.ll;
925 else
927 /* 0q = NN / dd */
929 count_leading_zeros (bm, d1);
930 if (bm == 0)
932 /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
933 conclude (the most significant bit of n1 is set) /\ (the
934 quotient digit q0 = 0 or 1).
936 This special case is necessary, not an optimization. */
938 /* The condition on the next line takes advantage of that
939 n1 >= d1 (true due to program flow). */
940 if (n1 > d1 || n0 >= d0)
942 q0 = 1;
943 sub_ddmmss (n1, n0, n1, n0, d1, d0);
945 else
946 q0 = 0;
948 q1 = 0;
950 if (rp != 0)
952 rr.s.low = n0;
953 rr.s.high = n1;
954 *rp = rr.ll;
957 else
959 UWtype m1, m0;
960 /* Normalize. */
962 b = W_TYPE_SIZE - bm;
964 d1 = (d1 << bm) | (d0 >> b);
965 d0 = d0 << bm;
966 n2 = n1 >> b;
967 n1 = (n1 << bm) | (n0 >> b);
968 n0 = n0 << bm;
970 udiv_qrnnd (q0, n1, n2, n1, d1);
971 umul_ppmm (m1, m0, q0, d0);
973 if (m1 > n1 || (m1 == n1 && m0 > n0))
975 q0--;
976 sub_ddmmss (m1, m0, m1, m0, d1, d0);
979 q1 = 0;
981 /* Remainder in (n1n0 - m1m0) >> bm. */
982 if (rp != 0)
984 sub_ddmmss (n1, n0, n1, n0, m1, m0);
985 rr.s.low = (n1 << b) | (n0 >> bm);
986 rr.s.high = n1 >> bm;
987 *rp = rr.ll;
993 const DWunion ww = {{.low = q0, .high = q1}};
994 return ww.ll;
996 #endif
998 #ifdef L_divdi3
999 DWtype
1000 __divdi3 (DWtype u, DWtype v)
1002 word_type c = 0;
1003 DWunion uu = {.ll = u};
1004 DWunion vv = {.ll = v};
1005 DWtype w;
1007 if (uu.s.high < 0)
1008 c = ~c,
1009 uu.ll = -uu.ll;
1010 if (vv.s.high < 0)
1011 c = ~c,
1012 vv.ll = -vv.ll;
1014 w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype *) 0);
1015 if (c)
1016 w = -w;
1018 return w;
1020 #endif
1022 #ifdef L_moddi3
1023 DWtype
1024 __moddi3 (DWtype u, DWtype v)
1026 word_type c = 0;
1027 DWunion uu = {.ll = u};
1028 DWunion vv = {.ll = v};
1029 DWtype w;
1031 if (uu.s.high < 0)
1032 c = ~c,
1033 uu.ll = -uu.ll;
1034 if (vv.s.high < 0)
1035 vv.ll = -vv.ll;
1037 (void) __udivmoddi4 (uu.ll, vv.ll, &w);
1038 if (c)
1039 w = -w;
1041 return w;
1043 #endif
1045 #ifdef L_umoddi3
1046 UDWtype
1047 __umoddi3 (UDWtype u, UDWtype v)
1049 UDWtype w;
1051 (void) __udivmoddi4 (u, v, &w);
1053 return w;
1055 #endif
1057 #ifdef L_udivdi3
1058 UDWtype
1059 __udivdi3 (UDWtype n, UDWtype d)
1061 return __udivmoddi4 (n, d, (UDWtype *) 0);
1063 #endif
1065 #ifdef L_cmpdi2
1066 word_type
1067 __cmpdi2 (DWtype a, DWtype b)
1069 const DWunion au = {.ll = a};
1070 const DWunion bu = {.ll = b};
1072 if (au.s.high < bu.s.high)
1073 return 0;
1074 else if (au.s.high > bu.s.high)
1075 return 2;
1076 if ((UWtype) au.s.low < (UWtype) bu.s.low)
1077 return 0;
1078 else if ((UWtype) au.s.low > (UWtype) bu.s.low)
1079 return 2;
1080 return 1;
1082 #endif
1084 #ifdef L_ucmpdi2
1085 word_type
1086 __ucmpdi2 (DWtype a, DWtype b)
1088 const DWunion au = {.ll = a};
1089 const DWunion bu = {.ll = b};
1091 if ((UWtype) au.s.high < (UWtype) bu.s.high)
1092 return 0;
1093 else if ((UWtype) au.s.high > (UWtype) bu.s.high)
1094 return 2;
1095 if ((UWtype) au.s.low < (UWtype) bu.s.low)
1096 return 0;
1097 else if ((UWtype) au.s.low > (UWtype) bu.s.low)
1098 return 2;
1099 return 1;
1101 #endif
1103 #if defined(L_fixunstfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
1104 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
1105 #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
1107 DWtype
1108 __fixunstfDI (TFtype a)
1110 if (a < 0)
1111 return 0;
1113 /* Compute high word of result, as a flonum. */
1114 const TFtype b = (a / HIGH_WORD_COEFF);
1115 /* Convert that to fixed (but not to DWtype!),
1116 and shift it into the high word. */
1117 UDWtype v = (UWtype) b;
1118 v <<= WORD_SIZE;
1119 /* Remove high part from the TFtype, leaving the low part as flonum. */
1120 a -= (TFtype)v;
1121 /* Convert that to fixed (but not to DWtype!) and add it in.
1122 Sometimes A comes out negative. This is significant, since
1123 A has more bits than a long int does. */
1124 if (a < 0)
1125 v -= (UWtype) (- a);
1126 else
1127 v += (UWtype) a;
1128 return v;
1130 #endif
1132 #if defined(L_fixtfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
1133 DWtype
1134 __fixtfdi (TFtype a)
1136 if (a < 0)
1137 return - __fixunstfDI (-a);
1138 return __fixunstfDI (a);
1140 #endif
1142 #if defined(L_fixunsxfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
1143 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
1144 #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
1146 DWtype
1147 __fixunsxfDI (XFtype a)
1149 if (a < 0)
1150 return 0;
1152 /* Compute high word of result, as a flonum. */
1153 const XFtype b = (a / HIGH_WORD_COEFF);
1154 /* Convert that to fixed (but not to DWtype!),
1155 and shift it into the high word. */
1156 UDWtype v = (UWtype) b;
1157 v <<= WORD_SIZE;
1158 /* Remove high part from the XFtype, leaving the low part as flonum. */
1159 a -= (XFtype)v;
1160 /* Convert that to fixed (but not to DWtype!) and add it in.
1161 Sometimes A comes out negative. This is significant, since
1162 A has more bits than a long int does. */
1163 if (a < 0)
1164 v -= (UWtype) (- a);
1165 else
1166 v += (UWtype) a;
1167 return v;
1169 #endif
1171 #if defined(L_fixxfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
1172 DWtype
1173 __fixxfdi (XFtype a)
1175 if (a < 0)
1176 return - __fixunsxfDI (-a);
1177 return __fixunsxfDI (a);
1179 #endif
1181 #ifdef L_fixunsdfdi
1182 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
1183 #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
1185 DWtype
1186 __fixunsdfDI (DFtype a)
1188 /* Get high part of result. The division here will just moves the radix
1189 point and will not cause any rounding. Then the conversion to integral
1190 type chops result as desired. */
1191 const UWtype hi = a / HIGH_WORD_COEFF;
1193 /* Get low part of result. Convert `hi' to floating type and scale it back,
1194 then subtract this from the number being converted. This leaves the low
1195 part. Convert that to integral type. */
1196 const UWtype lo = (a - ((DFtype) hi) * HIGH_WORD_COEFF);
1198 /* Assemble result from the two parts. */
1199 return ((UDWtype) hi << WORD_SIZE) | lo;
1201 #endif
1203 #ifdef L_fixdfdi
1204 DWtype
1205 __fixdfdi (DFtype a)
1207 if (a < 0)
1208 return - __fixunsdfDI (-a);
1209 return __fixunsdfDI (a);
1211 #endif
1213 #ifdef L_fixunssfdi
1214 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
1215 #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
1217 DWtype
1218 __fixunssfDI (SFtype original_a)
1220 /* Convert the SFtype to a DFtype, because that is surely not going
1221 to lose any bits. Some day someone else can write a faster version
1222 that avoids converting to DFtype, and verify it really works right. */
1223 const DFtype a = original_a;
1225 /* Get high part of result. The division here will just moves the radix
1226 point and will not cause any rounding. Then the conversion to integral
1227 type chops result as desired. */
1228 const UWtype hi = a / HIGH_WORD_COEFF;
1230 /* Get low part of result. Convert `hi' to floating type and scale it back,
1231 then subtract this from the number being converted. This leaves the low
1232 part. Convert that to integral type. */
1233 const UWtype lo = (a - ((DFtype) hi) * HIGH_WORD_COEFF);
1235 /* Assemble result from the two parts. */
1236 return ((UDWtype) hi << WORD_SIZE) | lo;
1238 #endif
1240 #ifdef L_fixsfdi
1241 DWtype
1242 __fixsfdi (SFtype a)
1244 if (a < 0)
1245 return - __fixunssfDI (-a);
1246 return __fixunssfDI (a);
1248 #endif
1250 #if defined(L_floatdixf) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
1251 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
1252 #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
1253 #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
1255 XFtype
1256 __floatdixf (DWtype u)
1258 XFtype d = (Wtype) (u >> WORD_SIZE);
1259 d *= HIGH_HALFWORD_COEFF;
1260 d *= HIGH_HALFWORD_COEFF;
1261 d += (UWtype) (u & (HIGH_WORD_COEFF - 1));
1263 return d;
1265 #endif
1267 #if defined(L_floatditf) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
1268 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
1269 #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
1270 #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
1272 TFtype
1273 __floatditf (DWtype u)
1275 TFtype d = (Wtype) (u >> WORD_SIZE);
1276 d *= HIGH_HALFWORD_COEFF;
1277 d *= HIGH_HALFWORD_COEFF;
1278 d += (UWtype) (u & (HIGH_WORD_COEFF - 1));
1280 return d;
1282 #endif
1284 #ifdef L_floatdidf
1285 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
1286 #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
1287 #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
1289 DFtype
1290 __floatdidf (DWtype u)
1292 DFtype d = (Wtype) (u >> WORD_SIZE);
1293 d *= HIGH_HALFWORD_COEFF;
1294 d *= HIGH_HALFWORD_COEFF;
1295 d += (UWtype) (u & (HIGH_WORD_COEFF - 1));
1297 return d;
1299 #endif
1301 #ifdef L_floatdisf
1302 #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
1303 #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
1304 #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
1306 #define DI_SIZE (sizeof (DWtype) * BITS_PER_UNIT)
1307 #define DF_SIZE DBL_MANT_DIG
1308 #define SF_SIZE FLT_MANT_DIG
1310 SFtype
1311 __floatdisf (DWtype u)
1313 /* Protect against double-rounding error.
1314 Represent any low-order bits, that might be truncated in DFmode,
1315 by a bit that won't be lost. The bit can go in anywhere below the
1316 rounding position of the SFmode. A fixed mask and bit position
1317 handles all usual configurations. It doesn't handle the case
1318 of 128-bit DImode, however. */
1319 if (DF_SIZE < DI_SIZE
1320 && DF_SIZE > (DI_SIZE - DF_SIZE + SF_SIZE))
1322 #define REP_BIT ((UDWtype) 1 << (DI_SIZE - DF_SIZE))
1323 if (! (- ((DWtype) 1 << DF_SIZE) < u
1324 && u < ((DWtype) 1 << DF_SIZE)))
1326 if ((UDWtype) u & (REP_BIT - 1))
1328 u &= ~ (REP_BIT - 1);
1329 u |= REP_BIT;
1333 /* Do the calculation in DFmode
1334 so that we don't lose any of the precision of the high word
1335 while multiplying it. */
1336 DFtype f = (Wtype) (u >> WORD_SIZE);
1337 f *= HIGH_HALFWORD_COEFF;
1338 f *= HIGH_HALFWORD_COEFF;
1339 f += (UWtype) (u & (HIGH_WORD_COEFF - 1));
1341 return (SFtype) f;
1343 #endif
1345 #if defined(L_fixunsxfsi) && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
1346 /* Reenable the normal types, in case limits.h needs them. */
1347 #undef char
1348 #undef short
1349 #undef int
1350 #undef long
1351 #undef unsigned
1352 #undef float
1353 #undef double
1354 #undef MIN
1355 #undef MAX
1356 #include <limits.h>
1358 UWtype
1359 __fixunsxfSI (XFtype a)
1361 if (a >= - (DFtype) Wtype_MIN)
1362 return (Wtype) (a + Wtype_MIN) - Wtype_MIN;
1363 return (Wtype) a;
1365 #endif
1367 #ifdef L_fixunsdfsi
1368 /* Reenable the normal types, in case limits.h needs them. */
1369 #undef char
1370 #undef short
1371 #undef int
1372 #undef long
1373 #undef unsigned
1374 #undef float
1375 #undef double
1376 #undef MIN
1377 #undef MAX
1378 #include <limits.h>
1380 UWtype
1381 __fixunsdfSI (DFtype a)
1383 if (a >= - (DFtype) Wtype_MIN)
1384 return (Wtype) (a + Wtype_MIN) - Wtype_MIN;
1385 return (Wtype) a;
1387 #endif
1389 #ifdef L_fixunssfsi
1390 /* Reenable the normal types, in case limits.h needs them. */
1391 #undef char
1392 #undef short
1393 #undef int
1394 #undef long
1395 #undef unsigned
1396 #undef float
1397 #undef double
1398 #undef MIN
1399 #undef MAX
1400 #include <limits.h>
1402 UWtype
1403 __fixunssfSI (SFtype a)
1405 if (a >= - (SFtype) Wtype_MIN)
1406 return (Wtype) (a + Wtype_MIN) - Wtype_MIN;
1407 return (Wtype) a;
1409 #endif
1411 /* From here on down, the routines use normal data types. */
1413 #define SItype bogus_type
1414 #define USItype bogus_type
1415 #define DItype bogus_type
1416 #define UDItype bogus_type
1417 #define SFtype bogus_type
1418 #define DFtype bogus_type
1419 #undef Wtype
1420 #undef UWtype
1421 #undef HWtype
1422 #undef UHWtype
1423 #undef DWtype
1424 #undef UDWtype
1426 #undef char
1427 #undef short
1428 #undef int
1429 #undef long
1430 #undef unsigned
1431 #undef float
1432 #undef double
1434 #ifdef L__gcc_bcmp
1436 /* Like bcmp except the sign is meaningful.
1437 Result is negative if S1 is less than S2,
1438 positive if S1 is greater, 0 if S1 and S2 are equal. */
1441 __gcc_bcmp (const unsigned char *s1, const unsigned char *s2, size_t size)
1443 while (size > 0)
1445 const unsigned char c1 = *s1++, c2 = *s2++;
1446 if (c1 != c2)
1447 return c1 - c2;
1448 size--;
1450 return 0;
1453 #endif
1455 /* __eprintf used to be used by GCC's private version of <assert.h>.
1456 We no longer provide that header, but this routine remains in libgcc.a
1457 for binary backward compatibility. Note that it is not included in
1458 the shared version of libgcc. */
1459 #ifdef L_eprintf
1460 #ifndef inhibit_libc
1462 #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */
1463 #include <stdio.h>
1465 void
1466 __eprintf (const char *string, const char *expression,
1467 unsigned int line, const char *filename)
1469 fprintf (stderr, string, expression, line, filename);
1470 fflush (stderr);
1471 abort ();
1474 #endif
1475 #endif
1478 #ifdef L_clear_cache
1479 /* Clear part of an instruction cache. */
1481 void
1482 __clear_cache (char *beg __attribute__((__unused__)),
1483 char *end __attribute__((__unused__)))
1485 #ifdef CLEAR_INSN_CACHE
1486 CLEAR_INSN_CACHE (beg, end);
1487 #endif /* CLEAR_INSN_CACHE */
1490 #endif /* L_clear_cache */
1492 #ifdef L_trampoline
1494 /* Jump to a trampoline, loading the static chain address. */
1496 #if defined(WINNT) && ! defined(__CYGWIN__) && ! defined (_UWIN)
1498 long
1499 getpagesize (void)
1501 #ifdef _ALPHA_
1502 return 8192;
1503 #else
1504 return 4096;
1505 #endif
1508 #ifdef __i386__
1509 extern int VirtualProtect (char *, int, int, int *) __attribute__((stdcall));
1510 #endif
1513 mprotect (char *addr, int len, int prot)
1515 int np, op;
1517 if (prot == 7)
1518 np = 0x40;
1519 else if (prot == 5)
1520 np = 0x20;
1521 else if (prot == 4)
1522 np = 0x10;
1523 else if (prot == 3)
1524 np = 0x04;
1525 else if (prot == 1)
1526 np = 0x02;
1527 else if (prot == 0)
1528 np = 0x01;
1530 if (VirtualProtect (addr, len, np, &op))
1531 return 0;
1532 else
1533 return -1;
1536 #endif /* WINNT && ! __CYGWIN__ && ! _UWIN */
1538 #ifdef TRANSFER_FROM_TRAMPOLINE
1539 TRANSFER_FROM_TRAMPOLINE
1540 #endif
1541 #endif /* L_trampoline */
1543 #ifndef __CYGWIN__
1544 #ifdef L__main
1546 #include "gbl-ctors.h"
1547 /* Some systems use __main in a way incompatible with its use in gcc, in these
1548 cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
1549 give the same symbol without quotes for an alternative entry point. You
1550 must define both, or neither. */
1551 #ifndef NAME__MAIN
1552 #define NAME__MAIN "__main"
1553 #define SYMBOL__MAIN __main
1554 #endif
1556 #ifdef INIT_SECTION_ASM_OP
1557 #undef HAS_INIT_SECTION
1558 #define HAS_INIT_SECTION
1559 #endif
1561 #if !defined (HAS_INIT_SECTION) || !defined (OBJECT_FORMAT_ELF)
1563 /* Some ELF crosses use crtstuff.c to provide __CTOR_LIST__, but use this
1564 code to run constructors. In that case, we need to handle EH here, too. */
1566 #ifdef EH_FRAME_SECTION_NAME
1567 #include "unwind-dw2-fde.h"
1568 extern unsigned char __EH_FRAME_BEGIN__[];
1569 #endif
1571 /* Run all the global destructors on exit from the program. */
1573 void
1574 __do_global_dtors (void)
1576 #ifdef DO_GLOBAL_DTORS_BODY
1577 DO_GLOBAL_DTORS_BODY;
1578 #else
1579 static func_ptr *p = __DTOR_LIST__ + 1;
1580 while (*p)
1582 p++;
1583 (*(p-1)) ();
1585 #endif
1586 #if defined (EH_FRAME_SECTION_NAME) && !defined (HAS_INIT_SECTION)
1588 static int completed = 0;
1589 if (! completed)
1591 completed = 1;
1592 __deregister_frame_info (__EH_FRAME_BEGIN__);
1595 #endif
1597 #endif
1599 #ifndef HAS_INIT_SECTION
1600 /* Run all the global constructors on entry to the program. */
1602 void
1603 __do_global_ctors (void)
1605 #ifdef EH_FRAME_SECTION_NAME
1607 static struct object object;
1608 __register_frame_info (__EH_FRAME_BEGIN__, &object);
1610 #endif
1611 DO_GLOBAL_CTORS_BODY;
1612 atexit (__do_global_dtors);
1614 #endif /* no HAS_INIT_SECTION */
1616 #if !defined (HAS_INIT_SECTION) || defined (INVOKE__main)
1617 /* Subroutine called automatically by `main'.
1618 Compiling a global function named `main'
1619 produces an automatic call to this function at the beginning.
1621 For many systems, this routine calls __do_global_ctors.
1622 For systems which support a .init section we use the .init section
1623 to run __do_global_ctors, so we need not do anything here. */
1625 extern void SYMBOL__MAIN (void);
1626 void
1627 SYMBOL__MAIN (void)
1629 /* Support recursive calls to `main': run initializers just once. */
1630 static int initialized;
1631 if (! initialized)
1633 initialized = 1;
1634 __do_global_ctors ();
1637 #endif /* no HAS_INIT_SECTION or INVOKE__main */
1639 #endif /* L__main */
1640 #endif /* __CYGWIN__ */
1642 #ifdef L_ctors
1644 #include "gbl-ctors.h"
1646 /* Provide default definitions for the lists of constructors and
1647 destructors, so that we don't get linker errors. These symbols are
1648 intentionally bss symbols, so that gld and/or collect will provide
1649 the right values. */
1651 /* We declare the lists here with two elements each,
1652 so that they are valid empty lists if no other definition is loaded.
1654 If we are using the old "set" extensions to have the gnu linker
1655 collect ctors and dtors, then we __CTOR_LIST__ and __DTOR_LIST__
1656 must be in the bss/common section.
1658 Long term no port should use those extensions. But many still do. */
1659 #if !defined(INIT_SECTION_ASM_OP) && !defined(CTOR_LISTS_DEFINED_EXTERNALLY)
1660 #if defined (TARGET_ASM_CONSTRUCTOR) || defined (USE_COLLECT2)
1661 func_ptr __CTOR_LIST__[2] = {0, 0};
1662 func_ptr __DTOR_LIST__[2] = {0, 0};
1663 #else
1664 func_ptr __CTOR_LIST__[2];
1665 func_ptr __DTOR_LIST__[2];
1666 #endif
1667 #endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
1668 #endif /* L_ctors */