-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to develop goblint-cil in conjunction with Goblint #293
Conversation
Also, if I did something wrong or goblint-cil build is even more obscure than Goblint's, but EDIT: Apparently deleting the committed |
The nice thing for the
So unless we overhaul the build system of CIL completely (get rid of |
Even though goblint-cil README has the Makefile build before the dune build, I thought the dune build would be the proper one, especially since the opam package is built using dune as well. So that's what I suspect the problem with But either way, if we keep build builds for goblint-cil, then maybe we need its dune build instructions to just say to delete |
The exception to that should be |
Related: goblint/cil#45. |
The problem there is that the the preprocessor output that we feed to CIL and the pre-provided Another way to simplify the generation of |
Isn't the only reason for all this C compilation (automake, Makefile, etc) the generation of machdep.ml? The rest is OCaml code, which can be compiled through dune just fine. CIL even includes some code for parsing these Machdep things from some kind of strings here: https://github.com/goblint/cil/blob/develop/src/machdepenv.ml. No idea if this is used or documented anywhere, or has any examples. But even if there's no default Machdep baked into CIL itself, we'd still need to generate the different variations somehow. And the way to do that would still be to use such generation by printing them from C, which needs to be compiled. So this C compilation is inevitable, the question is simply how to do it as cleanly as possible. |
This, plus |
Tbh, that's not a very good guarantee. It's actually harmful for SV-COMP or #54 if you want to analyze both 32bit and 64bit programs on the same machine. It's even a problem if you compile Goblint (or rather CIL) on one machine and want to distribute the binary to another. There's no simple solution to the latter, but making the architecture choice explicit (including having to explicitly say you want to use the architecture of the machine where CIL was compiled) would still be a good thing. |
Yes, that's what I meant. |
True. Also, if you want to analyze on a machine with a different architecture, you would need to specify the target when invoking the preprocessor to make sure that its output matches the architecture that you specified for CIL. So i think defaulting to the host machine is actually not such a bad idea (as the compiler used to compile |
Why? Current generated (* This module was generated automatically by code in Makefile and machdep-ml.c *)
type mach = {
version_major: int; (* Major version number *)
version_minor: int; (* Minor version number *)
version: string; (* gcc version string *)
underscore_name: bool; (* If assembly names have leading underscore *)
sizeof_short: int; (* Size of "short" *)
sizeof_int: int; (* Size of "int" *)
sizeof_bool: int; (* Size of "_Bool" *)
sizeof_long: int ; (* Size of "long" *)
sizeof_longlong: int; (* Size of "long long" *)
sizeof_ptr: int; (* Size of pointers *)
sizeof_float: int; (* Size of "float" *)
sizeof_double: int; (* Size of "double" *)
sizeof_longdouble: int; (* Size of "long double" *)
sizeof_floatcomplex: int; (* Size of "float _Complex" *)
sizeof_doublecomplex: int; (* Size of "double _Complex" *)
sizeof_longdoublecomplex: int; (* Size of "long double _Complex" *)
sizeof_void: int; (* Size of "void" *)
sizeof_fun: int; (* Size of function *)
size_t: string; (* Type of "sizeof(T)" *)
wchar_t: string; (* Type of "wchar_t" *)
alignof_short: int; (* Alignment of "short" *)
alignof_int: int; (* Alignment of "int" *)
alignof_bool: int; (* Alignment of "_Bool" *)
alignof_long: int; (* Alignment of "long" *)
alignof_longlong: int; (* Alignment of "long long" *)
alignof_ptr: int; (* Alignment of pointers *)
alignof_enum: int; (* Alignment of enum types *)
alignof_float: int; (* Alignment of "float" *)
alignof_double: int; (* Alignment of "double" *)
alignof_longdouble: int; (* Alignment of "long double" *)
alignof_floatcomplex: int; (* Alignment of "float _Complex" *)
alignof_doublecomplex: int; (* Alignment of "double _Complex" *)
alignof_longdoublecomplex: int; (* Alignment of "long double _Complex" *)
alignof_str: int; (* Alignment of strings *)
alignof_fun: int; (* Alignment of function *)
alignof_aligned: int; (* Alignment of anything with the "aligned" attribute *)
char_is_unsigned: bool; (* Whether "char" is unsigned *)
const_string_literals: bool; (* Whether string literals have const chars *)
little_endian: bool; (* whether the machine is little endian *)
__thread_is_keyword: bool; (* whether __thread is a keyword *)
__builtin_va_list: bool; (* whether __builtin_va_list is builtin (gccism) *)
}
let gcc = {
(* Generated by code in src/machdep-ml.c *)
version_major = 11;
version_minor = 1;
version = "11.1.0";
sizeof_short = 2;
sizeof_int = 4;
sizeof_bool = 1;
sizeof_long = 8;
sizeof_longlong = 8;
sizeof_ptr = 8;
sizeof_float = 4;
sizeof_double = 8;
sizeof_longdouble = 8;
sizeof_floatcomplex = 8;
sizeof_doublecomplex = 16;
sizeof_longdoublecomplex = 16;
sizeof_void = 1;
sizeof_fun = 1;
size_t = "unsigned long";
wchar_t = "int";
alignof_short = 2;
alignof_int = 4;
alignof_bool = 1;
alignof_long = 8;
alignof_longlong = 8;
alignof_ptr = 8;
alignof_enum = 4;
alignof_float = 4;
alignof_double = 8;
alignof_longdouble = 8;
alignof_floatcomplex = 4;
alignof_doublecomplex = 8;
alignof_longdoublecomplex = 8;
alignof_str = 1;
alignof_fun = 4;
alignof_aligned = 16;
char_is_unsigned = false;
const_string_literals = true;
underscore_name = false;
__builtin_va_list = true;
__thread_is_keyword = true;
little_endian = true;
}
let hasMSVC = false
let msvc = gcc
let theMachine : mach ref = ref gcc |
That is only when the machine Goblint is run on is one of the predefined architectures (and we can detect that). If you compile CIL and Goblint on one machine and move the binary to another, where the installed GCC has a different value for |
That is true. Didn't go through the record, but hopefully all those things (or the ones we care about) are determined by your combination of OS+Arch+GCC which can be detected. |
Looks like there was no complaint about the documented instructions themselves, so I'll merge this as well. Refactoring |
Issue #208.
I just tried to figure this out on my own and Opam's own documentation is so unhelpful for this. Maybe someone who is more experienced with goblint-cil development knows easier and better ways.