[Android Software/Hacking General [Developers Only]] MusterMaxMueller:
Use Qualcomm Snapdragon LLVM Compiler 3.7.1 (https://developer.qualcomm.com/mobi...-performance/snapdragon-llvm-compiler-android) for Android Lollipop 5.x for devices with Qualcomm CPU

As far as I know nobody has done that yet. Except me :)

This changes the toolchain for CLANG from the default one which comes with Android (aCLANG) to the Qualcomm Snapdragon LLVM Compiler 3.7.1 (qCLANG) mentioned above. The toolchain will be used for almost all places where the default Android CLANG (aCLANG) is used for compiling TARGET MODULES. BUT ONLY if "USE_CLANG_QCOM := true" is set. Otherwise it is using aCLANG. So you can merge this commit and the build will be the same as before except you specifically define "USE_CLANG_QCOM := true"!

WARNING READ CAREFULLY: It is possbile that using this toolchain, especially with the optimizations flags, will introduce BUGS!

DONT SPAM QUALCOMM FORUM PLEASE!

I would suggest: IF YOU USE IT DONT MAKE BUG REPORTS FOR YOUR ROM OR KERNEL OR ANY APPS. Make reports in this development thread. The ROM compiles, boots and starts. Also if Bionic and other modules are compiled with Qualcomm Snapdragon LLVM Compiler 3.7.1 (qCLANG).

Androbench, Antutu, Basemark 2.0 , Geekbench 3, Vellamo are 'completing' the benchmarks. This is a work in progress. There is confirmation that it works for Sony Z Ultra and Samsung Galaxy Note 4 and after some months of testing everything seems good on my personal device.

At the moment this is only tested with Qualcomm Snapdragon 800 but in theory this should also work with any Krait and even Scorpion CPU. According to Documentation there is also support for armv8/aarch64 (Snapdragon 810) and you should gain a real performance bump but support is not yet implemented! If you have a Snapdragon 810 device and want to try this out contact me please.

Install instructions:

You have to make an account in order to download the toolchain!

You need to download the toolchain and extract it to {your android dir}/prebuilts/clang/linux-x86/host/*

Merge/Cherry-Pick this commit: https://github.com/mustermaxmueller/compiler-rt/commit/774cabb50dced5b7acf62af331480397d3a0d12f

Merge/Cherry-Pick this commit: https://github.com/mustermaxmueller/android_build/commit/894f0793d998395e0c15b9ad7a39b277e3aca006

Merge/Cherry-Pick these commits:

https://github.com/mustermaxmueller...mmit/05e2a338b2b66f30d86687c3de4e48d30a2db8d4

https://github.com/mustermaxmueller...mmit/5f4eadfe1bbb5184d650cc9eef8f2306fefc7cdf

You need the Qualcomm Snapdragon LLVM Compiler 3.5 for this to work!!!

OR

Make changes to frameworks/rs/driver/runtime/build_bc_lib_internal.mk like stated here: http://xdaforums.com/showpost.php?p=59626153&postcount=47

Merge/Cherry-Pick this commit: https://github.com/jgcaaprom/android_prebuilt_ndk/commit/98100b2cbeb681698be6093ef964bd1f4414a71f

Set "USE_CLANG_QCOM := true" e.g. in Boardconfig.mk

OPTIONAL (set these options in your Boardconfig.mk):

USE_CLANG_QCOM_VERBOSE := true (If you want to be certain that qclang is used. You will see extra verbose output while compiling.)

USE_CLANG_QCOM_LTO := true (use LTO; not working at the moment)

CLANG_QCOM_COMPILE_ART := true (compile art with qclang)

CLANG_QCOM_COMPILE_BIONIC := true (compile bionic with qclang)

CLANG_QCOM_COMPILE_MIXED := true (compile defined modules with qclang)

CLANG_QCOM_USER_MODULES += (Here you can overwrite which modules should be compiled with qCLANG instead of GCC)

CLANG_QCOM_FORCE_COMPILE_ACLANG_MODULES += (Here you can overwrite which modules should be compiled with aCLANG instead of qCLANG)

Make a clean compile! Also delete ccache!

Annotation:

First boot and every boot after cleaning cache will take up to 15min! Just be patient even if it seems that device is stuck at optimizing apps.

Should also work with Android 6.0 but not tested yet!

You should only get measurable performance benefits if you compile Bionic with CLANG!

Documentation for the toolchain: {your android dir}/prebuilts/clang/linux-x86/host/llvm-Snapdragon_LLVM_for_Android_3.7/prebuilt/linux-x86_64Snapdragon_LLVM_ARM_37_Compiler_User_Guide.pdf

The Flags "-muse-optlibc" and "-ffuse-loops" are not Documented. (http://pastebin.com/PZtk6WHB)

The implementation is not beautiful but it works

HOST is compiled with aCLANG because qCLANG does not understand x86

You can make performance and size comparisons by removing/commenting "USE_CLANG_QCOM := true"

I could have made the installation easier by uploading the toolchain to Github but I do not know if I am allowed to. And I am no lawyer so...

TODO:

-Make more performance comparisons to aCLANG and GCC.

-Compile Android with qCLANG wherever possible. http://www.linuxplumbersconf.org/20...ations/1131/original/LP2013-Android-clang.pdf and https://events.linuxfoundation.org/sites/events/files/slides/2014-ABS-LLVMLinux.pdf

Development Thread: http://xdaforums.com/android/software-hacking/wip-compile-android-5-0-2-qualcomm-llvm-t3035162

Credits:

-@Cl3Kener for looking at the first commit

-@the people whom stuff i used

-@XDA where i learned alot

-@sombree for finding out that you need libllvm3.6 (obsolete)

XDA:DevDB Information

Compile Android with Qualcomm LLVM 3.7.1 for devices with Qualcomm CPU, Tool/Utility for all devices (see above for details)

Contributors

MusterMaxMueller

Version Information

Status: Testing

Created 2015-02-19

Last Updated 2015-11-22