Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7830be3
Remove original CIL
probablytom Sep 29, 2025
43eec0d
goblint/cil liballocs with fixed makefiles, working `allocscc`
probablytom Oct 23, 2025
29d1049
More-or-less building liballocs with goblint/cil
probablytom Dec 16, 2025
bd10eb2
Install cil+configurator to `lib/ocaml`, remove manual deps
probablytom Dec 18, 2025
df74633
Merge branch 'master' into goblint-cil
probablytom Dec 18, 2025
3afcf2b
Clean up clang-18 reference from Makefile (CC is gcc unless CIL_CC set)
probablytom Dec 19, 2025
ebedd22
Update apt dependencies for circleCI
probablytom Dec 19, 2025
fc8d5e8
.gitignore changes to ensure lib/ocaml exists
probablytom Dec 19, 2025
e6f39c3
Add missing dependencies in README.md
mbyzhang Jan 3, 2026
06af2b2
Migrate to Goblint CIL
mbyzhang Jan 3, 2026
c83fded
Bump CIL
mbyzhang Jan 4, 2026
d93466f
compilerwrapper: also treat *.so.X(.Y)(.Z) as deferred link items
mbyzhang Jan 14, 2026
44bdc63
Add remaining pattern matching arms for `instr` after migration to Go…
mbyzhang Jan 14, 2026
905b785
Bump CIL
mbyzhang Jan 14, 2026
9b98bb5
Merge branch 'master' into goblint-cil
mbyzhang Jan 14, 2026
698c834
Revert "tools/lang/c/cilallocs/cilallocs.ml: add missing GStaticAsser…
mbyzhang Jan 14, 2026
da5888c
Merge branch 'master' into goblint-cil
mbyzhang Jan 15, 2026
8bfa0e1
Use https Git URL for contrib/dune for CI to work
mbyzhang Jan 15, 2026
8885302
Cleanup and fix Makefile for CIL dependencies
mbyzhang Jan 16, 2026
6adaacf
Add missing cppo dependency
mbyzhang Jan 17, 2026
2a6e15b
Add missing OCaml runtimes for CI test job
mbyzhang Jan 17, 2026
f0692ee
contrib/Makefile: default CIL_CC to CC
mbyzhang Jan 17, 2026
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
8 changes: 7 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ jobs:
build-essential libbsd-dev libelf-dev libdw-dev binutils-dev zlib1g-dev \
autoconf automake libtool pkg-config autoconf-archive \
g++-10 gcc-10 lib32gcc-10-dev \
ocaml ocamlbuild ocaml-findlib libnum-ocaml-dev \
ocaml ocamlbuild ocaml-findlib libnum-ocaml-dev cppo \
default-jdk-headless python3 \
make git gawk gdb wget libc6-dbg \
ocaml-dune libdune-ocaml-dev \
libyojson-ocaml libyojson-ocaml-dev libppx-deriving-yojson-ocaml-dev \
libzarith-ocaml libzarith-ocaml-dev \
libnum-ocaml libnum-ocaml-dev \
libcsexp-ocaml libcsexp-ocaml-dev \
libunwind-dev libunwind-dev:i386 linux-libc-dev-i386-cross libc6-dev-i386 \
libboost-iostreams-dev libboost-regex-dev \
libboost-serialization-dev libboost-filesystem-dev libffi-dev \
Expand Down Expand Up @@ -65,6 +70,7 @@ jobs:
ca-certificates make build-essential g++-10 autoconf automake libtool \
libelf-dev python3 git gawk libunwind-dev \
ocaml ocamlbuild ocaml-findlib \
libppx-deriving-yojson-ocaml-dev libyojson-ocaml libnum-ocaml libzarith-ocaml \
clang \
libdw-dev binutils-dev libffi-dev \
libboost-iostreams-dev libboost-regex-dev \
Expand Down
9 changes: 6 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
[submodule "contrib/donald"]
path = contrib/donald
url = https://github.com/stephenrkell/donald.git
[submodule "contrib/cil"]
path = contrib/cil
url = https://github.com/stephenrkell/cil.git
[submodule "contrib/elftin"]
path = contrib/elftin
url = https://github.com/stephenrkell/elftin.git
[submodule "contrib/dune"]
path = contrib/dune
url = https://github.com/probablytom/dune.git
[submodule "contrib/cil"]
path = contrib/cil
url = https://github.com/mbyzhangAlt/cil.git
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,16 @@ look something like the following.

