-
Notifications
You must be signed in to change notification settings - Fork 96
Description
At present, it's difficult to run clightgen on the .c files in progs/ and progs64/ unless one has an installation of CompCert for x86_32 and for x86_64, with the standard set of include directories. Essentially, that means one needs Linux, either native or in a VM. That's because Cygwin and MacOS no longer support 32-bit mode, and future MacOS support for x86 is iffy.
It would useful to have a portable build for VST, including all the test cases in progs and progs64. I
Up to this point, the .c files in progs/ are assumed to be compiled (with clightgen) for x86_32, and the .c files in progs64 are assumed to be for x86_64. Up until now, that has meant one needs an x86_32 or x86_64 installation of CompCert. And it's almost easy to configure CompCert to cross-compile (e.g., run CompCert on a 64-bit ARM in MacOS, compiling for 32-bit x86 in Linux), but the difficulty is that one needs the target-machine's include directories. As the CompCert manual says, "Cross-compilation (e.g. generating PowerPC code from an x86 host) is possible but requires the installation of a matching GCC or Diab cross compiler and cross libraries."
I propose that we can do this without installing GCC cross libraries. The use of system include files in progs64 and progs is very limited: we only use limited subsets of stddef.h, stdio.h, limits.h, and (in one case) stdint.h. It should be possible to create test-case-specific include directories, progs/include and progs64/include, that have subset implementations of these header files.
Then anyone can install two local CompCert builds, one configured as x86_64-linux, the other as x86_32-linux. In both cases the CompCert ./configure should be with -no-runtime-lib and -no-standard-headers.
The VST Makefile, when the CLIGHTGEN symbol is defined, can also check that clightgen has been configured properly, though this is a bit clumsy: run clightgen on any .c file (even an empty one), and the resulting .v file has an Info struct that describes the configuration.
So, this worth the trouble to implement?