home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume23 / xenix-gnu / part01 / README.GCC < prev   
Encoding:
Text File  |  1991-09-27  |  8.0 KB  |  209 lines

  1. # @(#) $Id: README.GCC,v 1.2 1991/08/22 20:02:56 ronald Exp $
  2.  
  3. This README describes the port of GNU CC to SCO XENIX 386 from RoboBar Ltd.
  4. This port consists of patch kits to GCC 1.40, GAS 1.38.1 and GDB 3.5
  5. The port was done by Steve Bleazard <steve@robobar.co.uk> with assistance
  6. from Ronald Khoo <ronald@ibmpcug.co.uk> who wrote this README and packaged
  7. the kit.
  8.  
  9. Disclaimer:  RoboBar Ltd has no connection with the Santa Cruz Operation
  10.          whatsoever, other than being an indirect customer of theirs.
  11.          There is no warranty, nor claim of fitness for any purpose of
  12.          any program code you may happen to find in these files.
  13.          Various trademarks of Intel Corp,  Microsoft Corp, and the
  14.          Santa Cruz Operation, Inc. are mentioned in these files,
  15.          and are hereby acknowledged.
  16.  
  17. (C) Copyright 1991 RoboBar Ltd.  Permission is granted to redistribute
  18.     this article without any encumbrance, other than that this copyright
  19.     notice be retained, and that any modifications be clearly marked as such.
  20.  
  21. Overview:
  22.  
  23. This port works on SCO XENIX 386.  It has been tested on:
  24.     OS version: 2.3.4  with  Development System version 2.3.1b
  25. but we believe that it should be useable with some effort on versions
  26. 2.2 and later.
  27.  
  28. The object file format used is the native Microsoft/Intel OMF format,
  29.     so the GNU binutils are not used.  Therefore, this port is
  30.     compatible with third party SCO-compatible object libraries.
  31. The SCO Development System provides the system libraries and include files.
  32. The standard Microsoft assembler is not used -- instead the GNU assembler
  33.     was ported to produce OMF.
  34. A linker helper-program (provided by Christoph Badura <bad@flatlin.ka.sub.org>,
  35.     installed as /usr/local/lib/gcc-ld) helps gcc's -L -l options to work.
  36.     However, the standard XENIX /bin/ld does the real linking--it
  37.     is executed by Christoph's program.
  38. Symbolic debugging is supported for the accompanying port of GDB only.
  39.     SCO's sdb debugging format is not documented, and seems to change
  40.     from release to release, so we can't support it.
  41. The port of GDB was started from an sdb-based port by rdk386!ron (Ron Kuris)
  42.     Without his lead, this port would probably not exist.
  43. The GNU compiler system, as modified by these patches, serves as our
  44.     production compiler at RoboBar.  We believe it to be of
  45.     production quality, and in any case of much higher quality than
  46.     SCO XENIX's native Microsoft compiler system.
  47.  
  48. This README documents how to compile and install this GCC port from
  49. the patches alone.  You can skip some of the steps if you already
  50. have XENIX GCC binaries from earlier versions of this XENIX GCC port.
  51. If you are building from scratch, you can use the commands indicated
  52. by => in this README as a guide.  On *our* system, those commands
  53. were directly executed from this file via a script.  If your version
  54. of XENIX or the Development System is different from ours, you may
  55. have to hack a bit, though.
  56.  
  57. Note that parts of the procedure require you to be root, with a umask no
  58. more paranoid than 022.
  59.  
  60. What you need:
  61.  
  62.     SCO XENIX 386 Operating System
  63.     SCO XENIX 386 Development System
  64.     Larry Wall's "patch" program, version 2, patchlevel 12.
  65.         (from volume 7 of comp.sources.unix, or the GNU
  66.          enhanced one from prep.ai.mit.edu)
  67.     The standard GNU distributions of the compiler and assembler:
  68.         gcc-1.40.tar.Z and gas-1.38.1.tar.Z
  69.         (from prep.ai.mit.edu:/pub/gnu)
  70.     The three patches in this kit:
  71.         gcc-1.40.pch
  72.         gas-1.38.pch
  73.         gdb-3.5b.pch
  74.     A modicum of free disc space.  10 Mb is comfortable.  You can
  75.     do it with less, but the instructions here assume 10Mb free.
  76.  
  77.     Patience.  Lots of patience.  The patience of a saint.
  78.  
  79. What to do:
  80.  
  81.     First, ensure /usr/local/bin is in your PATH, and that
  82.     the "patch" program can be found in your path.
  83. =>    PATH=/usr/local/bin:/bin:/usr/bin export PATH
  84.  
  85.     Next, unpack the GNU distributions, and copy alloca.c from
  86.     the GCC directory into the GAS directory:
  87.  
  88. =>    zcat < gas-1.38.1.tar.Z | tar xf -
  89. =>    zcat < gcc-1.40.tar.Z | tar xf -
  90. =>    zcat < gdb-3.5.tar.Z | tar xf -
  91. =>    cp gcc-1.40/alloca.c gas-1.38/alloca.c
  92.  
  93.     Now, compile the GNU assembler with the standard compiler.
  94.         (Do not switch the optimiser on, as this will cause
  95.          incorrect code to be generated.  And "const" breaks it)
  96. =>    cd gas-1.38
  97. =>    patch < ../gas-1.38.pch
  98. =>    cc -c alloca.c
  99. =>    make ax386 G0="-Dconst= -DUSG -DWORKING_DOT_WORD" O1= LOADLIBES=alloca.o
  100.  
  101.     (Throughout this build, you will get plenty of warning messages
  102.      from the compiler.  At this stage, it is best to ignore them)
  103.  
  104.     Now, install the assembler as /usr/local/lib/gcc-as
  105.  
  106. =>    mkdir /usr/local ; mkdir /usr/local/lib ; mkdir /usr/local/bin
  107. =>    cp ax386 /usr/local/lib/gcc-as
  108.  
  109.     Now, you need to make minimal necessary changes to your
  110.     system include files and then build gcc itself.
  111.     You may have to modify fixmin.xenix depending on your version
  112.     of the Operating and Development systems.  Sigh.
  113.  
  114. =>    cd ../gcc-1.40
  115. =>    patch -p < ../gcc-1.40.pch
  116. =>    sh fixmin.xenix        # have to be root to do this!
  117. =>    sh config.gcc xenix386
  118.  
  119.     Compile gcc for the first time using the Microsoft compiler:
  120.  
  121. =>    make -f Makefile.msc -f Makefile msc ALLOCA=alloca.o CFLAGS=
  122.  
  123.     (This build may fail somewhere and core dump near the end when
  124.      it tries to build gnulib2.  Ignore it, it doesn't matter)
  125.  
  126.     Save this version of gcc, then make gcc with this saved version.
  127.  
  128. =>    make stage1
  129. =>    make CC=stage1/gcc CFLAGS=-Bstage1/    # cannot optimise yet
  130.  
  131.     Now we can build an optimised version of gcc.
  132.  
  133. =>    make stage2
  134. =>    rm -rf stage1    # regain some disc space if you're short of it.
  135. =>    make CC=stage2/gcc CFLAGS="-Bstage2/ -O"
  136.  
  137.     At this point, we have a correctly compiled version of gcc.
  138.     We now install it, then go and recompile gas with gcc
  139.  
  140. =>    make install INSTALL=cp
  141. =>    cd ../gas-1.38
  142. =>    rm -f *.o ax386
  143. =>    make ax386 G0="-O -DUSG -DWORKING_DOT_WORD" O1= LOADLIBES= CC=gcc
  144. =>    cp ax386 /usr/local/lib/gcc-as
  145. =>    rm -f /usr/local/bin/gas
  146. =>    ln /usr/local/lib/gcc-as /usr/local/bin/gas
  147.  
  148.     Finally, we compile gcc again, using a correctly built gas.
  149.  
  150. =>    cd ../gcc-1.40
  151. =>    make stage3
  152. =>    rm -rf stage2    # regain some disc space if you're short of it.
  153. =>    make CC=stage3/gcc CFLAGS="-Bstage3/ -O"
  154.  
  155.     In fact, if we're lucky, this version should be identical to
  156.     the previous version, and if it is, we're happy.  So let's check.
  157.  
  158. =>    for i in *.o ; do cmp -s $i stage3/$i || echo $i broke ; done
  159.  
  160.     (Hopefully none should break, if any do, you will have to iterate
  161.      through more stage builds of both gcc and gas until it no longer
  162.      breaks)
  163.  
  164.     Now, we install Christopher's ld helper program so that
  165.     gcc's -l and -L options will work:
  166.  
  167. =>    gcc -O -Iconfig xenixld.c -o gcc-ld
  168. =>    cp gcc-ld /usr/local/lib/gcc-ld
  169.  
  170.     Now, it's probably wise to undo the damage we did to /usr/include
  171.  
  172. =>    sh fixmin.xenix undo
  173.  
  174.     However, the include files are really not in a useable state.
  175.     You will have to hack them a lot, but the fix.h.xenix file contains
  176.     a few useful hints.  But *PLEASE* read it before you execute it,
  177.     as it may well need customising for your site.  In particular,
  178.     if you've done stuff like adding #ifdef _SIZE_T to your include files,
  179.     the script may not work anymore.  But the __M_I386__ hack in there
  180.     must be done, or else you won't be able to use gcc -ansi.
  181.  
  182. =>    sh fix.h.xenix
  183.  
  184.     I guess a debugger is useful to have so let's build that:
  185.  
  186. =>    cd ../dist-gdb
  187. =>    patch -p < ../gdb-3.5b.pch
  188. =>    sh config.gdb xenix386
  189.  
  190.     Depending on the version of your Development System libraries,
  191.     you may have to edit m-xenix386.h at this point to #define
  192.     the symbol PTRACE_ADDR_ARG_STRUCT.  This is necessary for version 2.2,
  193.     but not for 2.3 (the default).
  194.  
  195. =>    make CC=gcc GLOBAL_CFLAGS="-O -I. -traditional -DNO_PROTOTYPE"
  196. =>    mv gdb /usr/local/bin
  197.  
  198.     There's a helper module that's useful for use with GDB.
  199.     Read the source file gdbspace.asm for more info.
  200.     (/usr/lib/storel is part of your XENIX link kit).
  201. =>    /usr/lib/storel gdbspace.asm && mv gdbspace.o /usr/local/lib/libgdb.a
  202.  
  203.     Then it's probably time for a long beer.  Of course, Murphy's
  204.     Law states that your disc controller will probably die,
  205.     destroying your disc in the process just at this point ....
  206.  
  207. If you come across any XENIX-related GCC problems, please send mail to
  208. Steve Bleazard <steve@robobar.co.uk>  or  uunet!mcsun!ukc!robobar!steve
  209.