Skip to content

whochi/obfuscator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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},
}

How to Build :

Clone the repo

git clone https://github.com/whochi/obfuscator -b llvm-8.0.0 obfuscator-llvm-8.0.0.src

Retrieve dependencies

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

Create links for projects

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 ..

Create links for tools

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 ..

Launch the build

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

Special case for macOS & Xcode

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.

Brew

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

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • LLVM 49.8%
  • C++ 31.8%
  • Assembly 17.3%
  • Python 0.4%
  • C 0.3%
  • CMake 0.2%
  • Other 0.2%