Skip to content

LLVMParty/remill-template

Repository files navigation

remill-template

Simple template for using Remill. To understand remill, take a look at the following documentation pages:

The example.cpp lifts mov rcx, 1337 and prints the lifted basic block function.

Setting up the environment

This repository uses a devcontainer.json file to allow you to quickly get started.

1) GitHub Codespaces

Using Codespaces is required for the training

  1. Fork this repository
  2. Click the green <> Code button
  3. Press ... and then New with options...
  4. Change Machine type to 4-core
  5. Then Create codespace
  6. Wait a ~5 minutes while the image is loading ☕

Troubleshooting:

  • Firefox (specifically on Linux) often does not work, try Chrome!
  • Reload the page if
    • Syntax highlighting fails to work
    • Startup takes too long
  • If pasting from the clipboard fails, explicitly grant permission (settings icon on the left of the URL)
  • Remember: save files before trying to recompile!

Remember to shut down your codespace here when you're finished.

I recommend switching to the GitHub Dark theme, because the syntax highlighting works better there.

When prompted by the CMake tools, just close the notifications:

2) Locally with Docker Desktop

At a later date you can set things up locally with Docker Desktop
  • Install/Update Docker Desktop (alternatives)
  • Start Docker Desktop
  • Install Visual Studio Code
  • Clone and open this repository in VS Code (use the HTTPS protocol)
  • Install the Dev Containers extension in VS Code (you should be prompted for recommended extensions)
  • Click the blue 'Reopen in Container' button when prompted (you can also find it in the command palette)

For more detailed steps, check out the Dev Containers tutorial. The instructions after this assume you are running inside the container.

Windows

Because the host filesystem is mounted inside the container you may need to configure Git to not automatically convert line endings:

git config --global core.autocrlf false

Additionally it's recommended to configure Docker to use the WSL 2 backend.

3) Local build

First build the dependencies, this includes LLVM per default. To use your own LLVM, pass -DUSE_EXTERNAL_LLVM=ON:

cmake -G Ninja -B dependencies/build -S dependencies -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build dependencies/build

Note: On Windows this requires a development command prompt and MSVC is not supported, you need to use -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl.

You should then have a dependencies/install folder.

Then build the main project:

cmake -G Ninja -B build "-DCMAKE_PREFIX_PATH:FILEPATH=dependencies/install" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
cmake --build build

For more information, see LLVMParty/packages/dependencies.md.

If you do not want to build LLVM on Windows you can download llvm-19.1.6-install.7z. See build.yml for an example in GitHub Actions.

About

Simple template for using Remill on Windows/Linux/macos.

Resources

License

Stars

Watchers

Forks

Packages