$ sudo apt-get install libelf-dev libdw-dev binutils-dev \
autoconf automake libtool pkg-config autoconf-archive \
g++ ocaml ocamlbuild ocaml-findlib \
g++ ocaml ocamlbuild ocaml-dune ocaml-findlib cppo \
libppx-deriving-yojson-ocaml-dev \
default-jre-headless python3 python \
make git gawk gdb wget \
libunwind-dev libc6-dev-i386 zlib1g-dev libc6-dbg \
libboost-{iostreams,regex,serialization,filesystem}-dev && \
libboost-{iostreams,regex,serialization,filesystem}-dev \
cppo libcsexp-ocaml libcsexp-ocaml-dev libyojson-ocaml \
libyojson-ocaml-dev libnum-ocaml libnum-ocaml-dev \
libzarith-ocaml libzarith-ocaml-dev \
linux-libc-dev-i386-cross libdune-ocaml-dev libfindlib-ocaml-dev && \
git clone https://github.com/stephenrkell/liballocs.git && \
cd liballocs && \
git submodule update --init --recursive && \
Expand Down
44 changes: 36 additions & 8 deletions contrib/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
THIS_MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))
CONTRIB := $(realpath $(dir $(THIS_MAKEFILE)))

export LIBALLOCS_OCAML_PREFIX := $(CONTRIB)/../lib/ocaml
CONFIG_MK += \nLIBALLOCS_OCAML_PREFIX := ${LIBALLOCS_OCAML_PREFIX}\n
varlist += LIBALLOCS_OCAML_PREFIX

export OCAML_LIBDEST := ${LIBALLOCS_OCAML_PREFIX}/lib
export OCAMLPATH = ${OCAML_LIBDEST}

export PATH := ${PATH}:${LIBALLOCS_OCAML_PREFIX}/bin

export CC := gcc
export CIL_CC := ${CC}

# NOTE all this env.sh amounts to just a different way to do
# ./configure --with-blah=/path/to/blah ?
# ... but we prefer it because it's more compositional:
Expand Down Expand Up @@ -121,29 +133,45 @@ clean::
# ----------------------------cil

.PHONY: build-cil
build-cil: cil.stamp
build-cil: cil.stamp mainFeature.cmx

.PHONY: dune-configurator
dune-configurator:
cd dune && dune build -p dune-configurator && dune install -p dune-configurator --prefix=${LIBALLOCS_OCAML_PREFIX}

# PROBLEM: cil's ocamlbuild takes a significant time to re-run even in the
# case where nothing's changed. So use a stamp to run around that.
cil.stamp: cil/Makefile $(shell find cil -name '*.c' -o -name '*.ml' -o -name '*.mli' -o -name '*.in' -o -name '*.mly' )
$(MAKE) -C cil all install-local && touch $@
cil/Makefile: cil/configure
cd cil && CC=$${ALLOCSCC_CC:-$${CC:-cc}} ./configure INSTALL="`which install` -p"
cil.stamp: goblint-cil
goblint-cil: dune-configurator
cd cil && dune build && dune build @install && dune install --prefix=${LIBALLOCS_OCAML_PREFIX}
touch cil.stamp

CONFIG_MK += \nCIL_ROOT ?= $(CONTRIB)/cil/\n
varlist += CIL_ROOT
export CIL_ROOT

CONFIG_MK += \nCIL_INSTALL ?= $(CONTRIB)/cil/lib\n
CONFIG_MK += \nCIL_INSTALL ?= ${LIBALLOCS_OCAML_PREFIX}/lib/goblint-cil/\n
varlist += CIL_INSTALL
export CIL_INSTALL

.PHONY: mainFeature.cmx
mainFeature.cmx: cil.stamp
cd cil && cp ${CIL_ROOT}/src/mainFeature.ml ${CIL_ROOT}/src/mainFeature.mli ${CIL_INSTALL} && ocamlfind ocamlopt -c ${CIL_INSTALL}/mainFeature.mli && ocamlfind ocamlopt -linkpkg -package dynlink -package findlib -package str -package zarith -I ${CIL_INSTALL} ${CIL_INSTALL}goblintCil.cmxa ${CIL_INSTALL}mainFeature.ml

