home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / GNUSRC.Z / libgcc2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-16  |  58.1 KB  |  2,605 lines

  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 Free Software Foundation, Inc.
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA.  */
  21.  
  22. /* As a special exception, if you link this library with other files,
  23.    some of which are compiled with GCC, to produce an executable,
  24.    this library does not by itself cause the resulting executable
  25.    to be covered by the GNU General Public License.
  26.    This exception does not however invalidate any other reasons why
  27.    the executable file might be covered by the GNU General Public License.  */
  28.  
  29. /* It is incorrect to include config.h here, because this file is being
  30.    compiled for the target, and hence definitions concerning only the host
  31.    do not apply.  */
  32.  
  33. #include "tconfig.h"
  34. #include "machmode.h"
  35. #include "defaults.h" 
  36. #ifndef L_trampoline
  37. #include <stddef.h>
  38. #endif
  39. #ifdef SHLIB
  40. #include <libsys/shlib.h>
  41. extern void* malloc (int);
  42. extern int write (int, const char*, int);
  43. extern void free (void*);
  44. #endif
  45.  
  46. /* Don't use `fancy_abort' here even if config.h says to use it.  */
  47. #ifdef abort
  48. #undef abort
  49. #endif
  50.  
  51. #if (SUPPORTS_WEAK == 1) && defined (ASM_OUTPUT_DEF)
  52. #define WEAK_ALIAS
  53. #endif
  54.  
  55. /* Permit the tm.h file to select the endianness to use just for this
  56.    file.  This is used when the endianness is determined when the
  57.    compiler is run.  */
  58.  
  59. #ifndef LIBGCC2_WORDS_BIG_ENDIAN
  60. #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
  61. #endif
  62.  
  63. /* In the first part of this file, we are interfacing to calls generated
  64.    by the compiler itself.  These calls pass values into these routines
  65.    which have very specific modes (rather than very specific types), and
  66.    these compiler-generated calls also expect any return values to have
  67.    very specific modes (rather than very specific types).  Thus, we need
  68.    to avoid using regular C language type names in this part of the file
  69.    because the sizes for those types can be configured to be anything.
  70.    Instead we use the following special type names.  */
  71.  
  72. typedef unsigned int UQItype    __attribute__ ((mode (QI)));
  73. typedef      int SItype    __attribute__ ((mode (SI)));
  74. typedef unsigned int USItype    __attribute__ ((mode (SI)));
  75. typedef         int DItype    __attribute__ ((mode (DI)));
  76. typedef unsigned int UDItype    __attribute__ ((mode (DI)));
  77.  
  78. typedef     float SFtype    __attribute__ ((mode (SF)));
  79. typedef        float DFtype    __attribute__ ((mode (DF)));
  80.  
  81. #if LONG_DOUBLE_TYPE_SIZE == 96
  82. typedef        float XFtype    __attribute__ ((mode (XF)));
  83. #endif
  84. #if LONG_DOUBLE_TYPE_SIZE == 128
  85. typedef        float TFtype    __attribute__ ((mode (TF)));
  86. #endif
  87.  
  88. typedef int word_type __attribute__ ((mode (__word__)));
  89.  
  90. /* Make sure that we don't accidentally use any normal C language built-in
  91.    type names in the first part of this file.  Instead we want to use *only*
  92.    the type names defined above.  The following macro definitions insure
  93.    that if we *do* accidentally use some normal C language built-in type name,
  94.    we will get a syntax error.  */
  95.  
  96. #define char bogus_type
  97. #define short bogus_type
  98. #define int bogus_type
  99. #define long bogus_type
  100. #define unsigned bogus_type
  101. #define float bogus_type
  102. #define double bogus_type
  103.  
  104. #define SI_TYPE_SIZE (sizeof (SItype) * BITS_PER_UNIT)
  105.  
  106. /* DIstructs are pairs of SItype values in the order determined by
  107.    LIBGCC2_WORDS_BIG_ENDIAN.  */
  108.  
  109. #if LIBGCC2_WORDS_BIG_ENDIAN
  110.   struct DIstruct {SItype high, low;};
  111. #else
  112.   struct DIstruct {SItype low, high;};
  113. #endif
  114.  
  115. /* We need this union to unpack/pack DImode values, since we don't have
  116.    any arithmetic yet.  Incoming DImode parameters are stored into the
  117.    `ll' field, and the unpacked result is read from the struct `s'.  */
  118.  
  119. typedef union
  120. {
  121.   struct DIstruct s;
  122.   DItype ll;
  123. } DIunion;
  124.  
  125. #if (defined (L_udivmoddi4) || defined (L_muldi3) || defined (L_udiv_w_sdiv)\
  126.      || defined (L_divdi3) || defined (L_udivdi3) \
  127.      || defined (L_moddi3) || defined (L_umoddi3))
  128.  
  129. #include "longlong.h"
  130.  
  131. #endif /* udiv or mul */
  132.  
  133. extern DItype __fixunssfdi (SFtype a);
  134. extern DItype __fixunsdfdi (DFtype a);
  135. #if LONG_DOUBLE_TYPE_SIZE == 96
  136. extern DItype __fixunsxfdi (XFtype a);
  137. #endif
  138. #if LONG_DOUBLE_TYPE_SIZE == 128
  139. extern DItype __fixunstfdi (TFtype a);
  140. #endif
  141.  
  142. #if defined (L_negdi2) || defined (L_divdi3) || defined (L_moddi3)
  143. #if defined (L_divdi3) || defined (L_moddi3)
  144. static inline
  145. #endif
  146. DItype
  147. __negdi2 (u)
  148.      DItype u;
  149. {
  150.   DIunion w;
  151.   DIunion uu;
  152.  
  153.   uu.ll = u;
  154.  
  155.   w.s.low = -uu.s.low;
  156.   w.s.high = -uu.s.high - ((USItype) w.s.low > 0);
  157.  
  158.   return w.ll;
  159. }
  160. #endif
  161.  
  162. #ifdef L_lshrdi3
  163. DItype
  164. __lshrdi3 (u, b)
  165.      DItype u;
  166.      word_type b;
  167. {
  168.   DIunion w;
  169.   word_type bm;
  170.   DIunion uu;
  171.  
  172.   if (b == 0)
  173.     return u;
  174.  
  175.   uu.ll = u;
  176.  
  177.   bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
  178.   if (bm <= 0)
  179.     {
  180.       w.s.high = 0;
  181.       w.s.low = (USItype)uu.s.high >> -bm;
  182.     }
  183.   else
  184.     {
  185.       USItype carries = (USItype)uu.s.high << bm;
  186.       w.s.high = (USItype)uu.s.high >> b;
  187.       w.s.low = ((USItype)uu.s.low >> b) | carries;
  188.     }
  189.  
  190.   return w.ll;
  191. }
  192. #endif
  193.  
  194. #ifdef L_ashldi3
  195. DItype
  196. __ashldi3 (u, b)
  197.      DItype u;
  198.      word_type b;
  199. {
  200.   DIunion w;
  201.   word_type bm;
  202.   DIunion uu;
  203.  
  204.   if (b == 0)
  205.     return u;
  206.  
  207.   uu.ll = u;
  208.  
  209.   bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
  210.   if (bm <= 0)
  211.     {
  212.       w.s.low = 0;
  213.       w.s.high = (USItype)uu.s.low << -bm;
  214.     }
  215.   else
  216.     {
  217.       USItype carries = (USItype)uu.s.low >> bm;
  218.       w.s.low = (USItype)uu.s.low << b;
  219.       w.s.high = ((USItype)uu.s.high << b) | carries;
  220.     }
  221.  
  222.   return w.ll;
  223. }
  224. #endif
  225.  
  226. #ifdef L_ashrdi3
  227. DItype
  228. __ashrdi3 (u, b)
  229.      DItype u;
  230.      word_type b;
  231. {
  232.   DIunion w;
  233.   word_type bm;
  234.   DIunion uu;
  235.  
  236.   if (b == 0)
  237.     return u;
  238.  
  239.   uu.ll = u;
  240.  
  241.   bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
  242.   if (bm <= 0)
  243.     {
  244.       /* w.s.high = 1..1 or 0..0 */
  245.       w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
  246.       w.s.low = uu.s.high >> -bm;
  247.     }
  248.   else
  249.     {
  250.       USItype carries = (USItype)uu.s.high << bm;
  251.       w.s.high = uu.s.high >> b;
  252.       w.s.low = ((USItype)uu.s.low >> b) | carries;
  253.     }
  254.  
  255.   return w.ll;
  256. }
  257. #endif
  258.  
  259. #ifdef L_ffsdi2
  260. DItype
  261. __ffsdi2 (u)
  262.      DItype u;
  263. {
  264.   DIunion uu, w;
  265.   uu.ll = u;
  266.   w.s.high = 0;
  267.   w.s.low = ffs (uu.s.low);
  268.   if (w.s.low != 0)
  269.     return w.ll;
  270.   w.s.low = ffs (uu.s.high);
  271.   if (w.s.low != 0)
  272.     {
  273.       w.s.low += BITS_PER_UNIT * sizeof (SItype);
  274.       return w.ll;
  275.     }
  276.   return w.ll;
  277. }
  278. #endif
  279.  
  280. #ifdef L_muldi3
  281. DItype
  282. __muldi3 (u, v)
  283.      DItype u, v;
  284. {
  285.   DIunion w;
  286.   DIunion uu, vv;
  287.  
  288.   uu.ll = u,
  289.   vv.ll = v;
  290.  
  291.   w.ll = __umulsidi3 (uu.s.low, vv.s.low);
  292.   w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
  293.            + (USItype) uu.s.high * (USItype) vv.s.low);
  294.  
  295.   return w.ll;
  296. }
  297. #endif
  298.  
  299. #ifdef L_udiv_w_sdiv
  300. #if defined (sdiv_qrnnd)
  301. USItype
  302. __udiv_w_sdiv (rp, a1, a0, d)
  303.      USItype *rp, a1, a0, d;
  304. {
  305.   USItype q, r;
  306.   USItype c0, c1, b1;
  307.  
  308.   if ((SItype) d >= 0)
  309.     {
  310.       if (a1 < d - a1 - (a0 >> (SI_TYPE_SIZE - 1)))
  311.     {
  312.       /* dividend, divisor, and quotient are nonnegative */
  313.       sdiv_qrnnd (q, r, a1, a0, d);
  314.     }
  315.       else
  316.     {
  317.       /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */
  318.       sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (SI_TYPE_SIZE - 1));
  319.       /* Divide (c1*2^32 + c0) by d */
  320.       sdiv_qrnnd (q, r, c1, c0, d);
  321.       /* Add 2^31 to quotient */
  322.       q += (USItype) 1 << (SI_TYPE_SIZE - 1);
  323.     }
  324.     }
  325.   else
  326.     {
  327.       b1 = d >> 1;            /* d/2, between 2^30 and 2^31 - 1 */
  328.       c1 = a1 >> 1;            /* A/2 */
  329.       c0 = (a1 << (SI_TYPE_SIZE - 1)) + (a0 >> 1);
  330.  
  331.       if (a1 < b1)            /* A < 2^32*b1, so A/2 < 2^31*b1 */
  332.     {
  333.       sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */
  334.  
  335.       r = 2*r + (a0 & 1);        /* Remainder from A/(2*b1) */
  336.       if ((d & 1) != 0)
  337.         {
  338.           if (r >= q)
  339.         r = r - q;
  340.           else if (q - r <= d)
  341.         {
  342.           r = r - q + d;
  343.           q--;
  344.         }
  345.           else
  346.         {
  347.           r = r - q + 2*d;
  348.           q -= 2;
  349.         }
  350.         }
  351.     }
  352.       else if (c1 < b1)            /* So 2^31 <= (A/2)/b1 < 2^32 */
  353.     {
  354.       c1 = (b1 - 1) - c1;
  355.       c0 = ~c0;            /* logical NOT */
  356.  
  357.       sdiv_qrnnd (q, r, c1, c0, b1); /* (A/2) / (d/2) */
  358.  
  359.       q = ~q;            /* (A/2)/b1 */
  360.       r = (b1 - 1) - r;
  361.  
  362.       r = 2*r + (a0 & 1);        /* A/(2*b1) */
  363.  
  364.       if ((d & 1) != 0)
  365.         {
  366.           if (r >= q)
  367.         r = r - q;
  368.           else if (q - r <= d)
  369.         {
  370.           r = r - q + d;
  371.           q--;
  372.         }
  373.           else
  374.         {
  375.           r = r - q + 2*d;
  376.           q -= 2;
  377.         }
  378.         }
  379.     }
  380.       else                /* Implies c1 = b1 */
  381.     {                /* Hence a1 = d - 1 = 2*b1 - 1 */
  382.       if (a0 >= -d)
  383.         {
  384.           q = -1;
  385.           r = a0 + d;
  386.         }
  387.       else
  388.         {
  389.           q = -2;
  390.           r = a0 + 2*d;
  391.         }
  392.     }
  393.     }
  394.  
  395.   *rp = r;
  396.   return q;
  397. }
  398. #else
  399. /* If sdiv_qrnnd doesn't exist, define dummy __udiv_w_sdiv.  */
  400. USItype
  401. __udiv_w_sdiv (rp, a1, a0, d)
  402.      USItype *rp, a1, a0, d;
  403. {}
  404. #endif
  405. #endif
  406.  
  407. #if (defined (L_udivdi3) || defined (L_divdi3) || \
  408.      defined (L_umoddi3) || defined (L_moddi3))
  409. #define L_udivmoddi4
  410. #endif
  411.  
  412. #ifdef L_udivmoddi4
  413. static const UQItype __clz_tab[] =
  414. {
  415.   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,
  416.   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,
  417.   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,
  418.   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,
  419.   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,
  420.   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,
  421.   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,
  422.   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,
  423. };
  424.  
  425. #if (defined (L_udivdi3) || defined (L_divdi3) || \
  426.      defined (L_umoddi3) || defined (L_moddi3))
  427. static inline
  428. #endif
  429. UDItype
  430. __udivmoddi4 (n, d, rp)
  431.      UDItype n, d;
  432.      UDItype *rp;
  433. {
  434.   DIunion ww;
  435.   DIunion nn, dd;
  436.   DIunion rr;
  437.   USItype d0, d1, n0, n1, n2;
  438.   USItype q0, q1;
  439.   USItype b, bm;
  440.  
  441.   nn.ll = n;
  442.   dd.ll = d;
  443.  
  444.   d0 = dd.s.low;
  445.   d1 = dd.s.high;
  446.   n0 = nn.s.low;
  447.   n1 = nn.s.high;
  448.  
  449. #if !UDIV_NEEDS_NORMALIZATION
  450.   if (d1 == 0)
  451.     {
  452.       if (d0 > n1)
  453.     {
  454.       /* 0q = nn / 0D */
  455.  
  456.       udiv_qrnnd (q0, n0, n1, n0, d0);
  457.       q1 = 0;
  458.  
  459.       /* Remainder in n0.  */
  460.     }
  461.       else
  462.     {
  463.       /* qq = NN / 0d */
  464.  
  465.       if (d0 == 0)
  466.         d0 = 1 / d0;    /* Divide intentionally by zero.  */
  467.  
  468.       udiv_qrnnd (q1, n1, 0, n1, d0);
  469.       udiv_qrnnd (q0, n0, n1, n0, d0);
  470.  
  471.       /* Remainder in n0.  */
  472.     }
  473.  
  474.       if (rp != 0)
  475.     {
  476.       rr.s.low = n0;
  477.       rr.s.high = 0;
  478.       *rp = rr.ll;
  479.     }
  480.     }
  481.  
  482. #else /* UDIV_NEEDS_NORMALIZATION */
  483.  
  484.   if (d1 == 0)
  485.     {
  486.       if (d0 > n1)
  487.     {
  488.       /* 0q = nn / 0D */
  489.  
  490.       count_leading_zeros (bm, d0);
  491.  
  492.       if (bm != 0)
  493.         {
  494.           /* Normalize, i.e. make the most significant bit of the
  495.          denominator set.  */
  496.  
  497.           d0 = d0 << bm;
  498.           n1 = (n1 << bm) | (n0 >> (SI_TYPE_SIZE - bm));
  499.           n0 = n0 << bm;
  500.         }
  501.  
  502.       udiv_qrnnd (q0, n0, n1, n0, d0);
  503.       q1 = 0;
  504.  
  505.       /* Remainder in n0 >> bm.  */
  506.     }
  507.       else
  508.     {
  509.       /* qq = NN / 0d */
  510.  
  511.       if (d0 == 0)
  512.         d0 = 1 / d0;    /* Divide intentionally by zero.  */
  513.  
  514.       count_leading_zeros (bm, d0);
  515.  
  516.       if (bm == 0)
  517.         {
  518.           /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
  519.          conclude (the most significant bit of n1 is set) /\ (the
  520.          leading quotient digit q1 = 1).
  521.  
  522.          This special case is necessary, not an optimization.
  523.          (Shifts counts of SI_TYPE_SIZE are undefined.)  */
  524.  
  525.           n1 -= d0;
  526.           q1 = 1;
  527.         }
  528.       else
  529.         {
  530.           /* Normalize.  */
  531.  
  532.           b = SI_TYPE_SIZE - bm;
  533.  
  534.           d0 = d0 << bm;
  535.           n2 = n1 >> b;
  536.           n1 = (n1 << bm) | (n0 >> b);
  537.           n0 = n0 << bm;
  538.  
  539.           udiv_qrnnd (q1, n1, n2, n1, d0);
  540.         }
  541.  
  542.       /* n1 != d0... */
  543.  
  544.       udiv_qrnnd (q0, n0, n1, n0, d0);
  545.  
  546.       /* Remainder in n0 >> bm.  */
  547.     }
  548.  
  549.       if (rp != 0)
  550.     {
  551.       rr.s.low = n0 >> bm;
  552.       rr.s.high = 0;
  553.       *rp = rr.ll;
  554.     }
  555.     }
  556. #endif /* UDIV_NEEDS_NORMALIZATION */
  557.  
  558.   else
  559.     {
  560.       if (d1 > n1)
  561.     {
  562.       /* 00 = nn / DD */
  563.  
  564.       q0 = 0;
  565.       q1 = 0;
  566.  
  567.       /* Remainder in n1n0.  */
  568.       if (rp != 0)
  569.         {
  570.           rr.s.low = n0;
  571.           rr.s.high = n1;
  572.           *rp = rr.ll;
  573.         }
  574.     }
  575.       else
  576.     {
  577.       /* 0q = NN / dd */
  578.  
  579.       count_leading_zeros (bm, d1);
  580.       if (bm == 0)
  581.         {
  582.           /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
  583.          conclude (the most significant bit of n1 is set) /\ (the
  584.          quotient digit q0 = 0 or 1).
  585.  
  586.          This special case is necessary, not an optimization.  */
  587.  
  588.           /* The condition on the next line takes advantage of that
  589.          n1 >= d1 (true due to program flow).  */
  590.           if (n1 > d1 || n0 >= d0)
  591.         {
  592.           q0 = 1;
  593.           sub_ddmmss (n1, n0, n1, n0, d1, d0);
  594.         }
  595.           else
  596.         q0 = 0;
  597.  
  598.           q1 = 0;
  599.  
  600.           if (rp != 0)
  601.         {
  602.           rr.s.low = n0;
  603.           rr.s.high = n1;
  604.           *rp = rr.ll;
  605.         }
  606.         }
  607.       else
  608.         {
  609.           USItype m1, m0;
  610.           /* Normalize.  */
  611.  
  612.           b = SI_TYPE_SIZE - bm;
  613.  
  614.           d1 = (d1 << bm) | (d0 >> b);
  615.           d0 = d0 << bm;
  616.           n2 = n1 >> b;
  617.           n1 = (n1 << bm) | (n0 >> b);
  618.           n0 = n0 << bm;
  619.  
  620.           udiv_qrnnd (q0, n1, n2, n1, d1);
  621.           umul_ppmm (m1, m0, q0, d0);
  622.  
  623.           if (m1 > n1 || (m1 == n1 && m0 > n0))
  624.         {
  625.           q0--;
  626.           sub_ddmmss (m1, m0, m1, m0, d1, d0);
  627.         }
  628.  
  629.           q1 = 0;
  630.  
  631.           /* Remainder in (n1n0 - m1m0) >> bm.  */
  632.           if (rp != 0)
  633.         {
  634.           sub_ddmmss (n1, n0, n1, n0, m1, m0);
  635.           rr.s.low = (n1 << b) | (n0 >> bm);
  636.           rr.s.high = n1 >> bm;
  637.           *rp = rr.ll;
  638.         }
  639.         }
  640.     }
  641.     }
  642.  
  643.   ww.s.low = q0;
  644.   ww.s.high = q1;
  645.   return ww.ll;
  646. }
  647. #endif
  648.  
  649. #ifdef L_divdi3
  650. UDItype __udivmoddi4 ();
  651.  
  652. DItype
  653. __divdi3 (u, v)
  654.      DItype u, v;
  655. {
  656.   word_type c = 0;
  657.   DIunion uu, vv;
  658.   DItype w;
  659.  
  660.   uu.ll = u;
  661.   vv.ll = v;
  662.  
  663.   if (uu.s.high < 0)
  664.     c = ~c,
  665.     uu.ll = __negdi2 (uu.ll);
  666.   if (vv.s.high < 0)
  667.     c = ~c,
  668.     vv.ll = __negdi2 (vv.ll);
  669.  
  670.   w = __udivmoddi4 (uu.ll, vv.ll, (UDItype *) 0);
  671.   if (c)
  672.     w = __negdi2 (w);
  673.  
  674.   return w;
  675. }
  676. #endif
  677.  
  678. #ifdef L_moddi3
  679. UDItype __udivmoddi4 ();
  680. DItype
  681. __moddi3 (u, v)
  682.      DItype u, v;
  683. {
  684.   word_type c = 0;
  685.   DIunion uu, vv;
  686.   DItype w;
  687.  
  688.   uu.ll = u;
  689.   vv.ll = v;
  690.  
  691.   if (uu.s.high < 0)
  692.     c = ~c,
  693.     uu.ll = __negdi2 (uu.ll);
  694.   if (vv.s.high < 0)
  695.     vv.ll = __negdi2 (vv.ll);
  696.  
  697.   (void) __udivmoddi4 (uu.ll, vv.ll, &w);
  698.   if (c)
  699.     w = __negdi2 (w);
  700.  
  701.   return w;
  702. }
  703. #endif
  704.  
  705. #ifdef L_umoddi3
  706. UDItype __udivmoddi4 ();
  707. UDItype
  708. __umoddi3 (u, v)
  709.      UDItype u, v;
  710. {
  711.   UDItype w;
  712.  
  713.   (void) __udivmoddi4 (u, v, &w);
  714.  
  715.   return w;
  716. }
  717. #endif
  718.  
  719. #ifdef L_udivdi3
  720. UDItype __udivmoddi4 ();
  721. UDItype
  722. __udivdi3 (n, d)
  723.      UDItype n, d;
  724. {
  725.   return __udivmoddi4 (n, d, (UDItype *) 0);
  726. }
  727. #endif
  728.  
  729. #ifdef L_cmpdi2
  730. word_type
  731. __cmpdi2 (a, b)
  732.      DItype a, b;
  733. {
  734.   DIunion au, bu;
  735.  
  736.   au.ll = a, bu.ll = b;
  737.  
  738.   if (au.s.high < bu.s.high)
  739.     return 0;
  740.   else if (au.s.high > bu.s.high)
  741.     return 2;
  742.   if ((USItype) au.s.low < (USItype) bu.s.low)
  743.     return 0;
  744.   else if ((USItype) au.s.low > (USItype) bu.s.low)
  745.     return 2;
  746.   return 1;
  747. }
  748. #endif
  749.  
  750. #ifdef L_ucmpdi2
  751. word_type
  752. __ucmpdi2 (a, b)
  753.      DItype a, b;
  754. {
  755.   DIunion au, bu;
  756.  
  757.   au.ll = a, bu.ll = b;
  758.  
  759.   if ((USItype) au.s.high < (USItype) bu.s.high)
  760.     return 0;
  761.   else if ((USItype) au.s.high > (USItype) bu.s.high)
  762.     return 2;
  763.   if ((USItype) au.s.low < (USItype) bu.s.low)
  764.     return 0;
  765.   else if ((USItype) au.s.low > (USItype) bu.s.low)
  766.     return 2;
  767.   return 1;
  768. }
  769. #endif
  770.  
  771. #if defined(L_fixunstfdi) && (LONG_DOUBLE_TYPE_SIZE == 128)
  772. #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
  773. #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
  774.  
  775. DItype
  776. __fixunstfdi (a)
  777.      TFtype a;
  778. {
  779.   TFtype b;
  780.   UDItype v;
  781.  
  782.   if (a < 0)
  783.     return 0;
  784.  
  785.   /* Compute high word of result, as a flonum.  */
  786.   b = (a / HIGH_WORD_COEFF);
  787.   /* Convert that to fixed (but not to DItype!),
  788.      and shift it into the high word.  */
  789.   v = (USItype) b;
  790.   v <<= WORD_SIZE;
  791.   /* Remove high part from the TFtype, leaving the low part as flonum.  */
  792.   a -= (TFtype)v;
  793.   /* Convert that to fixed (but not to DItype!) and add it in.
  794.      Sometimes A comes out negative.  This is significant, since
  795.      A has more bits than a long int does.  */
  796.   if (a < 0)
  797.     v -= (USItype) (- a);
  798.   else
  799.     v += (USItype) a;
  800.   return v;
  801. }
  802. #endif
  803.  
  804. #if defined(L_fixtfdi) && (LONG_DOUBLE_TYPE_SIZE == 128)
  805. DItype
  806. __fixtfdi (a)
  807.      TFtype a;
  808. {
  809.   if (a < 0)
  810.     return - __fixunstfdi (-a);
  811.   return __fixunstfdi (a);
  812. }
  813. #endif
  814.  
  815. #if defined(L_fixunsxfdi) && (LONG_DOUBLE_TYPE_SIZE == 96)
  816. #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
  817. #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
  818.  
  819. DItype
  820. __fixunsxfdi (a)
  821.      XFtype a;
  822. {
  823.   XFtype b;
  824.   UDItype v;
  825.  
  826.   if (a < 0)
  827.     return 0;
  828.  
  829.   /* Compute high word of result, as a flonum.  */
  830.   b = (a / HIGH_WORD_COEFF);
  831.   /* Convert that to fixed (but not to DItype!),
  832.      and shift it into the high word.  */
  833.   v = (USItype) b;
  834.   v <<= WORD_SIZE;
  835.   /* Remove high part from the XFtype, leaving the low part as flonum.  */
  836.   a -= (XFtype)v;
  837.   /* Convert that to fixed (but not to DItype!) and add it in.
  838.      Sometimes A comes out negative.  This is significant, since
  839.      A has more bits than a long int does.  */
  840.   if (a < 0)
  841.     v -= (USItype) (- a);
  842.   else
  843.     v += (USItype) a;
  844.   return v;
  845. }
  846. #endif
  847.  
  848. #if defined(L_fixxfdi) && (LONG_DOUBLE_TYPE_SIZE == 96)
  849. DItype
  850. __fixxfdi (a)
  851.      XFtype a;
  852. {
  853.   if (a < 0)
  854.     return - __fixunsxfdi (-a);
  855.   return __fixunsxfdi (a);
  856. }
  857. #endif
  858.  
  859. #ifdef L_fixunsdfdi
  860. #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
  861. #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
  862.  
  863. DItype
  864. __fixunsdfdi (a)
  865.      DFtype a;
  866. {
  867.   DFtype b;
  868.   UDItype v;
  869.  
  870.   if (a < 0)
  871.     return 0;
  872.  
  873.   /* Compute high word of result, as a flonum.  */
  874.   b = (a / HIGH_WORD_COEFF);
  875.   /* Convert that to fixed (but not to DItype!),
  876.      and shift it into the high word.  */
  877.   v = (USItype) b;
  878.   v <<= WORD_SIZE;
  879.   /* Remove high part from the DFtype, leaving the low part as flonum.  */
  880.   a -= (DFtype)v;
  881.   /* Convert that to fixed (but not to DItype!) and add it in.
  882.      Sometimes A comes out negative.  This is significant, since
  883.      A has more bits than a long int does.  */
  884.   if (a < 0)
  885.     v -= (USItype) (- a);
  886.   else
  887.     v += (USItype) a;
  888.   return v;
  889. }
  890. #endif
  891.  
  892. #ifdef L_fixdfdi
  893. DItype
  894. __fixdfdi (a)
  895.      DFtype a;
  896. {
  897.   if (a < 0)
  898.     return - __fixunsdfdi (-a);
  899.   return __fixunsdfdi (a);
  900. }
  901. #endif
  902.  
  903. #ifdef L_fixunssfdi
  904. #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
  905. #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
  906.  
  907. DItype
  908. __fixunssfdi (SFtype original_a)
  909. {
  910.   /* Convert the SFtype to a DFtype, because that is surely not going
  911.      to lose any bits.  Some day someone else can write a faster version
  912.      that avoids converting to DFtype, and verify it really works right.  */
  913.   DFtype a = original_a;
  914.   DFtype b;
  915.   UDItype v;
  916.  
  917.   if (a < 0)
  918.     return 0;
  919.  
  920.   /* Compute high word of result, as a flonum.  */
  921.   b = (a / HIGH_WORD_COEFF);
  922.   /* Convert that to fixed (but not to DItype!),
  923.      and shift it into the high word.  */
  924.   v = (USItype) b;
  925.   v <<= WORD_SIZE;
  926.   /* Remove high part from the DFtype, leaving the low part as flonum.  */
  927.   a -= (DFtype)v;
  928.   /* Convert that to fixed (but not to DItype!) and add it in.
  929.      Sometimes A comes out negative.  This is significant, since
  930.      A has more bits than a long int does.  */
  931.   if (a < 0)
  932.     v -= (USItype) (- a);
  933.   else
  934.     v += (USItype) a;
  935.   return v;
  936. }
  937. #endif
  938.  
  939. #ifdef L_fixsfdi
  940. DItype
  941. __fixsfdi (SFtype a)
  942. {
  943.   if (a < 0)
  944.     return - __fixunssfdi (-a);
  945.   return __fixunssfdi (a);
  946. }
  947. #endif
  948.  
  949. #if defined(L_floatdixf) && (LONG_DOUBLE_TYPE_SIZE == 96)
  950. #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
  951. #define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
  952. #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
  953.  
  954. XFtype
  955. __floatdixf (u)
  956.      DItype u;
  957. {
  958.   XFtype d;
  959.   SItype negate = 0;
  960.  
  961.   if (u < 0)
  962.     u = -u, negate = 1;
  963.  
  964.   d = (USItype) (u >> WORD_SIZE);
  965.   d *= HIGH_HALFWORD_COEFF;
  966.   d *= HIGH_HALFWORD_COEFF;
  967.   d += (USItype) (u & (HIGH_WORD_COEFF - 1));
  968.  
  969.   return (negate ? -d : d);
  970. }
  971. #endif
  972.  
  973. #if defined(L_floatditf) && (LONG_DOUBLE_TYPE_SIZE == 128)
  974. #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
  975. #define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
  976. #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
  977.  
  978. TFtype
  979. __floatditf (u)
  980.      DItype u;
  981. {
  982.   TFtype d;
  983.   SItype negate = 0;
  984.  
  985.   if (u < 0)
  986.     u = -u, negate = 1;
  987.  
  988.   d = (USItype) (u >> WORD_SIZE);
  989.   d *= HIGH_HALFWORD_COEFF;
  990.   d *= HIGH_HALFWORD_COEFF;
  991.   d += (USItype) (u & (HIGH_WORD_COEFF - 1));
  992.  
  993.   return (negate ? -d : d);
  994. }
  995. #endif
  996.  
  997. #ifdef L_floatdidf
  998. #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
  999. #define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
  1000. #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
  1001.  
  1002. DFtype
  1003. __floatdidf (u)
  1004.      DItype u;
  1005. {
  1006.   DFtype d;
  1007.   SItype negate = 0;
  1008.  
  1009.   if (u < 0)
  1010.     u = -u, negate = 1;
  1011.  
  1012.   d = (USItype) (u >> WORD_SIZE);
  1013.   d *= HIGH_HALFWORD_COEFF;
  1014.   d *= HIGH_HALFWORD_COEFF;
  1015.   d += (USItype) (u & (HIGH_WORD_COEFF - 1));
  1016.  
  1017.   return (negate ? -d : d);
  1018. }
  1019. #endif
  1020.  
  1021. #ifdef L_floatdisf
  1022. #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
  1023. #define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
  1024. #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
  1025. #define DI_SIZE (sizeof (DItype) * BITS_PER_UNIT)
  1026.  
  1027. /* Define codes for all the float formats that we know of.  Note
  1028.    that this is copied from real.h.  */
  1029.    
  1030. #define UNKNOWN_FLOAT_FORMAT 0
  1031. #define IEEE_FLOAT_FORMAT 1
  1032. #define VAX_FLOAT_FORMAT 2
  1033. #define IBM_FLOAT_FORMAT 3
  1034.  
  1035. /* Default to IEEE float if not specified.  Nearly all machines use it.  */
  1036. #ifndef HOST_FLOAT_FORMAT
  1037. #define    HOST_FLOAT_FORMAT    IEEE_FLOAT_FORMAT
  1038. #endif
  1039.  
  1040. #if HOST_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
  1041. #define DF_SIZE 53
  1042. #define SF_SIZE 24
  1043. #endif
  1044.  
  1045. #if HOST_FLOAT_FORMAT == IBM_FLOAT_FORMAT
  1046. #define DF_SIZE 56
  1047. #define SF_SIZE 24
  1048. #endif
  1049.  
  1050. #if HOST_FLOAT_FORMAT == VAX_FLOAT_FORMAT
  1051. #define DF_SIZE 56
  1052. #define SF_SIZE 24
  1053. #endif
  1054.  
  1055. SFtype
  1056. __floatdisf (u)
  1057.      DItype u;
  1058. {
  1059.   /* Do the calculation in DFmode
  1060.      so that we don't lose any of the precision of the high word
  1061.      while multiplying it.  */
  1062.   DFtype f;
  1063.   SItype negate = 0;
  1064.  
  1065.   if (u < 0)
  1066.     u = -u, negate = 1;
  1067.  
  1068.   /* Protect against double-rounding error.
  1069.      Represent any low-order bits, that might be truncated in DFmode,
  1070.      by a bit that won't be lost.  The bit can go in anywhere below the
  1071.      rounding position of the SFmode.  A fixed mask and bit position
  1072.      handles all usual configurations.  It doesn't handle the case
  1073.      of 128-bit DImode, however.  */
  1074.   if (DF_SIZE < DI_SIZE
  1075.       && DF_SIZE > (DI_SIZE - DF_SIZE + SF_SIZE))
  1076.     {
  1077. #define REP_BIT ((USItype) 1 << (DI_SIZE - DF_SIZE))
  1078.       if (u >= ((UDItype) 1 << DF_SIZE))
  1079.     {
  1080.       if ((USItype) u & (REP_BIT - 1))
  1081.         u |= REP_BIT;
  1082.     }
  1083.     }
  1084.   f = (USItype) (u >> WORD_SIZE);
  1085.   f *= HIGH_HALFWORD_COEFF;
  1086.   f *= HIGH_HALFWORD_COEFF;
  1087.   f += (USItype) (u & (HIGH_WORD_COEFF - 1));
  1088.  
  1089.   return (SFtype) (negate ? -f : f);
  1090. }
  1091. #endif
  1092.  
  1093. #if defined(L_fixunsxfsi) && LONG_DOUBLE_TYPE_SIZE == 96
  1094. /* Reenable the normal types, in case limits.h needs them.  */
  1095. #undef char
  1096. #undef short
  1097. #undef int
  1098. #undef long
  1099. #undef unsigned
  1100. #undef float
  1101. #undef double
  1102. #undef MIN
  1103. #undef MAX
  1104. #include <limits.h>
  1105.  
  1106. USItype
  1107. __fixunsxfsi (a)
  1108.      XFtype a;
  1109. {
  1110.   if (a >= - (DFtype) LONG_MIN)
  1111.     return (SItype) (a + LONG_MIN) - LONG_MIN;
  1112.   return (SItype) a;
  1113. }
  1114. #endif
  1115.  
  1116. #ifdef L_fixunsdfsi
  1117. /* Reenable the normal types, in case limits.h needs them.  */
  1118. #undef char
  1119. #undef short
  1120. #undef int
  1121. #undef long
  1122. #undef unsigned
  1123. #undef float
  1124. #undef double
  1125. #undef MIN
  1126. #undef MAX
  1127. #include <limits.h>
  1128.  
  1129. USItype
  1130. __fixunsdfsi (a)
  1131.      DFtype a;
  1132. {
  1133.   if (a >= - (DFtype) LONG_MIN)
  1134.     return (SItype) (a + LONG_MIN) - LONG_MIN;
  1135.   return (SItype) a;
  1136. }
  1137. #endif
  1138.  
  1139. #ifdef L_fixunssfsi
  1140. /* Reenable the normal types, in case limits.h needs them.  */
  1141. #undef char
  1142. #undef short
  1143. #undef int
  1144. #undef long
  1145. #undef unsigned
  1146. #undef float
  1147. #undef double
  1148. #undef MIN
  1149. #undef MAX
  1150. #include <limits.h>
  1151.  
  1152. USItype
  1153. __fixunssfsi (SFtype a)
  1154. {
  1155.   if (a >= - (SFtype) LONG_MIN)
  1156.     return (SItype) (a + LONG_MIN) - LONG_MIN;
  1157.   return (SItype) a;
  1158. }
  1159. #endif
  1160.  
  1161. /* From here on down, the routines use normal data types.  */
  1162.  
  1163. #define SItype bogus_type
  1164. #define USItype bogus_type
  1165. #define DItype bogus_type
  1166. #define UDItype bogus_type
  1167. #define SFtype bogus_type
  1168. #define DFtype bogus_type
  1169.  
  1170. #undef char
  1171. #undef short
  1172. #undef int
  1173. #undef long
  1174. #undef unsigned
  1175. #undef float
  1176. #undef double
  1177.  
  1178. #ifdef L__gcc_bcmp
  1179.  
  1180. /* Like bcmp except the sign is meaningful.
  1181.    Result is negative if S1 is less than S2,
  1182.    positive if S1 is greater, 0 if S1 and S2 are equal.  */
  1183.  
  1184. int
  1185. __gcc_bcmp (s1, s2, size)
  1186.      unsigned char *s1, *s2;
  1187.      size_t size;
  1188. {
  1189.   while (size > 0)
  1190.     {
  1191.       unsigned char c1 = *s1++, c2 = *s2++;
  1192.       if (c1 != c2)
  1193.     return c1 - c2;
  1194.       size--;
  1195.     }
  1196.   return 0;
  1197. }
  1198.  
  1199. #endif
  1200.  
  1201. #ifdef L_varargs
  1202. #ifdef __i860__
  1203. #if defined(__svr4__) || defined(__alliant__)
  1204.     asm ("    .text");
  1205.     asm ("    .align    4");
  1206.  
  1207. /* The Alliant needs the added underscore.  */
  1208.     asm (".globl    __builtin_saveregs");
  1209. asm ("__builtin_saveregs:");
  1210.     asm (".globl    ___builtin_saveregs");
  1211. asm ("___builtin_saveregs:");
  1212.  
  1213.         asm ("    andnot    0x0f,%sp,%sp");    /* round down to 16-byte boundary */
  1214.     asm ("    adds    -96,%sp,%sp");  /* allocate stack space for reg save
  1215.                        area and also for a new va_list
  1216.                        structure */
  1217.     /* Save all argument registers in the arg reg save area.  The
  1218.        arg reg save area must have the following layout (according
  1219.        to the svr4 ABI):
  1220.  
  1221.         struct {
  1222.           union  {
  1223.             float freg[8];
  1224.             double dreg[4];
  1225.           } float_regs;
  1226.           long    ireg[12];
  1227.         };
  1228.     */
  1229.  
  1230.     asm ("    fst.q    %f8,  0(%sp)"); /* save floating regs (f8-f15)  */
  1231.     asm ("    fst.q    %f12,16(%sp)"); 
  1232.  
  1233.     asm ("    st.l    %r16,32(%sp)"); /* save integer regs (r16-r27) */
  1234.     asm ("    st.l    %r17,36(%sp)"); 
  1235.     asm ("    st.l    %r18,40(%sp)");
  1236.     asm ("    st.l    %r19,44(%sp)");
  1237.     asm ("    st.l    %r20,48(%sp)");
  1238.     asm ("    st.l    %r21,52(%sp)");
  1239.     asm ("    st.l    %r22,56(%sp)");
  1240.     asm ("    st.l    %r23,60(%sp)");
  1241.     asm ("    st.l    %r24,64(%sp)");
  1242.     asm ("    st.l    %r25,68(%sp)");
  1243.     asm ("    st.l    %r26,72(%sp)");
  1244.     asm ("    st.l    %r27,76(%sp)");
  1245.  
  1246.     asm ("    adds    80,%sp,%r16");  /* compute the address of the new
  1247.                        va_list structure.  Put in into
  1248.                        r16 so that it will be returned
  1249.                        to the caller.  */
  1250.  
  1251.     /* Initialize all fields of the new va_list structure.  This
  1252.        structure looks like:
  1253.  
  1254.         typedef struct {
  1255.             unsigned long    ireg_used;
  1256.             unsigned long    freg_used;
  1257.             long        *reg_base;
  1258.             long        *mem_ptr;
  1259.         } va_list;
  1260.     */
  1261.  
  1262.     asm ("    st.l    %r0, 0(%r16)"); /* nfixed */
  1263.     asm ("    st.l    %r0, 4(%r16)"); /* nfloating */
  1264.     asm ("  st.l    %sp, 8(%r16)"); /* __va_ctl points to __va_struct.  */
  1265.     asm ("    bri    %r1");        /* delayed return */
  1266.     asm ("    st.l    %r28,12(%r16)"); /* pointer to overflow args */
  1267.  
  1268. #else /* not __svr4__ */
  1269. #if defined(__PARAGON__)
  1270.     /*
  1271.      *    we'll use SVR4-ish varargs but need SVR3.2 assembler syntax,
  1272.      *    and we stand a better chance of hooking into libraries
  1273.      *    compiled by PGI.  [andyp@ssd.intel.com]
  1274.      */
  1275.     asm ("    .text");
  1276.     asm ("    .align    4");
  1277.     asm (".globl    __builtin_saveregs");
  1278. asm ("__builtin_saveregs:");
  1279.     asm (".globl    ___builtin_saveregs");
  1280. asm ("___builtin_saveregs:");
  1281.  
  1282.         asm ("    andnot    0x0f,sp,sp");    /* round down to 16-byte boundary */
  1283.     asm ("    adds    -96,sp,sp");    /* allocate stack space for reg save
  1284.                        area and also for a new va_list
  1285.                        structure */
  1286.     /* Save all argument registers in the arg reg save area.  The
  1287.        arg reg save area must have the following layout (according
  1288.        to the svr4 ABI):
  1289.  
  1290.         struct {
  1291.           union  {
  1292.             float freg[8];
  1293.             double dreg[4];
  1294.           } float_regs;
  1295.           long    ireg[12];
  1296.         };
  1297.     */
  1298.  
  1299.     asm ("    fst.q    f8,  0(sp)");
  1300.     asm ("    fst.q    f12,16(sp)"); 
  1301.     asm ("    st.l    r16,32(sp)");
  1302.     asm ("    st.l    r17,36(sp)"); 
  1303.     asm ("    st.l    r18,40(sp)");
  1304.     asm ("    st.l    r19,44(sp)");
  1305.     asm ("    st.l    r20,48(sp)");
  1306.     asm ("    st.l    r21,52(sp)");
  1307.     asm ("    st.l    r22,56(sp)");
  1308.     asm ("    st.l    r23,60(sp)");
  1309.     asm ("    st.l    r24,64(sp)");
  1310.     asm ("    st.l    r25,68(sp)");
  1311.     asm ("    st.l    r26,72(sp)");
  1312.     asm ("    st.l    r27,76(sp)");
  1313.  
  1314.     asm ("    adds    80,sp,r16");  /* compute the address of the new
  1315.                        va_list structure.  Put in into
  1316.                        r16 so that it will be returned
  1317.                        to the caller.  */
  1318.  
  1319.     /* Initialize all fields of the new va_list structure.  This
  1320.        structure looks like:
  1321.  
  1322.         typedef struct {
  1323.             unsigned long    ireg_used;
  1324.             unsigned long    freg_used;
  1325.             long        *reg_base;
  1326.             long        *mem_ptr;
  1327.         } va_list;
  1328.     */
  1329.  
  1330.     asm ("    st.l    r0, 0(r16)"); /* nfixed */
  1331.     asm ("    st.l    r0, 4(r16)"); /* nfloating */
  1332.     asm ("  st.l    sp, 8(r16)"); /* __va_ctl points to __va_struct.  */
  1333.     asm ("    bri    r1");        /* delayed return */
  1334.     asm ("     st.l    r28,12(r16)"); /* pointer to overflow args */
  1335. #else /* not __PARAGON__ */
  1336.     asm ("    .text");
  1337.     asm ("    .align    4");
  1338.  
  1339.     asm (".globl    ___builtin_saveregs");
  1340.     asm ("___builtin_saveregs:");
  1341.     asm ("    mov    sp,r30");
  1342.     asm ("    andnot    0x0f,sp,sp");
  1343.     asm ("    adds    -96,sp,sp");  /* allocate sufficient space on the stack */
  1344.  
  1345. /* Fill in the __va_struct.  */
  1346.     asm ("    st.l    r16, 0(sp)"); /* save integer regs (r16-r27) */
  1347.     asm ("    st.l    r17, 4(sp)"); /* int    fixed[12] */
  1348.     asm ("    st.l    r18, 8(sp)");
  1349.     asm ("    st.l    r19,12(sp)");
  1350.     asm ("    st.l    r20,16(sp)");
  1351.     asm ("    st.l    r21,20(sp)");
  1352.     asm ("    st.l    r22,24(sp)");
  1353.     asm ("    st.l    r23,28(sp)");
  1354.     asm ("    st.l    r24,32(sp)");
  1355.     asm ("    st.l    r25,36(sp)");
  1356.     asm ("    st.l    r26,40(sp)");
  1357.     asm ("    st.l    r27,44(sp)");
  1358.  
  1359.     asm ("    fst.q    f8, 48(sp)"); /* save floating regs (f8-f15) */
  1360.     asm ("    fst.q    f12,64(sp)"); /* int floating[8] */
  1361.  
  1362. /* Fill in the __va_ctl.  */
  1363.     asm ("  st.l    sp, 80(sp)"); /* __va_ctl points to __va_struct.  */
  1364.     asm ("    st.l    r28,84(sp)"); /* pointer to more args */
  1365.     asm ("    st.l    r0, 88(sp)"); /* nfixed */
  1366.     asm ("    st.l    r0, 92(sp)"); /* nfloating */
  1367.  
  1368.     asm ("    adds    80,sp,r16");  /* return address of the __va_ctl.  */
  1369.     asm ("    bri    r1");
  1370.     asm ("    mov    r30,sp");
  1371.                 /* recover stack and pass address to start 
  1372.                    of data.  */
  1373. #endif /* not __PARAGON__ */
  1374. #endif /* not __svr4__ */
  1375. #else /* not __i860__ */
  1376. #ifdef __sparc__
  1377. #ifndef NEXT_SEMANTICS
  1378.     asm (".global __builtin_saveregs");
  1379.     asm ("__builtin_saveregs:");
  1380. #endif
  1381.     asm (".global ___builtin_saveregs");
  1382.     asm ("___builtin_saveregs:");
  1383. #ifdef NEED_PROC_COMMAND
  1384.     asm (".proc 020");
  1385. #endif
  1386.     asm ("st %i0,[%fp+68]");
  1387.     asm ("st %i1,[%fp+72]");
  1388.     asm ("st %i2,[%fp+76]");
  1389.     asm ("st %i3,[%fp+80]");
  1390.     asm ("st %i4,[%fp+84]");
  1391.     asm ("retl");
  1392.     asm ("st %i5,[%fp+88]");
  1393. #ifdef NEED_TYPE_COMMAND
  1394. #ifndef NEXT_SEMANTICS
  1395.     asm (".type __builtin_saveregs,#function");
  1396.     asm (".size __builtin_saveregs,.-__builtin_saveregs");
  1397. #endif
  1398. #endif
  1399. #else /* not __sparc__ */
  1400. #if defined(__MIPSEL__) | defined(__R3000__) | defined(__R2000__) | defined(__mips__)
  1401.  
  1402.   asm ("    .text");
  1403.   asm ("    .ent __builtin_saveregs");
  1404.   asm ("    .globl __builtin_saveregs");
  1405.   asm ("__builtin_saveregs:");
  1406.   asm ("    sw    $4,0($30)");
  1407.   asm ("    sw    $5,4($30)");
  1408.   asm ("    sw    $6,8($30)");
  1409.   asm ("    sw    $7,12($30)");
  1410.   asm ("    j    $31");
  1411.   asm ("    .end __builtin_saveregs");
  1412. #else /* not __mips__, etc. */
  1413.  
  1414. void *
  1415. __builtin_saveregs ()
  1416. {
  1417.   abort ();
  1418. }
  1419.  
  1420. #endif /* not __mips__ */
  1421. #endif /* not __sparc__ */
  1422. #endif /* not __i860__ */
  1423. #endif
  1424.  
  1425. #ifdef L_eprintf
  1426. #ifndef inhibit_libc
  1427.  
  1428. #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch.  */
  1429. #include <stdio.h>
  1430. /* This is used by the `assert' macro.  */
  1431. void
  1432. __eprintf (string, expression, line, filename)
  1433.      const char *string;
  1434.      const char *expression;
  1435.      int line;
  1436.      const char *filename;
  1437. {
  1438.   fprintf (stderr, string, expression, line, filename);
  1439.   fflush (stderr);
  1440.   abort ();
  1441. }
  1442.  
  1443. #endif
  1444. #endif
  1445.  
  1446. #ifdef L_bb
  1447.  
  1448. /* Structure emitted by -a  */
  1449. struct bb
  1450. {
  1451.   long zero_word;
  1452.   const char *filename;
  1453.   long *counts;
  1454.   long ncounts;
  1455.   struct bb *next;
  1456.   const unsigned long *addresses;
  1457.  
  1458.   /* Older GCC's did not emit these fields.  */
  1459.   long nwords;
  1460.   const char **functions;
  1461.   const long *line_nums;
  1462.   const char **filenames;
  1463. };
  1464.  
  1465. #ifdef BLOCK_PROFILER_CODE
  1466. BLOCK_PROFILER_CODE
  1467. #else
  1468. #ifndef inhibit_libc
  1469.  
  1470. /* Simple minded basic block profiling output dumper for
  1471.    systems that don't provide tcov support.  At present,
  1472.    it requires atexit and stdio.  */
  1473.  
  1474. #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch.  */
  1475. #include <stdio.h>
  1476. char *ctime ();
  1477.  
  1478. #ifdef HAVE_ATEXIT
  1479. #ifdef WINNT
  1480. extern int atexit (void (*) (void));
  1481. #else
  1482. extern void atexit (void (*) (void));
  1483. #endif
  1484. #define ON_EXIT(FUNC,ARG) atexit ((FUNC))
  1485. #else
  1486. #ifdef sun
  1487. extern void on_exit (void*, void*);
  1488. #define ON_EXIT(FUNC,ARG) on_exit ((FUNC), (ARG))
  1489. #endif
  1490. #endif
  1491.  
  1492. static struct bb *bb_head;
  1493.  
  1494. /* Return the number of digits needed to print a value */
  1495. /* __inline__ */ static int num_digits (long value, int base)
  1496. {
  1497.   int minus = (value < 0 && base != 16);
  1498.   unsigned long v = (minus) ? -value : value;
  1499.   int ret = minus;
  1500.  
  1501.   do
  1502.     {
  1503.       v /= base;
  1504.       ret++;
  1505.     }
  1506.   while (v);
  1507.  
  1508.   return ret;
  1509. }
  1510.  
  1511. void
  1512. __bb_exit_func (void)
  1513. {
  1514.   FILE *file = fopen ("bb.out", "a");
  1515.   long time_value;
  1516.  
  1517.   if (!file)
  1518.     perror ("bb.out");
  1519.  
  1520.   else
  1521.     {
  1522.       struct bb *ptr;
  1523.  
  1524.       /* This is somewhat type incorrect, but it avoids worrying about
  1525.      exactly where time.h is included from.  It should be ok unless
  1526.      a void * differs from other pointer formats, or if sizeof(long)
  1527.      is < sizeof (time_t).  It would be nice if we could assume the
  1528.      use of rationale standards here.  */
  1529.  
  1530.       time((void *) &time_value);
  1531.       fprintf (file, "Basic block profiling finished on %s\n", ctime ((void *) &time_value));
  1532.  
  1533.       /* We check the length field explicitly in order to allow compatibility
  1534.      with older GCC's which did not provide it.  */
  1535.  
  1536.       for (ptr = bb_head; ptr != (struct bb *)0; ptr = ptr->next)
  1537.     {
  1538.       int i;
  1539.       int func_p    = (ptr->nwords >= sizeof (struct bb) && ptr->nwords <= 1000);
  1540.       int line_p    = (func_p && ptr->line_nums);
  1541.       int file_p    = (func_p && ptr->filenames);
  1542.       long ncounts    = ptr->ncounts;
  1543.       long cnt_max  = 0;
  1544.       long line_max = 0;
  1545.       long addr_max = 0;
  1546.       int file_len    = 0;
  1547.       int func_len    = 0;
  1548.       int blk_len    = num_digits (ncounts, 10);
  1549.       int cnt_len;
  1550.       int line_len;
  1551.       int addr_len;
  1552.  
  1553.       fprintf (file, "File %s, %ld basic blocks \n\n",
  1554.            ptr->filename, ncounts);
  1555.  
  1556.       /* Get max values for each field.  */
  1557.       for (i = 0; i < ncounts; i++)
  1558.         {
  1559.           const char *p;
  1560.           int len;
  1561.  
  1562.           if (cnt_max < ptr->counts[i])
  1563.         cnt_max = ptr->counts[i];
  1564.  
  1565.           if (addr_max < ptr->addresses[i])
  1566.         addr_max = ptr->addresses[i];
  1567.  
  1568.           if (line_p && line_max < ptr->line_nums[i])
  1569.         line_max = ptr->line_nums[i];
  1570.  
  1571.           if (func_p)
  1572.         {
  1573.           p = (ptr->functions[i]) ? (ptr->functions[i]) : "<none>";
  1574.           len = strlen (p);
  1575.           if (func_len < len)
  1576.             func_len = len;
  1577.         }
  1578.  
  1579.           if (file_p)
  1580.         {
  1581.           p = (ptr->filenames[i]) ? (ptr->filenames[i]) : "<none>";
  1582.           len = strlen (p);
  1583.           if (file_len < len)
  1584.             file_len = len;
  1585.         }
  1586.         }
  1587.  
  1588.       addr_len = num_digits (addr_max, 16);
  1589.       cnt_len  = num_digits (cnt_max, 10);
  1590.       line_len = num_digits (line_max, 10);
  1591.  
  1592.       /* Now print out the basic block information.  */
  1593.       for (i = 0; i < ncounts; i++)
  1594.         {
  1595.           fprintf (file,
  1596.                "    Block #%*d: executed %*ld time(s) address= 0x%.*lx",
  1597.                blk_len, i+1,
  1598.                cnt_len, ptr->counts[i],
  1599.                addr_len, ptr->addresses[i]);
  1600.  
  1601.           if (func_p)
  1602.         fprintf (file, " function= %-*s", func_len,
  1603.              (ptr->functions[i]) ? ptr->functions[i] : "<none>");
  1604.  
  1605.           if (line_p)
  1606.         fprintf (file, " line= %*ld", line_len, ptr->line_nums[i]);
  1607.  
  1608.           if (file_p)
  1609.         fprintf (file, " file= %s",
  1610.              (ptr->filenames[i]) ? ptr->filenames[i] : "<none>");
  1611.  
  1612.           fprintf (file, "\n");
  1613.         }
  1614.  
  1615.       fprintf (file, "\n");
  1616.       fflush (file);
  1617.     }
  1618.  
  1619.       fprintf (file, "\n\n");
  1620.       fclose (file);
  1621.     }
  1622. }
  1623.  
  1624. void
  1625. __bb_init_func (struct bb *blocks)
  1626. {
  1627.   /* User is supposed to check whether the first word is non-0,
  1628.      but just in case.... */
  1629.  
  1630.   if (blocks->zero_word)
  1631.     return;
  1632.  
  1633. #ifdef ON_EXIT
  1634.   /* Initialize destructor.  */
  1635.   if (!bb_head)
  1636.     ON_EXIT (__bb_exit_func, 0);
  1637. #endif
  1638.  
  1639.   /* Set up linked list.  */
  1640.   blocks->zero_word = 1;
  1641.   blocks->next = bb_head;
  1642.   bb_head = blocks;
  1643. }
  1644.  
  1645. #endif /* not inhibit_libc */
  1646. #endif /* not BLOCK_PROFILER_CODE */
  1647. #endif /* L_bb */
  1648.  
  1649. /* Default free-store management functions for C++, per sections 12.5 and
  1650.    17.3.3 of the Working Paper. */
  1651.  
  1652. #ifdef L_op_new
  1653. /* operator new (size_t), described in 17.3.3.5.  This function is used by
  1654.    C++ programs to allocate a block of memory to hold a single object. */
  1655.  
  1656. typedef void (*vfp)(void);
  1657. #ifdef NEXT_SEMANTICS
  1658. extern vfp __get_new_handler ();
  1659. #else
  1660. extern vfp __new_handler;
  1661. extern void __default_new_handler (void);
  1662. #endif
  1663.  
  1664. #ifdef WEAK_ALIAS
  1665. void * __builtin_new (size_t sz)
  1666.      __attribute__ ((weak, alias ("___builtin_new")));
  1667. void *
  1668. ___builtin_new (size_t sz)
  1669. #else
  1670. void *
  1671. __builtin_new (size_t sz)
  1672. #endif
  1673. {
  1674.   void *p;
  1675. #ifdef NEXT_SEMANTICS
  1676.   vfp handler = __get_new_handler ();
  1677. #else
  1678.   vfp handler = (__new_handler) ? __new_handler : __default_new_handler;
  1679. #endif
  1680.  
  1681.   /* malloc (0) is unpredictable; avoid it.  */
  1682.   if (sz == 0)
  1683.     sz = 1;
  1684.   p = (void *) malloc (sz);
  1685.   while (p == 0)
  1686.     {
  1687.       (*handler) ();
  1688.       p = (void *) malloc (sz);
  1689.     }
  1690.   
  1691.   return p;
  1692. }
  1693. #endif /* L_op_new */
  1694.  
  1695. #ifdef L_op_vnew
  1696. /* void * operator new [] (size_t), described in 17.3.3.6.  This function
  1697.    is used by C++ programs to allocate a block of memory for an array.  */
  1698.  
  1699. extern void * __builtin_new (size_t);
  1700.  
  1701. #ifdef WEAK_ALIAS
  1702. void * __builtin_vec_new (size_t sz)
  1703.      __attribute__ ((weak, alias ("___builtin_vec_new")));
  1704. void *
  1705. ___builtin_vec_new (size_t sz)
  1706. #else
  1707. void *
  1708. __builtin_vec_new (size_t sz)
  1709. #endif
  1710. {
  1711.   return __builtin_new (sz);
  1712. }
  1713. #endif /* L_op_vnew */
  1714.  
  1715. #ifdef L_new_handler
  1716. /* set_new_handler (fvoid_t *) and the default new handler, described in
  1717.    17.3.3.2 and 17.3.3.5.  These functions define the result of a failure
  1718.    to allocate the amount of memory requested from operator new or new []. */
  1719.  
  1720. #ifndef inhibit_libc
  1721. /* This gets us __GNU_LIBRARY__.  */
  1722. #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch.  */
  1723. #include <stdio.h>
  1724.  
  1725. #ifdef __GNU_LIBRARY__
  1726.   /* Avoid forcing the library's meaning of `write' on the user program
  1727.      by using the "internal" name (for use within the library)  */
  1728. #define write(fd, buf, n)    __write((fd), (buf), (n))
  1729. #endif
  1730. #endif /* inhibit_libc */
  1731.  
  1732. typedef void (*vfp)(void);
  1733. void __default_new_handler (void);
  1734.  
  1735. #ifdef NEXT_SEMANTICS
  1736. static 
  1737. #endif
  1738. vfp __new_handler = (vfp)0;
  1739.  
  1740. #ifdef NEXT_SEMANTICS
  1741. vfp 
  1742. __get_new_handler ()
  1743. {
  1744.   return __new_handler;
  1745. }
  1746. #endif
  1747.  
  1748. vfp
  1749. set_new_handler (vfp handler)
  1750. {
  1751.   vfp prev_handler;
  1752.  
  1753.   prev_handler = __new_handler;
  1754.   if (handler == 0) handler = __default_new_handler;
  1755.   __new_handler = handler;
  1756.   return prev_handler;
  1757. }
  1758.  
  1759. #define MESSAGE "Virtual memory exceeded in `new'\n"
  1760.  
  1761. void
  1762. __default_new_handler ()
  1763. {
  1764. #ifndef inhibit_libc
  1765.   /* don't use fprintf (stderr, ...) because it may need to call malloc.  */
  1766.   /* This should really print the name of the program, but that is hard to
  1767.      do.  We need a standard, clean way to get at the name.  */
  1768.   write (2, MESSAGE, sizeof (MESSAGE));
  1769. #endif
  1770.   /* don't call exit () because that may call global destructors which
  1771.      may cause a loop.  */
  1772.   _exit (-1);
  1773. }
  1774. #endif
  1775.  
  1776. #ifdef L_op_delete
  1777. /* operator delete (void *), described in 17.3.3.3.  This function is used
  1778.    by C++ programs to return to the free store a block of memory allocated
  1779.    as a single object. */
  1780.  
  1781. #ifdef WEAK_ALIAS
  1782. void __builtin_delete (void *ptr)
  1783.      __attribute__ ((weak, alias ("___builtin_delete")));
  1784. void
  1785. ___builtin_delete (void *ptr)
  1786. #else
  1787. void
  1788. __builtin_delete (void *ptr)
  1789. #endif
  1790. {
  1791.   if (ptr)
  1792.     free (ptr);
  1793. }
  1794. #endif
  1795.  
  1796. #ifdef L_op_vdel
  1797. /* operator delete [] (void *), described in 17.3.3.4.  This function is
  1798.    used by C++ programs to return to the free store a block of memory
  1799.    allocated as an array. */
  1800.  
  1801. extern void __builtin_delete (void *);
  1802.  
  1803. #ifdef WEAK_ALIAS
  1804. void __builtin_vec_delete (void *ptr)
  1805.      __attribute__ ((weak, alias ("___builtin_vec_delete")));
  1806. void
  1807. ___builtin_vec_delete (void *ptr)
  1808. #else
  1809. void
  1810. __builtin_vec_delete (void *ptr)
  1811. #endif
  1812. {
  1813.   __builtin_delete (ptr);
  1814. }
  1815. #endif
  1816.  
  1817. /* End of C++ free-store management functions */
  1818.  
  1819. #ifdef L_shtab
  1820. unsigned int __shtab[] = {
  1821.     0x00000001, 0x00000002, 0x00000004, 0x00000008,
  1822.     0x00000010, 0x00000020, 0x00000040, 0x00000080,
  1823.     0x00000100, 0x00000200, 0x00000400, 0x00000800,
  1824.     0x00001000, 0x00002000, 0x00004000, 0x00008000,
  1825.     0x00010000, 0x00020000, 0x00040000, 0x00080000,
  1826.     0x00100000, 0x00200000, 0x00400000, 0x00800000,
  1827.     0x01000000, 0x02000000, 0x04000000, 0x08000000,
  1828.     0x10000000, 0x20000000, 0x40000000, 0x80000000
  1829.   };
  1830. #endif
  1831.  
  1832. #ifdef L_clear_cache
  1833. /* Clear part of an instruction cache.  */
  1834.  
  1835. #define INSN_CACHE_PLANE_SIZE (INSN_CACHE_SIZE / INSN_CACHE_DEPTH)
  1836.  
  1837. void
  1838. __clear_cache (beg, end)
  1839.      char *beg, *end;
  1840. {
  1841. #ifdef CLEAR_INSN_CACHE 
  1842.   CLEAR_INSN_CACHE (beg, end);
  1843. #else
  1844. #ifdef INSN_CACHE_SIZE
  1845.   static char array[INSN_CACHE_SIZE + INSN_CACHE_PLANE_SIZE + INSN_CACHE_LINE_WIDTH];
  1846.   static int initialized;
  1847.   int offset;
  1848.   void *start_addr
  1849.   void *end_addr;
  1850.   typedef (*function_ptr) ();
  1851.  
  1852. #if (INSN_CACHE_SIZE / INSN_CACHE_LINE_WIDTH) < 16
  1853.   /* It's cheaper to clear the whole cache.
  1854.      Put in a series of jump instructions so that calling the beginning
  1855.      of the cache will clear the whole thing.  */
  1856.  
  1857.   if (! initialized)
  1858.     {
  1859.       int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1)
  1860.          & -INSN_CACHE_LINE_WIDTH);
  1861.       int end_ptr = ptr + INSN_CACHE_SIZE;
  1862.  
  1863.       while (ptr < end_ptr)
  1864.     {
  1865.       *(INSTRUCTION_TYPE *)ptr
  1866.         = JUMP_AHEAD_INSTRUCTION + INSN_CACHE_LINE_WIDTH;
  1867.       ptr += INSN_CACHE_LINE_WIDTH;
  1868.     }
  1869.       *(INSTRUCTION_TYPE *)(ptr - INSN_CACHE_LINE_WIDTH) = RETURN_INSTRUCTION;
  1870.  
  1871.       initialized = 1;
  1872.     }
  1873.  
  1874.   /* Call the beginning of the sequence.  */
  1875.   (((function_ptr) (((int) array + INSN_CACHE_LINE_WIDTH - 1)
  1876.             & -INSN_CACHE_LINE_WIDTH))
  1877.    ());
  1878.  
  1879. #else /* Cache is large.  */
  1880.  
  1881.   if (! initialized)
  1882.     {
  1883.       int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1)
  1884.          & -INSN_CACHE_LINE_WIDTH);
  1885.  
  1886.       while (ptr < (int) array + sizeof array)
  1887.     {
  1888.       *(INSTRUCTION_TYPE *)ptr = RETURN_INSTRUCTION;
  1889.       ptr += INSN_CACHE_LINE_WIDTH;
  1890.     }
  1891.  
  1892.       initialized = 1;
  1893.     }
  1894.  
  1895.   /* Find the location in array that occupies the same cache line as BEG.  */
  1896.  
  1897.   offset = ((int) beg & -INSN_CACHE_LINE_WIDTH) & (INSN_CACHE_PLANE_SIZE - 1);
  1898.   start_addr = (((int) (array + INSN_CACHE_PLANE_SIZE - 1)
  1899.          & -INSN_CACHE_PLANE_SIZE)
  1900.         + offset);
  1901.  
  1902.   /* Compute the cache alignment of the place to stop clearing.  */
  1903. #if 0  /* This is not needed for gcc's purposes.  */
  1904.   /* If the block to clear is bigger than a cache plane,
  1905.      we clear the entire cache, and OFFSET is already correct.  */ 
  1906.   if (end < beg + INSN_CACHE_PLANE_SIZE)
  1907. #endif
  1908.     offset = (((int) (end + INSN_CACHE_LINE_WIDTH - 1)
  1909.            & -INSN_CACHE_LINE_WIDTH)
  1910.           & (INSN_CACHE_PLANE_SIZE - 1));
  1911.  
  1912. #if INSN_CACHE_DEPTH > 1
  1913.   end_addr = (start_addr & -INSN_CACHE_PLANE_SIZE) + offset;
  1914.   if (end_addr <= start_addr)
  1915.     end_addr += INSN_CACHE_PLANE_SIZE;
  1916.  
  1917.   for (plane = 0; plane < INSN_CACHE_DEPTH; plane++)
  1918.     {
  1919.       int addr = start_addr + plane * INSN_CACHE_PLANE_SIZE;
  1920.       int stop = end_addr + plane * INSN_CACHE_PLANE_SIZE;
  1921.  
  1922.       while (addr != stop)
  1923.     {
  1924.       /* Call the return instruction at ADDR.  */
  1925.       ((function_ptr) addr) ();
  1926.  
  1927.       addr += INSN_CACHE_LINE_WIDTH;
  1928.     }
  1929.     }
  1930. #else /* just one plane */
  1931.   do
  1932.     {
  1933.       /* Call the return instruction at START_ADDR.  */
  1934.       ((function_ptr) start_addr) ();
  1935.  
  1936.       start_addr += INSN_CACHE_LINE_WIDTH;
  1937.     }
  1938.   while ((start_addr % INSN_CACHE_SIZE) != offset);
  1939. #endif /* just one plane */
  1940. #endif /* Cache is large */
  1941. #endif /* Cache exists */
  1942. #endif /* CLEAR_INSN_CACHE */
  1943. }
  1944.  
  1945. #endif /* L_clear_cache */
  1946.  
  1947. #ifdef L_trampoline
  1948.  
  1949. /* Jump to a trampoline, loading the static chain address.  */
  1950.  
  1951. #ifdef WINNT
  1952.  
  1953. long getpagesize()
  1954. {
  1955. #ifdef _ALPHA_
  1956.   return 8192;
  1957. #else
  1958.   return 4096;
  1959. #endif
  1960. }
  1961.  
  1962. int mprotect(addr, len, prot)
  1963.   char *addr;
  1964.   int len, prot;
  1965. {
  1966.   int np, op;
  1967.  
  1968.   if (prot == 7) np = 0x40;
  1969.   else if (prot == 5) np = 0x20;
  1970.   else if (prot == 4) np = 0x10;
  1971.   else if (prot == 3) np = 0x04;
  1972.   else if (prot == 1) np = 0x02;
  1973.   else if (prot == 0) np = 0x01;
  1974.  
  1975.   if (VirtualProtect (addr, len, np, &op))
  1976.     return 0;
  1977.   else
  1978.     return -1;
  1979.     
  1980. }
  1981.  
  1982. #endif
  1983.  
  1984. #ifdef TRANSFER_FROM_TRAMPOLINE 
  1985. TRANSFER_FROM_TRAMPOLINE 
  1986. #endif
  1987.  
  1988. #if defined (NeXT) && defined (__MACH__) 
  1989.  
  1990. /* Make stack executable so we can call trampolines on stack.
  1991.    This is called from INITIALIZE_TRAMPOLINE in next.h.  */
  1992. #if !defined (NS_TARGET_MAJOR) || NS_TARGET_MAJOR < 4
  1993. #ifdef NeXTStep21
  1994.  #include <mach.h>
  1995. #else
  1996.  #include <mach/mach.h>
  1997. #endif
  1998. #endif /* !defined (NS_TARGET_MAJOR) */
  1999.  
  2000. void
  2001. __enable_execute_stack (addr)
  2002.      char *addr;
  2003. {
  2004.   char *eaddr = addr + TRAMPOLINE_SIZE;
  2005. #if !defined (NS_TARGET_MAJOR) || NS_TARGET_MAJOR < 4
  2006.   kern_return_t r;
  2007.   vm_address_t a = (vm_address_t) addr;
  2008.  
  2009.   /* turn on execute access on stack */
  2010.   r = vm_protect (task_self (), a, TRAMPOLINE_SIZE, FALSE, VM_PROT_ALL);
  2011.   if (r != KERN_SUCCESS)
  2012.     {
  2013.       mach_error("vm_protect VM_PROT_ALL", r);
  2014.       exit(1);
  2015.     }
  2016. #endif /* !defined (NS_TARGET_MAJOR) */
  2017.  
  2018.   /* We inline the i-cache invalidation for speed */
  2019.  
  2020. #ifdef CLEAR_INSN_CACHE
  2021.   CLEAR_INSN_CACHE (addr, eaddr);
  2022. #else
  2023.   __clear_cache ((int) addr, (int) eaddr);
  2024. #endif
  2025.  
  2026. #endif /* defined (NeXT) && defined (__MACH__) */
  2027.  
  2028. #ifdef __convex__
  2029.  
  2030. /* Make stack executable so we can call trampolines on stack.
  2031.    This is called from INITIALIZE_TRAMPOLINE in convex.h.  */
  2032.  
  2033. #include <sys/mman.h>
  2034. #include <sys/vmparam.h>
  2035. #include <machine/machparam.h>
  2036.  
  2037. void
  2038. __enable_execute_stack ()
  2039. {
  2040.   int fp;
  2041.   static unsigned lowest = USRSTACK;
  2042.   unsigned current = (unsigned) &fp & -NBPG;
  2043.  
  2044.   if (lowest > current)
  2045.     {
  2046.       unsigned len = lowest - current;
  2047.       mremap (current, &len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE);
  2048.       lowest = current;
  2049.     }
  2050.  
  2051.   /* Clear instruction cache in case an old trampoline is in it. */
  2052.   asm ("pich");
  2053. }
  2054. #endif /* __convex__ */
  2055.  
  2056. #ifdef __DOLPHIN__
  2057.  
  2058. /* Modified from the convex -code above. */
  2059.  
  2060. #include <sys/param.h>
  2061. #include <errno.h>
  2062. #include <sys/m88kbcs.h>
  2063.  
  2064. void
  2065. __enable_execute_stack ()
  2066. {
  2067.   int save_errno;
  2068.   static unsigned long lowest = USRSTACK;
  2069.   unsigned long current = (unsigned long) &save_errno & -NBPC;
  2070.   
  2071.   /* Ignore errno being set. memctl sets errno to EINVAL whenever the
  2072.      address is seen as 'negative'. That is the case with the stack.   */
  2073.  
  2074.   save_errno=errno;
  2075.   if (lowest > current)
  2076.     {
  2077.       unsigned len=lowest-current;
  2078.       memctl(current,len,MCT_TEXT);
  2079.       lowest = current;
  2080.     }
  2081.   else
  2082.     memctl(current,NBPC,MCT_TEXT);
  2083.   errno=save_errno;
  2084. }
  2085.  
  2086. #endif /* __DOLPHIN__ */
  2087.  
  2088. #ifdef __pyr__
  2089.  
  2090. #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch.  */
  2091. #include <stdio.h>
  2092. #include <sys/mman.h>
  2093. #include <sys/types.h>
  2094. #include <sys/param.h>
  2095. #include <sys/vmmac.h>
  2096.  
  2097. /* Modified from the convex -code above.
  2098.    mremap promises to clear the i-cache. */
  2099.  
  2100. void
  2101. __enable_execute_stack ()
  2102. {
  2103.   int fp;
  2104.   if (mprotect (((unsigned int)&fp/PAGSIZ)*PAGSIZ, PAGSIZ,
  2105.         PROT_READ|PROT_WRITE|PROT_EXEC))
  2106.     {
  2107.       perror ("mprotect in __enable_execute_stack");
  2108.       fflush (stderr);
  2109.       abort ();
  2110.     }
  2111. }
  2112. #endif /* __pyr__ */
  2113. #endif /* L_trampoline */
  2114.  
  2115. #ifdef L__main
  2116.  
  2117. #include "gbl-ctors.h"
  2118. /* Some systems use __main in a way incompatible with its use in gcc, in these
  2119.    cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
  2120.    give the same symbol without quotes for an alternative entry point.  You
  2121.    must define both, or neither. */
  2122. #ifndef NAME__MAIN
  2123. #define NAME__MAIN "__main"
  2124. #define SYMBOL__MAIN __main
  2125. #endif
  2126.  
  2127. #if !defined (INIT_SECTION_ASM_OP) || !defined (OBJECT_FORMAT_ELF)
  2128. /* Run all the global destructors on exit from the program.  */
  2129.  
  2130. void
  2131. __do_global_dtors ()
  2132. {
  2133. #ifdef DO_GLOBAL_DTORS_BODY
  2134.   DO_GLOBAL_DTORS_BODY;
  2135. #else
  2136.   func_ptr *p;
  2137.   for (p = __DTOR_LIST__ + 1; *p; )
  2138.     (*p++) ();
  2139. #endif
  2140. }
  2141. #endif
  2142.  
  2143. #ifndef INIT_SECTION_ASM_OP
  2144. /* Run all the global constructors on entry to the program.  */
  2145.  
  2146. #ifndef ON_EXIT
  2147. #define ON_EXIT(a, b)
  2148. #else
  2149. /* Make sure the exit routine is pulled in to define the globals as
  2150.    bss symbols, just in case the linker does not automatically pull
  2151.    bss definitions from the library.  */
  2152.  
  2153. #ifndef NEXT_SEMANTICS
  2154. extern int _exit_dummy_decl;
  2155. int *_exit_dummy_ref = &_exit_dummy_decl;
  2156. #endif
  2157. #endif /* ON_EXIT */
  2158.  
  2159. void
  2160. __do_global_ctors ()
  2161. {
  2162.   DO_GLOBAL_CTORS_BODY;
  2163.   ON_EXIT (__do_global_dtors, 0);
  2164. }
  2165. #endif /* no INIT_SECTION_ASM_OP */
  2166.  
  2167. #if !defined (INIT_SECTION_ASM_OP) || defined (INVOKE__main)
  2168. /* Subroutine called automatically by `main'.
  2169.    Compiling a global function named `main'
  2170.    produces an automatic call to this function at the beginning.
  2171.  
  2172.    For many systems, this routine calls __do_global_ctors.
  2173.    For systems which support a .init section we use the .init section
  2174.    to run __do_global_ctors, so we need not do anything here.  */
  2175.  
  2176. #ifdef NEXT_PDO
  2177. /* do some hokey stuff to get automatic _objcInit to work
  2178.    this data location is referenced in the NEXT_PDO runtime
  2179.    so that we can do the magic rendezvous.  */
  2180.  
  2181. #ifdef __osf__
  2182. long int _objcInit_addr;
  2183. #else
  2184. int _objcInit_addr;
  2185. #endif /* __osf__ */
  2186.  
  2187. int __NXArgc;
  2188. char **__NXArgv;
  2189.  
  2190. #ifdef _WIN32
  2191. #include <windows.h>
  2192. __declspec (dllimport) void _fpreset ();
  2193. #endif
  2194. #endif /* NEXT_PDO */
  2195.  
  2196. #ifdef NEXT_EXTENSION
  2197. int __gnuc_argc;
  2198. const char **__gnuc_argv;
  2199. #endif
  2200.  
  2201. void
  2202. #if defined (NEXT_EXTENSION) || defined (NEXT_PDO)
  2203. SYMBOL__MAIN (int argc, const char **argv)
  2204. #else
  2205. SYMBOL__MAIN ()
  2206. #endif
  2207. {
  2208.   /* Support recursive calls to `main': run initializers just once.  */
  2209.   static int initialized = 0;
  2210.  
  2211. #ifdef NEXT_PDO
  2212. #ifdef sparc
  2213. #define PRECIOUS_REGS "i0", "i1", "i2", "i3", "i4", "i5", \
  2214. "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",\
  2215.   "o0", "o1", "o2", "o3", "o4", "o5", "o7"
  2216.  
  2217.   asm volatile("mov %%sp,%%g1": :);
  2218.   asm volatile("restore": :);
  2219.   asm volatile("st %%i0,%0": "=m" (__NXArgc): : PRECIOUS_REGS);
  2220.   asm volatile("st %%i1,%0": "=m" (__NXArgv): : PRECIOUS_REGS);
  2221.   asm volatile("save %%g0,0,%%g0": :);
  2222.   asm volatile("mov %%g1,%%sp": :);
  2223. #endif/* def sparc */
  2224. #ifdef hpux
  2225.   extern int __argc_value;
  2226.   extern char **__argv_value;
  2227.  
  2228.   __NXArgc = __argc_value;
  2229.   __NXArgv = __argv_value;
  2230. #endif/* def hpux */
  2231. #if __alpha__ || __alpha
  2232.   asm volatile("stq $16,%0": "=m" (__NXArgc));
  2233.   asm volatile("stq $17,%0": "=m" (__NXArgv));
  2234. #endif
  2235. #ifdef _WIN32
  2236.   extern int __argc;
  2237.   extern char** __argv;
  2238.  
  2239.   __NXArgc = __argc;
  2240.   __NXArgv = __argv;
  2241. #endif _WIN32
  2242. #endif/* def NEXT_PDO */
  2243.  
  2244. #ifdef NEXT_EXTENSION
  2245.   __gnuc_argc = argc;
  2246.   __gnuc_argv = argv;
  2247. #endif
  2248.  
  2249.   if (! initialized)
  2250.     {
  2251.       initialized = 1;
  2252.       __do_global_ctors ();
  2253. #ifdef NEXT_PDO
  2254. #ifdef _WIN32
  2255.       /* The Microsoft compiler keeps track internally of whether a program
  2256.      uses floating point support and if it does, it will call this
  2257.      function to startup the floating point support.  Initially, the
  2258.      easy way to get gcc to support this is to just call the function
  2259.      directly here when gcc initialized.  Perhaps we should be doing
  2260.      this the same way MS does it, but I don't know how much of a
  2261.      benefit it is right now.  PDM */
  2262.       _fpreset ();
  2263.       _objcInit_addr = GetProcAddress (GetModuleHandle ("NEXTPDO.DLL"),
  2264.                        "_objcInit");
  2265. #endif /* _WIN32 */
  2266.       if (_objcInit_addr)
  2267.     ((void (*)())_objcInit_addr)();
  2268. #endif /* NEXT_PDO */
  2269.     }
  2270. }
  2271. #endif /* no INIT_SECTION_ASM_OP or INVOKE__main */
  2272.  
  2273. #if defined (NEXT_PDO) && defined (_WIN32)
  2274. const char* _NSRootDirectory (void)
  2275. {
  2276.   static const char* root = NULL;
  2277.   if (!root)
  2278.     if (!(root = getenv ("NEXT_ROOT")))
  2279.       root = "";
  2280.   return root;
  2281. }
  2282. #endif
  2283.  
  2284. #endif /* L__main */
  2285.  
  2286. #ifdef L_ctors
  2287.  
  2288. #include "gbl-ctors.h"
  2289.  
  2290. /* Provide default definitions for the lists of constructors and
  2291.    destructors, so that we don't get linker errors.  These symbols are
  2292.    intentionally bss symbols, so that gld and/or collect will provide
  2293.    the right values.  */
  2294.  
  2295. /* We declare the lists here with two elements each,
  2296.    so that they are valid empty lists if no other definition is loaded.  */
  2297. #if !defined(INIT_SECTION_ASM_OP) && !defined(CTOR_LISTS_DEFINED_EXTERNALLY)
  2298. #if defined(__NeXT__) || defined(_AIX)
  2299. /* After 2.3, try this definition on all systems.  */
  2300. func_ptr __CTOR_LIST__[2] = {0, 0};
  2301. func_ptr __DTOR_LIST__[2] = {0, 0};
  2302. #else
  2303. func_ptr __CTOR_LIST__[2];
  2304. func_ptr __DTOR_LIST__[2];
  2305. #endif
  2306. #endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
  2307. #endif /* L_ctors */
  2308.  
  2309. #ifdef L_exit
  2310.  
  2311. #include "gbl-ctors.h"
  2312.  
  2313. #ifndef ON_EXIT
  2314.  
  2315. /* If we have no known way of registering our own __do_global_dtors
  2316.    routine so that it will be invoked at program exit time, then we
  2317.    have to define our own exit routine which will get this to happen.  */
  2318.  
  2319. extern void __do_global_dtors ();
  2320. extern void _cleanup ();
  2321. extern void _exit () __attribute__ ((noreturn));
  2322.  
  2323. void 
  2324. exit (status)
  2325.      int status;
  2326. {
  2327. #if !defined (INIT_SECTION_ASM_OP) || !defined (OBJECT_FORMAT_ELF)
  2328.   __do_global_dtors ();
  2329. #endif
  2330. #ifdef EXIT_BODY
  2331.   EXIT_BODY;
  2332. #else
  2333.   _cleanup ();
  2334. #endif
  2335.   _exit (status);
  2336. }
  2337.  
  2338. #else
  2339. int _exit_dummy_decl = 0;    /* prevent compiler & linker warnings */
  2340. #endif
  2341.  
  2342. #endif /* L_exit */
  2343.  
  2344. #ifdef L_eh
  2345. typedef struct {
  2346.   void *start;
  2347.   void *end;
  2348.   void *exception_handler;
  2349. } exception_table;
  2350.  
  2351. struct exception_table_node {
  2352.   exception_table *table;
  2353.   void *start;
  2354.   void *end;
  2355.   struct exception_table_node *next;
  2356. };
  2357.  
  2358. static int except_table_pos;
  2359. static void *except_pc;
  2360. static struct exception_table_node *exception_table_list;
  2361.  
  2362. static exception_table *
  2363. find_exception_table (pc)
  2364.      void* pc;
  2365. {
  2366.   register struct exception_table_node *table = exception_table_list;
  2367.   for ( ; table != 0; table = table->next)
  2368.     {
  2369.       if (table->start <= pc && table->end > pc)
  2370.     return table->table;
  2371.     }
  2372.   return 0;
  2373. }
  2374.  
  2375. /* this routine takes a pc, and the address of the exception handler associated
  2376.    with the closest exception table handler entry associated with that PC,
  2377.    or 0 if there are no table entries the PC fits in.  The algorithm works
  2378.    something like this:
  2379.  
  2380.     while(current_entry exists) {
  2381.         if(current_entry.start < pc )
  2382.             current_entry = next_entry;
  2383.         else {
  2384.             if(prev_entry.start <= pc && prev_entry.end > pc) {
  2385.                 save pointer to prev_entry;
  2386.                 return prev_entry.exception_handler;
  2387.              }
  2388.             else return 0;
  2389.          }
  2390.      }
  2391.     return 0;
  2392.  
  2393.    Assuming a correctly sorted table (ascending order) this routine should
  2394.    return the tightest match...
  2395.  
  2396.    In the advent of a tie, we have to give the last entry, as it represents
  2397.    an inner block.
  2398.  */
  2399.  
  2400.  
  2401. void *
  2402. __find_first_exception_table_match(pc)
  2403. void *pc;
  2404. {
  2405.   exception_table *table = find_exception_table (pc);
  2406.   int pos = 0;
  2407.   int best = 0;
  2408.   if (table == 0)
  2409.     return (void*)0;
  2410. #if 0
  2411.   printf("find_first_exception_table_match(): pc = %x!\n",pc);
  2412. #endif
  2413.  
  2414.   except_pc = pc;
  2415.  
  2416. #if 0
  2417.   /* We can't do this yet, as we don't know that the table is sorted.  */
  2418.   do {
  2419.     ++pos;
  2420.     if (table[pos].start > except_pc)
  2421.       /* found the first table[pos].start > except_pc, so the previous
  2422.      entry better be the one we want! */
  2423.       break;
  2424.   } while(table[pos].exception_handler != (void*)-1);
  2425.  
  2426.   --pos;
  2427.   if (table[pos].start <= except_pc && table[pos].end > except_pc)
  2428.     {
  2429.       except_table_pos = pos;
  2430. #if 0
  2431.       printf("find_first_eh_table_match(): found match: %x\n",table[pos].exception_handler);
  2432. #endif
  2433.       return table[pos].exception_handler;
  2434.     }
  2435. #else
  2436.   while (table[++pos].exception_handler != (void*)-1) {
  2437.     if (table[pos].start <= except_pc && table[pos].end > except_pc)
  2438.       {
  2439.     /* This can apply.  Make sure it is better or as good as the previous
  2440.        best.  */
  2441.     /* The best one ends first. */
  2442.     if (best == 0 || (table[pos].end <= table[best].end
  2443.               /* The best one starts last.  */
  2444.               && table[pos].start >= table[best].start))
  2445.       best = pos;
  2446.       }
  2447.   }
  2448.   if (best != 0)
  2449.     return table[best].exception_handler;
  2450. #endif
  2451.  
  2452. #if 0
  2453.   printf("find_first_eh_table_match(): else: returning NULL!\n");
  2454. #endif
  2455.   return (void*)0;
  2456. }
  2457.  
  2458. void *
  2459. __throw_type_match (void *catch_type, void *throw_type, void* obj)
  2460. {
  2461. #if 0
  2462.  printf("__throw_type_match (): catch_type = %s, throw_type = %s\n",
  2463.     catch_type, throw_type);
  2464. #endif
  2465.  if (strcmp ((const char *)catch_type, (const char *)throw_type) == 0)
  2466.    return obj;
  2467.  return 0;
  2468. }
  2469.  
  2470. void
  2471. __register_exceptions (exception_table *table)
  2472. {
  2473.   struct exception_table_node *node;
  2474.   exception_table *range = table + 1;
  2475.  
  2476.   if (range->start == (void*)-1)
  2477.     return;
  2478.  
  2479.   node = (struct exception_table_node*)
  2480.     malloc (sizeof (struct exception_table_node));
  2481.   node->table = table;
  2482.  
  2483.   /* This look can be optimized away either if the table
  2484.      is sorted, or if we pass in extra parameters. */
  2485.   node->start = range->start;
  2486.   node->end = range->end;
  2487.   for (range++ ; range->start != (void*)(-1); range++)
  2488.     {
  2489.       if (range->start < node->start)
  2490.     node->start = range->start;
  2491.       if (range->end > node->end)
  2492.     node->end = range->end;
  2493.     }
  2494.  
  2495.   node->next = exception_table_list;
  2496.   exception_table_list = node;
  2497. }
  2498.  
  2499. #if #machine(i386)
  2500. void
  2501. __unwind_function(void *ptr)
  2502. {
  2503.   asm("movl 8(%esp),%ecx");
  2504.   /* Undo current frame */
  2505.   asm("movl %ebp,%esp");
  2506.   asm("popl %ebp");
  2507.   /* like ret, but stay here */
  2508.   asm("addl $4,%esp");
  2509.   
  2510.   /* Now, undo previous frame. */
  2511.   /* This is a test routine, as we have to dynamically probe to find out
  2512.      what to pop for certain, this is just a guess. */
  2513.   asm("leal -16(%ebp),%esp");
  2514.   asm("pop %ebx");
  2515.   asm("pop %esi");
  2516.   asm("pop %edi");
  2517.   asm("movl %ebp,%esp");
  2518.   asm("popl %ebp");
  2519.  
  2520.   asm("movl %ecx,0(%esp)");
  2521.   asm("ret");
  2522. }
  2523. #elif #machine(rs6000)
  2524. __unwind_function(void *ptr)
  2525. {
  2526.   asm("mr 31,1");
  2527.   asm("l 1,0(1)");
  2528.   asm("l 31,-4(1)");
  2529.   asm("# br");
  2530.  
  2531.   asm("mr 31,1");
  2532.   asm("l 1,0(1)");
  2533.   /* use 31 as a scratch register to restore the link register. */
  2534.   asm("l 31, 8(1);mtlr 31 # l lr,8(1)");
  2535.   asm("l 31,-4(1)");
  2536.   asm("# br");
  2537.   asm("mtctr 3;bctr # b 3");
  2538. }
  2539. #elif #machine(powerpc)
  2540. __unwind_function(void *ptr)
  2541. {
  2542.   asm("mr 31,1");
  2543.   asm("lwz 1,0(1)");
  2544.   asm("lwz 31,-4(1)");
  2545.   asm("# br");
  2546.  
  2547.   asm("mr 31,1");
  2548.   asm("lwz 1,0(1)");
  2549.   /* use 31 as a scratch register to restore the link register. */
  2550.   asm("lwz 31, 8(1);mtlr 31 # l lr,8(1)");
  2551.   asm("lwz 31,-4(1)");
  2552.   asm("# br");
  2553.   asm("mtctr 3;bctr # b 3");
  2554. }
  2555. #elif #machine(vax)
  2556. __unwind_function(void *ptr)
  2557. {
  2558.   __label__ return_again;
  2559.  
  2560.   /* Replace our frame's return address with the label below.
  2561.      During execution, we will first return here instead of to
  2562.      caller, then second return takes caller's frame off the stack.
  2563.      Two returns matches two actual calls, so is less likely to
  2564.      confuse debuggers.  `16' corresponds to RETURN_ADDRESS_OFFSET.  */
  2565.   __asm ("movl %0,16(fp)" : : "p" (&& return_again));
  2566.   return;
  2567.  
  2568.  return_again:
  2569.   return;
  2570. }
  2571. #else
  2572. __unwind_function(void *ptr)
  2573. {
  2574.   abort ();
  2575. }
  2576. #endif /* powerpc */
  2577. #endif /* L_eh */
  2578.  
  2579. #ifdef L_pure
  2580. #ifndef inhibit_libc
  2581. /* This gets us __GNU_LIBRARY__.  */
  2582. #undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch.  */
  2583. #include <stdio.h>
  2584.  
  2585. #ifdef __GNU_LIBRARY__
  2586.   /* Avoid forcing the library's meaning of `write' on the user program
  2587.      by using the "internal" name (for use within the library)  */
  2588. #define write(fd, buf, n)    __write((fd), (buf), (n))
  2589. #endif
  2590. #endif /* inhibit_libc */
  2591.  
  2592. #define MESSAGE "pure virtual method called\n"
  2593.  
  2594. void
  2595. __pure_virtual ()
  2596. {
  2597. #ifndef inhibit_libc
  2598.   write (2, MESSAGE, sizeof (MESSAGE) - 1);
  2599. #endif
  2600.   _exit (-1);
  2601. }
  2602. #endif
  2603.  
  2604.