rllvm

Crates.iorllvm
lib.rsrllvm
version0.1.1
sourcesrc
created_at2023-06-22 05:36:51.361942
updated_at2023-06-22 07:03:24.58286
descriptionA tool to build whole-program LLVM bitcode files
homepage
repositoryhttps://github.com/h1994st/rllvm
max_upload_size
id896935
size146,062
Shengtuo Hu (h1994st)

documentation

README

Whole Program LLVM in Rust (rllvm)

rllvm CI

rllvm is a Rust port of gllvm and provides compiler wrappers to build whole-program LLVM bitcode files for projects with source codes.

For more details, please refer to gllvm or wllvm.

Installation

cargo install rllvm

Get Started

rllvm-cxx -o hello tests/data/hello.cc
rllvm-get-bc hello  # Extract the bitcode file `hello.bc`
llvm-dis hello.bc  # Obtain readable `hello.ll` file

Configuration

The default configuration file ~/.rllvm/config.toml will be automatically created, if it does not exist, with the following entries:

Configuration Key Required? Notes
llvm_config_filepath Yes The absolute filepath of llvm-config
clang_filepath Yes The absolute filepath of clang
clangxx_filepath Yes The absolute filepath of clang++
llvm_ar_filepath Yes The absolute filepath of llvm-ar
llvm_link_filepath Yes The absolute filepath of llvm-link
llvm_objcopy_filepath Yes The absolute filepath of llvm-objcopy
bitcode_store_path No The absolute path of the directory that stores intermediate bitcode files
llvm_link_flags No Extra user-provided linking flags for llvm-link
lto_ldflags No Extra user-provided linking flags for link time optimization
bitcode_generation_flags No Extra user-provided flags for bitcode generation, e.g., "-flto -fwhole-program-vtables"
is_configure_only No The configure only mode, which skips the bitcode generation (Default: false)
log_level No Log level (0: nothing, 1: error, 2: warn, 3: info, 4: debug, 5: trace)

Here is an example of the configuration file:

llvm_config_filepath = '/usr/local/Cellar/llvm/16.0.4/bin/llvm-config'
clang_filepath = '/usr/local/Cellar/llvm/16.0.4/bin/clang'
clangxx_filepath = '/usr/local/Cellar/llvm/16.0.4/bin/clang++'
llvm_ar_filepath = '/usr/local/Cellar/llvm/16.0.4/bin/llvm-ar'
llvm_link_filepath = '/usr/local/Cellar/llvm/16.0.4/bin/llvm-link'
llvm_objcopy_filepath = '/usr/local/Cellar/llvm/16.0.4/bin/llvm-objcopy'
bitcode_store_path = '/tmp/bitcode_store'
log_level = 3
Commit count: 47

cargo fmt