Skip to content
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

Statically check parts of the RTS code with Frama-C #588

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ rec {
'';
};

rts-frama-c = stdenv.mkDerivation {
name = "asc-rts-frama-c";
src = subpath ./rts;
buildInputs = [ nixpkgs.framac ];
buildPhase = ''
patchShebangs .
./run-frama.sh
'';
installPhase = ''
touch $out
'';
};

asc-bin = stdenv.mkDerivation {
name = "asc-bin";

Expand Down Expand Up @@ -394,6 +407,7 @@ rec {
unit-tests
samples
rts
rts-frama-c
stdlib
stdlib-doc
stdlib-doc-live
Expand Down
3 changes: 3 additions & 0 deletions rts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
as-rts.wasm
test_rts

_build

.frama-c
13 changes: 9 additions & 4 deletions rts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,22 @@ _build/native/tommath_%.o: $(TOMMATHSRC)/bn_%.c | _build/native
# Our part of the RTS, Wasm and native
#

_build/wasm/rts.o: rts.c | _build/wasm
RTSFILES=rts idl bigint

_build/wasm/%.o: %.c | _build/wasm
$(WASM_CLANG) -c $(CLANG_FLAGS) $(WASM_FLAGS) $(TOMMATH_FLAGS) -I$(TOMMATHSRC) --std=c11 $< --output $@

_build/native/rts.o: rts.c | _build/native
_build/native/%.o: %.c | _build/native
$(CLANG) -c $(CLANG_FLAGS) $(TOMMATH_FLAGS) -I$(TOMMATHSRC) --std=c11 $< --output $@

RTS_WASM_O=$(patsubst %,_build/wasm/%.o,$(RTSFILES))
RTS_NATIVE_O=$(patsubst %,_build/native/%.o,$(RTSFILES))

#
# The actual RTS, a we ship it with the compiler
#

as-rts.wasm: _build/wasm/rts.o $(TOMMATH_WASM_O)
as-rts.wasm: $(RTS_WASM_O) $(TOMMATH_WASM_O)
$(WASM_LD) -o $@ \
--import-memory --shared --no-entry --gc-sections \
--export=__wasm_call_ctors \
Expand All @@ -98,7 +103,7 @@ as-rts.wasm: _build/wasm/rts.o $(TOMMATH_WASM_O)
# A simple program to do simple tests of rts.c, using native compilation
#

test_rts: test_rts.c _build/native/rts.o $(TOMMATH_NATIVE_O)
test_rts: test_rts.c $(RTS_NATIVE_O) $(TOMMATH_NATIVE_O)
$(CLANG) -o $@ \
$+
clean:
Expand Down
Loading