I try to use the obfuscator plugin: GitHub - MaxXor/obfuscator-llvm: Obfuscator as LLVM extension
patched with https://gist.githubusercontent.com/T35R6braPwgDJKq/9f660ee32ba9b7e601a218cf8b16373d/raw/f06e224dde13b4a8c87a17b8239c277b84e4f79d/ollvm.patch
When I set the CFLAGS
for a project to
-Xclang -load -Xclang obfuscator-llvm/build/obfuscator-llvm/ObfuscatorLLVM.so -mllvm -sub -mllvm -bcf -mllvm -fla
the build breaks:
/usr/bin/clang -Xclang -load -Xclang obfuscator-llvm/build/obfuscator-llvm/ObfuscatorLLVM.so -mllvm -sub -mllvm -bcf -mllvm -fla -m64 -Wa,--noexecstack -Qunused-arguments -target x86_64-w64-windows-gnu -v -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib64/engines-3\"" -DMODULESDIR="\"/usr/local/lib64/ossl-modules\"" -DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN -D_MT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -I/usr/x86_64-w64-mingw32/include -c -o crypto/aes/libcrypto-lib-aes-x86_64.obj crypto/aes/aes-x86_64.s
"/usr/bin/clang-14" -cc1as -triple x86_64-w64-windows-gnu -filetype obj -main-file-name aes-x86_64.s -target-cpu x86-64 -I /usr/x86_64-w64-mingw32/include -fdebug-compilation-dir=openssl -dwarf-debug-producer "clang version 14.0.0 (/build/llvm-git/llvm-project 75b08cce47df0a405bfb052f51d70b8e8067d705)" -I /usr/x86_64-w64-mingw32/include -dwarf-version=4 -mrelocation-model pic --mrelax-relocations -mnoexecstack -mllvm -sub -mllvm -bcf -mllvm -fla -o crypto/aes/libcrypto-lib-aes-x86_64.obj crypto/aes/aes-x86_64.s
clang (LLVM option parsing): Unknown command line argument '-sub'. Try: 'clang (LLVM option parsing) --help'
clang (LLVM option parsing): Did you mean '-W'?
clang (LLVM option parsing): Unknown command line argument '-bcf'. Try: 'clang (LLVM option parsing) --help'
clang (LLVM option parsing): Did you mean '-W'?
clang (LLVM option parsing): Unknown command line argument '-fla'. Try: 'clang (LLVM option parsing) --help'
clang (LLVM option parsing): Did you mean '-W'?
make[1]: *** [Makefile:12857: crypto/aes/libcrypto-lib-aes-x86_64.obj] Error 1
make[1]: Leaving directory 'openssl'
make: *** [Makefile:3233: build_sw] Error 2
The minimal test case in the repo does work though:
clang -S -emit-llvm test.c
clang -Xclang -load -Xclang ../build/obfuscator-llvm/ObfuscatorLLVM.so -mllvm -bcf -mllvm -bcf_loop=1 -mllvm -sub -mllvm -sub_loop=1 -mllvm -fla ./test.ll -S -emit-llvm -o test_obfuscated.ll
clang -flto=full -march=native -O3 -Wl,-strip-all -o test test_obfuscated.ll
So I guess, Iām using it wrong?