<div dir="ltr"><div><div>Hi,<br></div>some good news - Linaro is now officially interested in building kernels with clang.<br><br></div><div>Our initial target will be getting the HiKey board booting AOSP with both kernel and userland compiled with clang.<br><br></div><div>I&#39;ve created a git repository, initially rebasing the llvmlinux patches to the HiKey kernel (which is essentially 4.4.0 + AOSP patches + some extra hardware support patches - while untested, it should be possible to just build that kernel for x86 as well) at<br></div><div><br>git://<a href="http://android-git.linaro.org/kernel/hikey-clang.git" target="_blank">android-git.linaro.org/kernel/hikey-clang.git</a><br><br></div><div>The interesting branch is android-hikey-linaro-4.4-clang - the upstream non-clang-buildable kernel sits in the android-hikey-linaro-4.4 branch in case anyone wants to git format-patch or the likes.<br><br></div><div>The patchset is quite a bit smaller than what&#39;s on llvmlinux-current - almost half the patches that used to be there have either been merged or obsoleted.<br></div><div><br></div><div>My rebased tree is almost buildable again (at least in the HiKey config) - with clang 3.8, the HiKey target compiles, but fails during linking stage.<br><br></div><div>I&#39;m currently at ELC and won&#39;t have a lot of time to continue from there for a couple of days - has anyone run into (or even fixed) these errors before?<br><br>arch/arm64/kernel/built-in.o: In function `debug_monitors_arch&#39;:<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:36: undefined reference to `mcount&#39;<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:36:(.text+0xc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:37: undefined reference to `mcount&#39;<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:37:(.text+0x20): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>arch/arm64/kernel/built-in.o: In function `cpuid_feature_extract_field&#39;:<br>/home/bero/repos/linux/./arch/arm64/include/asm/cpufeature.h:128: undefined reference to `mcount&#39;<br>/home/bero/repos/linux/./arch/arm64/include/asm/cpufeature.h:128:(.text+0x24): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>arch/arm64/kernel/built-in.o: In function `create_debug_debugfs_entry&#39;:<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:66: undefined reference to `mcount&#39;<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:66:(.text+0x40): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>arch/arm64/kernel/built-in.o: In function `enable_debug_monitors&#39;:<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:88: undefined reference to `mcount&#39;<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:88:(.text+0x80): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>arch/arm64/kernel/built-in.o:/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:91: more undefined references to `mcount&#39; follow<br>arch/arm64/kernel/built-in.o: In function `enable_debug_monitors&#39;:<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:91:(.text+0x84): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>arch/arm64/kernel/built-in.o: In function `preempt_count&#39;:<br>/home/bero/repos/linux/include/asm-generic/preempt.h:10:(.text+0x88): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>arch/arm64/kernel/built-in.o: In function `enable_debug_monitors&#39;:<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:91:(.text+0x9c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:91:(.text+0xa4): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:93:(.text+0xbc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `mcount&#39;<br>/home/bero/repos/linux/arch/arm64/kernel/debug-monitors.c:93:(.text+0xc4): additional relocation overflows omitted from the output<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>aarch64-mandriva-linux-gnu-ld: Dwarf Error: Info pointer extends beyond end of attributes<br>drivers/built-in.o: In function `__acpi_processor_start&#39;:<br>/home/bero/repos/linux/drivers/acpi/processor_driver.c:250: undefined reference to `acpi_idle_driver&#39;<br>/home/bero/repos/linux/drivers/acpi/processor_driver.c:250: undefined reference to `acpi_idle_driver&#39;<br>/home/bero/repos/linux/drivers/acpi/processor_driver.c:251: undefined reference to `mcount&#39;<br>/home/bero/repos/linux/drivers/acpi/processor_driver.c:253: undefined reference to `mcount&#39;<br>/home/bero/repos/linux/drivers/acpi/processor_driver.c:263: undefined reference to `mcount&#39;<br>drivers/built-in.o: In function `acpi_processor_notify&#39;:<br>/home/bero/repos/linux/drivers/acpi/processor_driver.c:70: undefined reference to `mcount&#39;<br>/home/bero/repos/linux/drivers/acpi/processor_driver.c:78: undefined reference to `mcount&#39;<br>drivers/built-in.o:/home/bero/repos/linux/drivers/acpi/processor_driver.c:89: more undefined references to `mcount&#39; follow<br><br><br></div><div>Build instructions for HiKey are pretty much as expected:<br>make CC=clang HOSTCC=clang CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 hikey_defconfig<br>make CC=clang HOSTCC=clang CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 -j24<br><br></div><div>Once HiKey is working, will also rebase the patches to master.<br></div><div><br></div><div>There&#39;s a gerrit server connected to the repository as well, <a href="http://android-review.linaro.org/">http://android-review.linaro.org/</a> - if anyone has patches to contribute, please submit them either there or send a pull request or use the ML.<br></div><div><br></div><div>ttyl<br></div><div>bero<br></div></div>