Hellscape

Top-level Files of tip
Login

Top-level Files of tip

Files in the top-level directory from the latest check-in


Hellscape

Hellscape is a GCC plugin for obfuscating its IR GIMPLE, inspired by the Obfuscator-LLVM paper by Pascal Junod et al.

Installation

Currently only GNU/Linux is supported. You need CMake, GCC >= 13.1 (with plugins enabled) and GMP. To install to $prefix, run

cmake -B build --install-prefix $prefix
cmake --build build --parallel
cmake --install build --parallel

Usage

gcc -fplugin=$prefix/share/hellscape.so \
    [-fplugin-arg-hellscape-viz=DIR] \
    [-fplugin-arg-hellscape-seed=HEX] \
    [-fplugin-arg-hellscape-sub] \
    [-fplugin-arg-hellscape-bcf] \
    [-fplugin-arg-hellscape-fla] \
    ...

See examples for tutorials.

Adding a custom pass

If you ever get stuck, reference one of the existing passes, they're well documented. That being said, the general idea is as follows:

  1. Create a new pass class, e.g.: ExamplePass, under the file EX.cpp and EX.h,
  2. Copy the contents of SUB.h and re-name the pass data, name of the pass as well as the constructor,
  3. Create a function execute in the corresponding C++ file, and complete your pass,
  4. Register it under the PassManager by adding a new option, register_pass_info and register_callback, as necessary,
  5. Submit the pass for review.

Note that for as pass to be accepted upstream, it must compile for a gcc build that has --enable-checking=yes,rtl,tree added. (You will need to re-build gcc for your target architecture with --enable-checking.)

Additionally: If you experience crashes when developing your plug-in, you can debug them by passing -wrapper gdb,--args to gcc. (Run gcc in gdb, effectively.)

Copying

Hellscape is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.