SUIF 1.3.0.5 / 2.X Patches

This pages contains a few documents and patches that I have written as a result of using the SUIF compilers for various projects. I hope that you may find something here of use!

Contents

SUIF 1.3.0.5 and Cygwin

The purpose of this section is to report the steps that I took to compile SUIF 1.3.0.5 under the latest version of Cygwin (1.3.X). I do not suggest that this is the best way to solve this problem, only that I have succeeded in making it work! Those who are care little about the details should head on down to the quick start instructions. Details of what exactly I did can be found in the details section.

Quick Start Instructions

This section aims at describing the steps required to compile SUIF successfully. I'm assuming that you are familiar with the SUIF 1 install process and have installed Cygwin correctly. The first thing is to apply my patch from within suifhome. This should be done before "make setup" is performed, using the following command:
> patch -p 1 < patch-filename
Secondly, it is necessary to set SUIF to build static libraries, instead of shared ones. This amounts to setting the following environment variables:
> INSTALL_STATIC_LIB=true
> INSTALL_SHARED_LIB=false
> STATIC_LIBS_ONLY=true
Basically, you should now be all set. I suggest the following machine name: "iX86-cygwin-cygwin", where X is the appropriate number.

Notes: The version of GCC I have tested this process on is 2.95.3-5. Also I set COMPILER_NAME to "gcc". Finally, the patch is only applicable to the basesuif package. I have not yet compiled the other packages (e.g. suifbuilder).

Details

This section aims to cover the details of what the patch actually does. Basically, I did the following:
  • Shared libraries on the Windows platform (DLL's) operate differently than on a typical UNIX system. In particular, they cannot have unresolved symbols. This is a problem for SUIF because it leaves the symbol "prog_ver_string" and others unresolved. In addition to this the compilation process is somewhat more convoluted. It may be possible to resolve these problems and build .dll files using SUIF. However, I circumvent these problems by using static libraries instead.

  • Cygwin does some interesting things to overcome the problem that executables on the Windows platform must end in the extension ".exe". For example, "gcc -o tmp" will actually produce the executable "tmp.exe", instead of just "tmp" as on UNIX. To support this, many Cygwin utilities have been extended so that, when asked to operate on a file "tmp" which does not exist, they attempt to operate on "tmp.exe". In particular, the test and cp utilities do this. However, the rm and chmod do not. This causes problems in the suif-install script. My solution to this is not to update suif-install, but instead to adjust various makefiles so that they target "prog.exe" instead of "prog".

  • Cygwin at the moment uses gcc 2.95.3\-5. This version of the compiler uses a stricter notion of constness than egcs 1.1 does. It may be possible to install the egcs compiler, but at the moment it is not part of the cygwin distribution. Therefore, I have fixed up the constness of several parts of SUIF.

  • There are a few other miscellaneous details which need to be fixed. Firstly, the file "suifhome/src/basesuif/I77/fio.h" has been updated to define "NON_UNIX_STDIO" under the Cygwin environment. Secondly, the file "suifhome/src/basesuif/scc/scc.cc" contains the line "assert(setrlimit(RLIMIT_STACK, & rl) == 0);". As far as I can tell the Cygwin version of "setrlimit" always returns -1. To overcome this, I have removed the assertion, leaving just the call to "setrlimit". Thus, scc will continue to operate even when setrlimit fails.

  • In order to cope with various difficulties I encountered with the standard include files, I made some changes to the src/basesuif/scc/commands.def so that the following flags were passed to the preprocessor:
    "-U__GNUC__ -U__GNUC_MINOR__ -U__CYGWIN32__ -U__CYGWIN__ -D__extension__="
    Your mileage may vary with these.
These modifications appear (so far) to work. I would be very interested in any comments on the above or any reports about things which are broken etc. I can be contacted on "d.pearce@doc.ic.ac.uk".

SUIF 2.x Patches

Here you can find a few patches for the SUIF 2 system that may be of use.
  • The STL patch fixes the ``basesuif'' package to be compatible with the STL.

  • This patch fixes a few bugs, which were first identified by David Maze. Read this for more information.

  • Another STL patch fixes the ``extras'' package for use with the STL.

  • These two patches fix memory leaks in the basesuif and extratypes. Note, I think the latter subsumes the former.

  • This one allows SUIF to be compiled at a higher optimisation level with GCC.

  • The final patch improves performance of the name all symbols pass.