scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1This patch contains preliminary support for using SCC's libc with Qute <https://git.8pit.net/qute/>.
 2
 3To compile a libc.a for Qute, first compile SCC:
 4
 5	$ guix shell -CPW -D simple-cc gdb
 6	[env]$ make -j10 CFLAGS="-g -O0" SCCMAKE=make CC=gcc HOSTCC=gcc
 7
 8Afterward, build Qute's libc.a with SCC:
 9
10	$ make -f main.mk -j10 CFLAGS="-g -O0" SCCMAKE=make CC=$(pwd)/bin/scc CONF=amd64-qute libc
11
12This will generate `./lib/scc/amd64-qute/libc.a` which can then be preloaded using Qute.
13
14---
15
16Consider the following example:
17
18	#include <assert.h>
19	#include <stdlib.h>
20
21	extern void qute_make_symbolic(void *ptr, size_t nelem, size_t elsiz, const char *name);
22
23	int main(void) {
24		int a;
25		qute_make_symbolic(&a, 1, sizeof(a), "a");
26
27		if (a <= 0)
28			exit(0);
29		assert(a > 0);
30		return 0;
31	}
32
33Compile this as follows to QBE using SCC:
34
35	$ ./bin/scc -c -o test.qbe test.c -R
36
37Afterward, execute the resulting `test.qbe` file using Qute:
38
39	$ qute-symex -p ./lib/scc/amd64-qute/libc.a test.qbe