This repository is forked from spelle.SPELLE
lease have a look at the wiki!
Current (official) version: LLVM-4.0
Current version(from spelle's reposit) on this repo is LLVM-8.0.0
You can cite Obfuscator-LLVM using the following Bibtex entry:
@INPROCEEDINGS{ieeespro2015-JunodRWM,
author={Pascal Junod and Julien Rinaldini and Johan Wehrli and Julie Michielin},
booktitle={Proceedings of the {IEEE/ACM} 1st International Workshop on Software Protection, {SPRO'15}, Firenze, Italy, May 19th, 2015},
editor = {Brecht Wyseur},
publisher = {IEEE},
title={Obfuscator-{LLVM} -- Software Protection for the Masses},
year={2015},
pages={3--9},
doi={10.1109/SPRO.2015.10},
}
git clone https://github.com/whochi/obfuscator -b llvm-8.0.0 obfuscator-llvm-8.0.0.src
If it failed to download, you shoud directly download from http://releases.llvm.org/8.0.0 each items.
curl -E -fsSL http://releases.llvm.org/8.0.0/cfe-8.0.0.src.tar.xz -o cfe-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/compiler-rt-8.0.0.src.tar.xz -o compiler-rt-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/libcxx-8.0.0.src.tar.xz -o libcxx-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/libcxxabi-8.0.0.src.tar.xz -o libcxxabi-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/libunwind-8.0.0.src.tar.xz -o libunwind-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/lld-8.0.0.src.tar.xz -o lld-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/lldb-8.0.0.src.tar.xz -o lldb-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/openmp-8.0.0.src.tar.xz -o openmp-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/polly-8.0.0.src.tar.xz -o polly-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/clang-tools-extra-8.0.0.src.tar.xz -o clang-tools-extra-8.0.0.src.tar.xz && \
curl -E -fsSL http://releases.llvm.org/8.0.0/test-suite-8.0.0.src.tar.xz -o test-suite-8.0.0.src.tar.xz && \
for f in $(ls *.tar.xz) ; do tar xf $f ; done
cd obfuscator-llvm-8.0.0.src && \
cd projects && \
ln -snf ../../compiler-rt-8.0.0.src compiler-rt && \
ln -snf ../../libcxx-8.0.0.src libcxx && \
ln -snf ../../libcxxabi-8.0.0.src libcxxabi && \
ln -snf ../../libunwind-8.0.0.src libunwind && \
ln -snf ../../openmp-8.0.0.src openmp && \
ln -snf ../../test-suite-8.0.0.src test-suite && \
cd ..
cd tools && \
ln -snf ../../cfe-8.0.0.src clang && \
ln -snf ../../lld-8.0.0.src lld && \
ln -snf ../../lldb-8.0.0.src lldb && \
ln -snf ../../polly-8.0.0.src polly && \
cd clang && \
cd tools && \
ln -snf ../../clang-tools-extra-8.0.0.src extra && \
cd .. && \
cd .. && \
cd .. && \
cd ..
Using cmake & make
mkdir obfuscator-llvm-8.0.0.build
cd obfuscator-llvm-8.0.0.build
cmake -G "Unix Makefiles" -DLLDB_CODESIGN_IDENTITY='' ../obfuscator-llvm-8.0.0.src
make -j7
Following flags can be added to the cmake command line
-DLLVM_ENABLE_ASSERTIONS=ON
-DCMAKE_BUILD_TYPE=Release
From : https://afnan.io/2018-10-01/using-the-latest-llvm-release-on-macos/
cmake -G Ninja \
-DLLDB_CODESIGN_IDENTITY='' \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_CREATE_XCODE_TOOLCHAIN=On \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_BUILD_TYPE=Release \
../obfuscator-llvm-8.0.0.src
ninja -j5
I also recommend using Ninja rather than make to build LLVM, because it will build significantly faster.
Now that you have the XCode toolchain, you can place it in the Toolchains directory in XCode.
sudo ninja install-xcode-toolchain
The toolchain is generated and installed in /usr/local/Toolchains/LLVM8.0.0.xctoolchain
And then, copy to xcode toolchain folder.
sudo cp -rf /usr/local/Toolchains/LLVM8.0.0.xctoolchain ~/Library/Developer/Toolchains/.
sync from xcode default toolchain to o-llvm toolchain.
IMPORTANT!!! : you must typed "/" after "XcodeDefault.xctoolchain" and "LLVM8.0.0.xctoolchain"
sudo rsync -a --ignore-existing \
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ \
~/Library/Developer/Toolchains/LLVM8.0.0.xctoolchain/
Finally, remove ToolchainInfo.plist in o-llvm
sudo rm -rf ~/Library/Developer/Toolchains/LLVM8.0.0.xctoolchain/ToolchainInfo.plist
You need to instruct XCode to actually use the toolchain. You can do so in two ways: from your environment variables, and through the XCode app itself.
I preferred to select toolchains in xcode.
To set it through an environment variable:
export TOOLCHAINS="LLVM8.0.0"
In Xcode.app, you can select Xcode -> Toolchains -> org.llvm.8.0.0 in the menu.
Command line used :
cmake -G Unix Makefiles .. -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/llvm/9.0.0 -DCMAKE_BUILD_TYPE=Release