[llvm-dev] Success: Bring-up of LLVM/clang-built Linux ARM(32-bit) kernel for Android - Nexus 5

Raghavan Santhanam via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 15 00:35:49 PDT 2018

All the Android versions I have used prior to my Android clang-kernel have
been gcc-built from different ROMs(custom and AOSP) - none of them have
given good experience
in terms of battery usage. AFAIK, for obvious reasons, Google has announced
they have switched over from GCC to LLVM/clang for userspace and for
kernel, they have done it to
some extent - not yet for ARM(32-bit) as I got to know and that's why I was
interested in it to accomplish it.

Having said that, I tried to use GCC-8-cross toolchain for gnueabi to build
the Android kernel, there were some assembler error messages, so researched
upon building the androideabi
version from gcc-8.1 source - the Android NDK toolchain source has some
build scripts which need to be worked upon to pick out-of-tree gcc-source -
so, not a straightforward process.
I saw some Linaro GCC toolchain but of the older 7.* version and not the
latest 8.* one - I have seen some people using Linaro GCC as well to build
the kernel but I didn't see any
positive notes with respect to battery usage with that.

Anyway, I am satisfied with my Android clang-built kernel as it has been
battery efficient as opposed to earlier gcc-built kernels and that's with
rest of the
Android(ramdisk, system image, etc) being the *same* including the
hardware(Nexus 5).

On Thu, Jun 14, 2018 at 11:01 PM, Jean-Michaël Celerier <
jeanmichael.celerier at gmail.com> wrote:

> But... I still don't find any different GCC version? AFAIK they stopped
> updating gcc around ndk10. Did you test at some point with a custom built
> gcc / g++ 8 for instance ?
> -------
> Jean-Michaël Celerier
> http://www.jcelerier.name
> On Fri, Jun 15, 2018 at 2:10 AM, Raghavan Santhanam <
> raghavanil4m at gmail.com> wrote:
>> Looks like you didn't read the whole article. Well, for more complete
>> comparison between GCC and LLVM/clang, I have used four different LLVM/clang
>> versions(old to to the new), from within the Google's Android NDK and
>> from outside of the NDK i.e., from other sources, in my project as under :
>>    1.
>> *NDK r13b LLVM/clang : Android clang version 3.8.256229  (based on LLVM
>>    3.8.256229) *
>>    2.
>> *Qualcomm Snapdragon LLVM/clang for Android : Snapdragon LLVM ARM
>>    Compiler 4.0.2 for Android NDK (based on llvm.org <http://llvm.org> 4.0+) -
>>    clang version 4.0.2 for Android NDK *
>>    3.
>> *NDK r17 LLVM/clang : Android (4691093 based on r316199) clang version
>>    6.0.2 (https://android.googlesource.com/toolchain/clang
>>    <https://android.googlesource.com/toolchain/clang>
>>    183abd29fc496f55536e7d904e0abae47888fc7f)
>>    (https://android.googlesource.com/toolchain/llvm
>>    <https://android.googlesource.com/toolchain/llvm>
>>    34361f192e41ed6e4e8f9aca80a4ea7e9856f327) (based on LLVM 6.0.2svn) *
>>    4. *Main LLVM/clang : Flash clang version 7.0.332826
>>    (https://git.llvm.org/git/clang <https://git.llvm.org/git/clang>
>>    4029c7ddda99ecbfa144f0afec44a192c442b6e5) (https://git.llvm.org/git/llvm
>>    <https://git.llvm.org/git/llvm> 1181c40e0e24e0cca32e2609686db1f14151fc1a)
>>    (based on LLVM 7.0.332826)*
>> And I saw improved battery usage in all these cases as published over
>> there in my article. So, read the entire article before making
>> assumptions... :p
>> On Thu, Jun 14, 2018 at 3:16 PM, Jean-Michaël Celerier <
>> jeanmichael.celerier at gmail.com> wrote:
>>> > The main advantage of the clang-built Android ARM(32-bit) hammerhead
>>> kernel for my Nexus 5 has been the better battery usage when compared to
>>> that of gcc-built kernel, with the same kernel config and hardware(my Nexus
>>> 5 Android Smartphone). Details of the same can be found below.
>>> To be fair, the GCC version which comes with the android ndk has not
>>> been updated for four years, while the clang version is kept up-to-date. It
>>> would be interesting to compare clang and GCC latest releases instead...
>>> that's where the future lies :p
>>> -------
>>> Jean-Michaël Celerier
>>> http://www.jcelerier.name
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180615/6af716ee/attachment-0001.html>

More information about the llvm-dev mailing list