home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1266 / altlib.sh next >
Encoding:
Text File  |  1990-12-28  |  2.0 KB  |  112 lines

  1.  
  2. #if 0
  3. # $Header: /pdsrc/Local/RCS/altlib.sh,v 1.1 90/05/01 19:27:02 root Exp $
  4. #
  5. # $Log:    altlib.sh,v $
  6. # Revision 1.1  90/05/01  19:27:02  root
  7. # Initial revision
  8. #
  9. # Script and source code for SCO Xenix gnulib compiled with GCC.
  10. #
  11. # SCO Xenix 386 gnulib only has three self-recursive functions and these
  12. # can be replaced by assembly language versions whose source code is in
  13. # this file.  Executing this file with /bin/sh (NOT csh) in the GCC
  14. # source directory will result in the production of an alternative gnulib
  15. # called altgnulib which is entirely compiled with GCC.
  16. #
  17.  
  18. AR=ar
  19. GCC=gcc
  20. CCLIBFLAGS=-O
  21. INCLUDES="-I. -Iconfig"
  22.  
  23. LIBFUNCS="_eprintf _builtin_new _builtin_New _builtin_del 
  24.     _umulsi3 _mulsi3 _umodsi3 _modsi3 
  25.     _lshrsi3 _lshlsi3 _ashrsi3 _ashlsi3 
  26.     _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 _cmpdf2 
  27.     _fixunsdfsi _floatsidf _truncdfsf2 _extendsfdf2 
  28.     _addsf3 _negsf2 _subsf3 _cmpsf2 _mulsf3 _divsf3"
  29.  
  30. ALIBFUNCS="_udivsi3 _divsi3 _fixdfsi"
  31.  
  32. rm -f altgnulib
  33.  
  34. for name in $LIBFUNCS
  35. do 
  36.       echo Compiling $name
  37.       rm -f $name.c
  38.       cp gnulib.c $name.c
  39.       $GCC $CCLIBFLAGS $INCLUDES -c -DL$name $name.c 
  40.       $AR qc altgnulib $name.o
  41.       rm -f $name.[co]
  42. done
  43.  
  44. for name in $ALIBFUNCS
  45. do 
  46.       echo Assembling $name
  47.       rm -f $name.S
  48.       cp $0 $name.S
  49.       $GCC $CCLIBFLAGS $INCLUDES -c -DL$name $name.S
  50.       $AR qc altgnulib $name.o
  51.       rm -f $name.[So]
  52. done
  53.  
  54. ranlib altgnulib
  55.  
  56. exit 0
  57.  
  58. #endif
  59.  
  60. #ifdef L_udivsi3
  61.     .file    "__udivsi3.s"
  62. .text
  63.     .align 2
  64. .globl ___udivsi3
  65. ___udivsi3:
  66.     pushl %ebp
  67.     movl %esp,%ebp
  68.     movl 8(%ebp),%eax
  69.     xorl %edx,%edx
  70.     divl 12(%ebp)
  71.     leave
  72.     ret
  73. #endif
  74.  
  75. #ifdef L_divsi3
  76.     .file    "__divsi3.s"
  77. .text
  78.     .align 2
  79. .globl ___divsi3
  80. ___divsi3:
  81.     pushl %ebp
  82.     movl %esp,%ebp
  83.     movl 8(%ebp),%eax
  84.     cdq
  85.     idivl 12(%ebp)
  86.     leave
  87.     ret
  88. #endif
  89.  
  90. #ifdef L_fixdfsi
  91.     .file    "__fixdfsi.s"
  92. .text
  93.     .align 2
  94. .globl ___fixdfsi
  95. ___fixdfsi:
  96.     pushl %ebp
  97.     movl %esp,%ebp
  98.     subl    $12,%esp
  99.     fstcw    -4(%ebp)  
  100.     movw    -4(%ebp),%ax
  101.     orw    $0x0c00,%ax  
  102.     movw    %ax,-2(%ebp) 
  103.     fldcw    -2(%ebp)     
  104.     fldl    8(%ebp)
  105.     fistpl    -12(%ebp)    
  106.     fldcw    -4(%ebp)     
  107.     movl    -12(%ebp),%eax
  108.     leave
  109.     ret
  110. #endif
  111.