Compiler plugins?

Johan j at j.nl
Sun Mar 8 22:13:17 UTC 2020


On Sunday, 8 March 2020 at 18:37:49 UTC, Rel wrote:
>
> As of now one thing I can think of is emmiting LLVM IR with 
> LDC, transform it and then compile to native code.

You can pass plugins to LDC, which operate on the LLVM IR. There 
is for example a fuzzing plugin that works for Clang and for LDC.

A very simple example can be found in LDC's testsuite: 
https://github.com/ldc-developers/ldc/tree/master/tests/plugins/addFuncEntryCall
This example inserts a function call to "__test_funcentrycall()" 
at the start of every function.

The fuzz plugin is here: 
https://github.com/google/AFL/blob/master/llvm_mode/afl-llvm-pass.so.cc

cheers,
   Johan



More information about the Digitalmars-d mailing list