Giter Club home page Giter Club logo

augment-clang's Introduction

Augment-Clang

About

This tool is designed to assist in the construction of large binary datasets in binary research work, which will be suitable for the following purposes:

  1. Customize optimization level.
  2. Store the object files.
  3. Emit source to object path mapping

Build

Download and compile the LLVM project first:

  1. The ~/LLVM folder will store the llvm repo.
  2. The ~/Auto_LLVM folder will be the output dir of llvm compilation.
mkdir ~/LLVM && cd ~/LLVM
git clone https://github.com/llvm-mirror/llvm.git
cd llvm

cd tools
git clone https://github.com/llvm-mirror/clang.git
cd ..
mkdir build && cd build

mkdir ~/Auto_LLVM
cd ~/LLVM/llvm/build
cmake -DLLVM_TARGETS_TO_BUILD=host -DCMAKE_INSTALL_PREFIX=~/Auto_LLVM -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DCLANG_INCLUDE_TESTS=OFF ..

cmake --build . --target install -- -j24

Clone this repo and apply the patch files after the above steps are successfully executed.

cd ~
git clone https://github.com/P1umer/Augment-Clang.git

cd ~/LLVM/llvm
patch -p1 < ~/Augment-Clang/llvm/llvm.patch
cd ~/LLVM/llvm/tools/clang
patch -p1 < ~/Augment-Clang/llvm/tools/clang/clang.patch

Rebuild it.

cd ~/LLVM/llvm/build
cmake --build . --target install -- -j24

If rebuild fails, check the two REVISON files in this repo which store hash versions of llvm and clang respectively.

Usage

Augment-clang is easy to use. There are just two environment variables you have to set.

1. AUTO_COMPILE_OPTION

The value of this variable will OVERWRITE the original optimization level. For example:

export AUTO_COMPILE_OPTION="-O1"

Optional value: ["-O0","-O1","-O2","-O3","-O4","-Os","-Oz","-Ofast"].

2. AUTO_COMPILE_STORAGE_PATH

This environment variable should be set to the global path to the folder where object file copies will be stored.

export AUTO_COMPILE_STORAGE_PATH="/tmp/copys"

After the compilation is completed, an additional BIN2SRC file that stores the sourcecode to object file path mapping info will also be generated in this folder.

3. Use Augment-Clang

The last step you need to do is to replace the system installed clang with Augment-Clang.

augment-clang's People

Contributors

p1umer avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.