Skip to content

This repo contains a version of clang that is being modified to support Checked C. Checked C is an extension to C that lets programmers write C code that is guaranteed by the compiler to be type-safe.

Notifications You must be signed in to change notification settings

TypeFlexer/Typematic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Issues LinkedIn

animated

Type-based program partitioning

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
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Background

What is RLBOX?

More Details

What is Checked-C?

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.

More Details

Our Idea

Contact

Researcher(s):

  • Arun Kumar Bhattar

Testing out TypeFlexer

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

Testing Playground for TypeFlexer

cd <WORK_DIR>/Typeflexer-Clang/tests

Sandbox Libraries

cd <WORK_DIR>/Typeflexer-Clang/sandboxLib

The TypeFlexer clang repo

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.

About

This repo contains a version of clang that is being modified to support Checked C. Checked C is an extension to C that lets programmers write C code that is guaranteed by the compiler to be type-safe.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 39.4%
  • LLVM 37.9%
  • C 9.9%
  • Assembly 9.1%
  • Python 1.2%
  • MLIR 0.6%
  • Other 1.9%