This repo contains a version of the LLVM/Clang toolchain that is being modified to support Check-C-Box which from the fork of Checked C
Concept»
View Examples
·
Report Bug
·
Request Feature
Table of Contents
Checked C extends C with checked pointer types which are restricted by the compiler to spatially safe uses.
Such pointers have one of three possible types, ptr<T>
, array_ptr<T>
,
or nt_array_ptr<T>
representing a pointer to a single element, array
of elements, or null-terminated array of elements of type T
, respectively. The latter two have an
associated bounds annotation; e.g., a declaration array_ptr<int> p : count(n)
says that p
is a pointer
to an int array whose size is n
. Checked C's Clang/LLVM-based compiler represents checked
pointers as system-level memory words, i.e., without “fattening” metadata ensuring backward
compatibility.
The bounds annotations are used to add dynamic checks on corresponding pointer
accesses to prevent spatial safety violations. Furthermore, these run-time checks are optimized
by LLVM, yielding good performance.
-
Professor/Lead: Dr. Aravind Machiry
-
Lab: PurS3
Researcher(s):
- Arun Kumar Bhattar
Programmers are welcome to use TypeFlexer as it is being implemented. You will have to build your own copy of the compiler. Below are the directions on how to do it.
Step 1: Switch to work Directory
cd <WORK_DIR>
Step 2: Clone the repository
git clone https://github.com/TypeFlexer/TypeFlexer-Clang.git
Step 3: Now create a build directory generate the Cmake files
cd <WORK_DIR>/Typeflexer-Clang/llvm/
mkdir build
cd build
cmake -G Ninja -DLLVM_ENABLE_PROJECTS=clang -DLLVM_ENABLE_RUNTIMES=compiler-rt -DCMAKE_LINKER=/usr/bin/gold DCMAKE_BUILD_TYPE=Debug -DLLVM_LIT_ARGS=-v -DLLVM_PARALLEL_LINK_JOBS=1 ../
Step 6: Now you are all set to build the target Execute any of the following command (based on your requirement) in the build directory
ninja clang //this command will only build the compiler
ninja checkcbox-headers // This command will run all the sanity test cases for TypeFlexer project
Step 5 (Optional) Sanitizers -->
First compile target llvm-config
cd <compiler-rt> // Switch to compiler-rt directory
cmake .
make install
export ASAN_SYMBOLIZER_PATH=<pathToLLVMSymbolizer> // For meaningful ASAN backtrace
cd <WORK_DIR>/Typeflexer-Clang/tests
cd <WORK_DIR>/Typeflexer-Clang/sandboxLib
This repo contains a version of the LLVM/Clang toolchain that is being modified to support the TypeFlexer fork of Checked C. Checked C extends C with checking to detect or prevent common programming errors such as out-of-bounds memory accesses. The SSDP fork of the Checked C specification is available at the SSDP Checked C repo.