.PHONY: goblint-cil-deps
goblint-cil-deps: dune-configurator

clean::
$(MAKE) -C cil clean
cd cil && dune clean
cd dune && dune uninstall -p dune-configurator --prefix=/usr/lib/ocaml/
rm -f cil.stamp

# ----------------------------toolsub

.PHONY: build-toolsub
build-toolsub: build-cil
$(MAKE) -C toolsub wrapper-recursive cilpp-recursive # don't build clang-based cccppp
$(MAKE) -C toolsub/wrapper/example/constructor-priority-checker dumpconstr
#$(MAKE) -C toolsub/wrapper/example/constructor-priority-checker dumpconstr
CONFIG_MK += \nTOOLSUB ?= $(CONTRIB)/toolsub\n
varlist += TOOLSUB

Expand Down
2 changes: 1 addition & 1 deletion contrib/cil
Submodule cil updated 857 files
1 change: 1 addition & 0 deletions contrib/dune
Submodule dune added at ef3b45
52 changes: 26 additions & 26 deletions include/liballocs_cil_inlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ CURRENT_ALLOC_VARS_QUALIFIERS void *__current_allocsite CURRENT_ALLOC_VARS_QUALI

void __liballocs_unindex_stack_objects_counted_by(unsigned long *, void *frame_addr);

extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_alloca_caller_frame_cleanup)(void *counter);
extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_alloca_caller_frame_cleanup)(void *counter)
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_alloca_caller_frame_cleanup)(void *counter);
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_alloca_caller_frame_cleanup)(void *counter)
{
__liballocs_unindex_stack_objects_counted_by((unsigned long *) counter, __builtin_frame_address(0));
}

/* alloca helpers */
extern inline const void *(__attribute__((always_inline,gnu_inline,used)) __liballocs_get_sp)(void);
extern inline const void *(__attribute__((always_inline,gnu_inline,used)) __liballocs_get_sp)(void)
extern inline const void *(__attribute__((always_inline,gnu_inline)) __liballocs_get_sp)(void);
extern inline const void *(__attribute__((always_inline,gnu_inline)) __liballocs_get_sp)(void)
{
unsigned long our_sp;
#ifdef UNW_TARGET_X86
Expand All @@ -104,8 +104,8 @@ extern inline const void *(__attribute__((always_inline,gnu_inline,used)) __liba
return (const void*) our_sp;
}

extern inline const void *(__attribute__((always_inline,gnu_inline,used)) __liballocs_get_bp)(void);
extern inline const void *(__attribute__((always_inline,gnu_inline,used)) __liballocs_get_bp)(void)
extern inline const void *(__attribute__((always_inline,gnu_inline)) __liballocs_get_bp)(void);
extern inline const void *(__attribute__((always_inline,gnu_inline)) __liballocs_get_bp)(void)
{
return (const void *) __builtin_frame_address(0);
}
Expand All @@ -118,8 +118,8 @@ extern inline const void *(__attribute__((always_inline,gnu_inline,used)) __liba
* for the allocation site / type metadata. We call a helper to get
* the *overall* size, and then the __liballocs_notify_and_adjust_alloca()
* function will fill in both the header and the trailer. */
extern inline unsigned long (__attribute__((always_inline,gnu_inline,used)) __liballocs_alloca_size)(unsigned long orig_size);
extern inline unsigned long (__attribute__((always_inline,gnu_inline,used)) __liballocs_alloca_size)(unsigned long orig_size)
extern inline unsigned long (__attribute__((always_inline,gnu_inline)) __liballocs_alloca_size)(unsigned long orig_size);
extern inline unsigned long (__attribute__((always_inline,gnu_inline)) __liballocs_alloca_size)(unsigned long orig_size)
{
/* Insert heap trailer etc..
* Basically we have to do everything that our malloc hooks, allocator wrappers
Expand All @@ -138,8 +138,8 @@ extern inline unsigned long (__attribute__((always_inline,gnu_inline,used)) __li
* we don't track them. */
}

extern inline void *(__attribute__((always_inline,gnu_inline,used)) __liballocs_notify_and_adjust_alloca)(void *allocated, unsigned long orig_size, unsigned long tweaked_size, unsigned long *frame_counter, void *caller);
extern inline void *(__attribute__((always_inline,gnu_inline,used)) __liballocs_notify_and_adjust_alloca)(void *allocated, unsigned long orig_size, unsigned long tweaked_size, unsigned long *frame_counter, void *caller)
extern inline void *(__attribute__((always_inline,gnu_inline)) __liballocs_notify_and_adjust_alloca)(void *allocated, unsigned long orig_size, unsigned long tweaked_size, unsigned long *frame_counter, void *caller);
extern inline void *(__attribute__((always_inline,gnu_inline)) __liballocs_notify_and_adjust_alloca)(void *allocated, unsigned long orig_size, unsigned long tweaked_size, unsigned long *frame_counter, void *caller)
{
#ifndef LIBALLOCS_NO_ZERO
__builtin_memset(allocated, 0, tweaked_size);
Expand Down Expand Up @@ -213,8 +213,8 @@ struct __liballocs_memrange_cache
};
extern struct __liballocs_memrange_cache /* __thread */ __liballocs_ool_cache;

extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_check_cache_sanity )(struct __liballocs_memrange_cache *cache __attribute__((unused)));
extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_check_cache_sanity )(struct __liballocs_memrange_cache *cache __attribute__((unused)))
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_check_cache_sanity )(struct __liballocs_memrange_cache *cache __attribute__((unused)));
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_check_cache_sanity )(struct __liballocs_memrange_cache *cache __attribute__((unused)))
{
#ifdef DEBUG
unsigned visited_linear = 0u;
Expand Down Expand Up @@ -247,8 +247,8 @@ extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_c
#endif
}

extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_cache_unlink )(struct __liballocs_memrange_cache *cache, unsigned i);
extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_cache_unlink )(struct __liballocs_memrange_cache *cache, unsigned i)
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_cache_unlink )(struct __liballocs_memrange_cache *cache, unsigned i);
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_cache_unlink )(struct __liballocs_memrange_cache *cache, unsigned i)
{
__liballocs_check_cache_sanity(cache);
/* unset validity and make this the next victim */
Expand All @@ -266,8 +266,8 @@ extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_c
__liballocs_check_cache_sanity(cache);
}

extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_cache_push_head_mru )(struct __liballocs_memrange_cache *cache, unsigned i);
extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_cache_push_head_mru )(struct __liballocs_memrange_cache *cache, unsigned i)
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_cache_push_head_mru )(struct __liballocs_memrange_cache *cache, unsigned i);
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_cache_push_head_mru )(struct __liballocs_memrange_cache *cache, unsigned i)
{
__liballocs_check_cache_sanity(cache);
/* Put us at the head of the LRU chain. */
Expand All @@ -284,8 +284,8 @@ extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_c
__liballocs_check_cache_sanity(cache);
}

extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_cache_bump_victim )(struct __liballocs_memrange_cache *cache, unsigned i);
extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_cache_bump_victim )(struct __liballocs_memrange_cache *cache, unsigned i)
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_cache_bump_victim )(struct __liballocs_memrange_cache *cache, unsigned i);
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_cache_bump_victim )(struct __liballocs_memrange_cache *cache, unsigned i)
{
__liballocs_check_cache_sanity(cache);
/* make sure we're not the next victim */
Expand All @@ -299,8 +299,8 @@ extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_c
__liballocs_check_cache_sanity(cache);
}

extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_cache_bump_mru )(struct __liballocs_memrange_cache *cache, unsigned i);
extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_cache_bump_mru )(struct __liballocs_memrange_cache *cache, unsigned i)
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_cache_bump_mru )(struct __liballocs_memrange_cache *cache, unsigned i);
extern inline void (__attribute__((always_inline,gnu_inline)) __liballocs_cache_bump_mru )(struct __liballocs_memrange_cache *cache, unsigned i)
{
__liballocs_check_cache_sanity(cache);
if (cache->head_mru != i)
Expand All @@ -312,10 +312,10 @@ extern inline void (__attribute__((always_inline,gnu_inline,used)) __liballocs_c
}

extern inline
struct __liballocs_memrange_cache_entry_s *(__attribute__((always_inline,gnu_inline,used))
struct __liballocs_memrange_cache_entry_s *(__attribute__((always_inline,gnu_inline))
__liballocs_memrange_cache_lookup )(struct __liballocs_memrange_cache *cache, const void *obj, struct uniqtype *t, unsigned long require_period);
extern inline
struct __liballocs_memrange_cache_entry_s *(__attribute__((always_inline,gnu_inline,used))
struct __liballocs_memrange_cache_entry_s *(__attribute__((always_inline,gnu_inline))
__liballocs_memrange_cache_lookup )(struct __liballocs_memrange_cache *cache, const void *obj, struct uniqtype *t, unsigned long require_period)
{
#ifndef LIBALLOCS_NOOP_INLINES
Expand Down Expand Up @@ -352,10 +352,10 @@ __liballocs_memrange_cache_lookup )(struct __liballocs_memrange_cache *cache, co
}

extern inline
struct __liballocs_memrange_cache_entry_s *(__attribute__((always_inline,gnu_inline,used))
struct __liballocs_memrange_cache_entry_s *(__attribute__((always_inline,gnu_inline))
__liballocs_memrange_cache_lookup_notype )(struct __liballocs_memrange_cache *cache, const void *obj, unsigned long require_period);
extern inline
struct __liballocs_memrange_cache_entry_s *(__attribute__((always_inline,gnu_inline,used))
struct __liballocs_memrange_cache_entry_s *(__attribute__((always_inline,gnu_inline))
__liballocs_memrange_cache_lookup_notype )(struct __liballocs_memrange_cache *cache, const void *obj, unsigned long require_period)
{
#ifndef LIBALLOCS_NOOP_INLINES
Expand Down Expand Up @@ -389,8 +389,8 @@ __liballocs_memrange_cache_lookup_notype )(struct __liballocs_memrange_cache *ca
return (struct __liballocs_memrange_cache_entry_s *)(void*)0;
}

extern inline struct uniqtype *(__attribute__((always_inline,gnu_inline,used)) __liballocs_get_cached_object_type)(const void *addr);
extern inline struct uniqtype *(__attribute__((always_inline,gnu_inline,used)) __liballocs_get_cached_object_type)(const void *addr)
extern inline struct uniqtype *(__attribute__((always_inline,gnu_inline)) __liballocs_get_cached_object_type)(const void *addr);
extern inline struct uniqtype *(__attribute__((always_inline,gnu_inline)) __liballocs_get_cached_object_type)(const void *addr)
{
struct __liballocs_memrange_cache_entry_s *found = __liballocs_memrange_cache_lookup_notype(
&__liballocs_ool_cache,
Expand Down
8 changes: 8 additions & 0 deletions lib/ocaml/.gitignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the makefile should mkdir -p instead

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# We want to ensure lib/ocaml _always_ exists, but we can't commit an empty dir
# to a git repo. There has to be some content at this path. However, everything
# that gets placed here is a build artifact that shouldn't be committed.

# So: ignore everything in this directory _except_ this file, so that this file
# ensures the path exists.
*
!.gitignore
2 changes: 1 addition & 1 deletion tools/allocscompilerwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ def main(self):
linkItemsIncluded = []
linkItemsDeferred = []
for item in allLinkItems:
if item.startswith("-L") or item.startswith("-l") or item.endswith(".so"):
if item.startswith("-L") or item.startswith("-l") or re.match(".*\\.so(\\.[0-9]+)*$", item):
linkItemsDeferred += [item]
else:
linkItemsIncluded += [item]
Expand Down
14 changes: 11 additions & 3 deletions tools/lang/c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ OCAMLFIND ?= ocamlfind
ifeq ($(CIL_INSTALL),)
$(error "Expected CIL_INSTALL to be set")
endif
ifeq ($(LIBALLOCS_OCAML_PREFIX),)
$(error "Expected LIBALLOCS_OCAML_PREFIX to be set")
endif

export OCAMLPATH := $(LIBALLOCS_OCAML_PREFIX)/lib:$(OCAMLPATH)

CILLY ?= $(CIL_INSTALL)/../bin/cilly
CIL_TOOLS ?= cilallocs dumpallocs monalloca dumpmemacc trapptrwrites
OCAMLFLAGS += -package findlib
OCAMLFLAGS += -I $(CIL_INSTALL)/cil -I $(dir $(THIS_MAKEFILE))/cilallocs
OCAMLFLAGS += -package findlib -package goblint-cil
OCAMLFLAGS += -I $(dir $(THIS_MAKEFILE))/cilallocs
OCAMLFLAGS += -open GoblintCil -open GoblintCil.Cilint

CIL_TOOLS_SRC := $(shell find $(CIL_TOOLS) $(realpath $(dir $(THIS_MAKEFILE)))/lib -name '*.ml')

Expand All @@ -27,6 +34,7 @@ DEPS += $(OCAML_DEPS)
$(OCAMLFIND) ocamlopt -shared -o "$@" $(OCAMLOPTFLAGS) $(OCAMLFLAGS) $+
%.cmx %.cmi: %.ml
$(OCAMLFIND) ocamlopt -o "$@" $(OCAMLOPTFLAGS) $(OCAMLFLAGS) -c "$<"
goblintCil.cmo: goblintCil.ml ;
%.cmo %.cmi: %.ml
$(OCAMLFIND) ocamlc -o "$@" $(OCAMLFLAGS) -c "$<"
%.cma: %.cmo
Expand All @@ -46,4 +54,4 @@ monalloca/monalloca.cmo: cilallocs/cilallocs.cmo

.PHONY: clean
clean:
for dir in $(CIL_TOOLS); do (cd $$dir && rm -f *.o *.cmo *.cma *.cmi *.cmx *.cmxa *.cmxs *.cil.c *.i ); done
for dir in $(CIL_TOOLS); do (cd $$dir && rm -f *.o *.cmo *.cma *.cmi *.cmx *.cmxa *.cmxs *.cil.c *.i *.d ); done
12 changes: 4 additions & 8 deletions tools/lang/c/bin/allocscc
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@ import os, sys, re, subprocess, tempfile
REAL_FILE = os.path.realpath(__file__)
REAL_DIR = os.path.realpath(os.path.dirname(REAL_FILE))
liballocs_base = os.path.realpath(REAL_DIR + "/../../../..")
ocaml_prefix = os.environ.get("LIBALLOCS_OCAML_PREFIX", liballocs_base + "/lib/ocaml")
cilly_cmd = ocaml_prefix + "/bin/cilly"
sys.path.append(liballocs_base + "/tools")
from allocscompilerwrapper import *
existing_cil_install = os.environ.get("CIL_INSTALL")
if existing_cil_install == None:
cilly_cmd = liballocs_base + "/contrib/cil/bin/cilly"
existing_cil_install = liballocs_base + "/contrib/cil/lib"
else:
cilly_cmd = existing_cil_install + "/../bin/cilly"
existing_elftin = os.environ.get("ELFTIN")
if existing_elftin == None:
os.putenv("ELFTIN", liballocs_base + "/contrib/elftin")
existing_ocamlpath = os.environ.get("OCAMLPATH")
if existing_ocamlpath == None:
existing_ocamlpath = ""
os.putenv("OCAMLPATH", existing_cil_install + ":" + existing_ocamlpath)
os.putenv("OCAMLPATH", ocaml_prefix + "/lib:" + existing_ocamlpath)
os.putenv("LANG", "C") # Allow allocscc to be called with non-english locales

class AllocsCC(AllocsCompilerWrapper):
Expand Down Expand Up @@ -95,7 +91,7 @@ class AllocsCC(AllocsCompilerWrapper):
return []
return [
"--decil",
"--native",
#"--native",
"--load=%s" % (self.getLibAllocsBaseDir() + "/tools/lang/c/cilallocs/cilallocs.cmxs"),
"--load=%s" % (self.getLibAllocsBaseDir() + "/tools/lang/c/dumpallocs/dumpallocs.cmxs"),
"--dodumpallocs",
Expand Down
Loading