<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">My config file: <a href="http://pastebin.com/qtvSyeKt">http://pastebin.com/qtvSyeKt</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-26 16:38 GMT+01:00 Juan Simón <span dir="ltr"><<a href="mailto:decedion@gmail.com" target="_blank">decedion@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Yes, I've applied all kernel-patches from <a href="http://buildbot.llvm.linuxfoundation.org/configs/x86_64/kernel-patches.tar.bz2" target="_blank">http://buildbot.llvm.linuxfoundation.org/configs/x86_64/kernel-patches.tar.bz2</a> with 'bzcat ../kernel-patches.tar.bz2 | patch -p1':<br><br><div style="margin-left:40px">kernel/linux-3.17.4$ grep -i clang Makefile <br>ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)<br>ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)<br>COMPILER := clang<br>ifeq ($(COMPILER),clang)<br>CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%))<br>CLANG_GCC_TC := -gcc-toolchain $(GCC_TOOLCHAIN)<br>CLANG_IA_FLAG = -no-integrated-as<br>CLANG_FLAGS := $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_IA_FLAG)<br>ifeq ($(COMPILER),clang)<br></div><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">My relevant environment variables:<br><br><div style="margin-left:40px">LDFLAGS=-Wl,--as-needed -Wl,-s -Wl,-S -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common<br>MAKEFLAGS=-s<br>CPPFLAGS=-m64 -fPIC -pipe -march=native -mtune=native -Ofast -fomit-frame-pointer -fivopts -w -fno-math-errno<br>CXXFLAGS=-m64 -fPIC -pipe -march=native -mtune=native -Ofast -fomit-frame-pointer -fivopts -w -fno-math-errno<br>CPP=clang-3.6 -E<br>PATH=/home/simon/bin:usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:~/bin<br>HOSTCC=clang-3.6<br>LANG=es_ES.UTF-8<br>CONCURRENCY_LEVEL=9<br>CXX=clang++-3.6<br>CFLAGS=-m64 -fPIC -pipe -march=native -mtune=native -Ofast -fomit-frame-pointer -fivopts -w -fno-math-errno<br>CC=clang-3.6<br></div><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">The errors are:<br><div style="margin-left:40px"><div><div class="h5">In file included from /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs_64.c:17:<br>/home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:969:6: warning: variable 'do_reloc' is used uninitialized<br> whenever 'if' condition is false [-Wsometimes-uninitialized]<br> if (!use_real_mode)<br> ^~~~~~~~~~~~~~<br>/home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:981:14: note: uninitialized use occurs here<br> walk_relocs(do_reloc);<br> ^~~~~~~~<br>/home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:969:2: note: remove the 'if' if its condition is always<br> true<br> if (!use_real_mode)<br> ^~~~~~~~~~~~~~~~~~~<br>/home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:966:24: note: initialize the variable 'do_reloc' to<br> silence this warning<br> const char *symname);<br> ^<br> = NULL<br>1 warning generated.<br>/home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:18:2: error: unexpected token at start of statement<br> DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);<br> ^<br>/home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note: expanded from macro 'DEFINE'<br> asm volatile("\n@->" #sym " %0 " #val : : "i" (val))<br> ^<br><inline asm>:2:2: note: instantiated into assembly here<br>@->NR_PAGEFLAGS $25 __NR_PAGEFLAGS<br> ^<br>/home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:19:2: error: unexpected token at start of statement<br> DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);<br> ^<br>/home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note: expanded from macro 'DEFINE'<br> asm volatile("\n@->" #sym " %0 " #val : : "i" (val))<br> ^<br><inline asm>:2:2: note: instantiated into assembly here<br>@->MAX_NR_ZONES $4 __MAX_NR_ZONES<br> ^<br>/home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:21:2: error: unexpected token at start of statement<br> DEFINE(NR_CPUS_BITS, ilog2(CONFIG_NR_CPUS));<br> ^<br>/home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note: expanded from macro 'DEFINE'<br> asm volatile("\n@->" #sym " %0 " #val : : "i" (val))<br> ^<br><inline asm>:2:2: note: instantiated into assembly here<br>@->NR_CPUS_BITS $8 ilog2(CONFIG_NR_CPUS)<br> ^<br>/home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:23:2: error: unexpected token at start of statement<br> DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));<br> ^<br>/home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note: expanded from macro 'DEFINE'<br> asm volatile("\n@->" #sym " %0 " #val : : "i" (val))<br> ^<br><inline asm>:2:2: note: instantiated into assembly here<br>@->SPINLOCK_SIZE $4 sizeof(spinlock_t)<br> ^<br>4 errors generated.<br></div></div>make[4]: *** [kernel/bounds.s] Error 1<br>make[3]: *** [prepare0] Error 2<br>make[2]: *** [sub-make] Error 2<br>make[1]: *** [prepare] Error 2<br>make: *** [/home/simon/fuentes/kernel/linux-3.17.4/debian/stamps/stamp-prepare-tree-i7] Error 2<br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2014-11-26 16:23 GMT+01:00 Vinícius Tinti <span dir="ltr"><<a href="mailto:viniciustinti@gmail.com" target="_blank">viniciustinti@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On Wed, Nov 26, 2014 at 1:18 PM, Jan-Simon Moeller <<a href="mailto:dl9pf@gmx.de" target="_blank">dl9pf@gmx.de</a>> wrote:<br>
> What version of clang do you use ?<br>
><br>
> Am Mittwoch, 26. November 2014, 16:18:14 schrieb Juan Simón:<br>
>> Thanks.<br>
>> I have saved the 'makefile', I've disabled "AppArmor" and I have compiled<br>
>> again but it fails:<br>
>> In file included from<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs_64.c:17:<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:969:6:<br>
>> warning: variable 'do_reloc' is used uninitialized whenever 'if' condition<br>
>> is false<br>
>> [-Wsometimes-uninitialized]<br>
>> if (!use_real_mode)<br>
>> ^~~~~~~~~~~~~~<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:981:14:<br>
>> note: uninitialized use occurs here<br>
>> walk_relocs(do_reloc);<br>
>> ^~~~~~~~<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:969:2:<br>
>> note: remove the 'if' if its condition is always true<br>
>> if (!use_real_mode)<br>
>> ^~~~~~~~~~~~~~~~~~~<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:966:24:<br>
>> note: initialize the variable 'do_reloc' to silence this warning<br>
>> const char *symname);<br>
>> ^<br>
>> = NULL<br>
>> 1 warning generated.<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:18:2: error:<br>
>> unexpected token at start of statement<br>
>> DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);<br>
>> ^<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note:<br>
>> expanded from macro 'DEFINE'<br>
>> asm volatile("\n@->" #sym " %0 " #val : : "i" (val))<br>
>> ^<br>
>> <inline asm>:2:2: note: instantiated into assembly here<br>
>> @->NR_PAGEFLAGS $25 __NR_PAGEFLAGS<br>
>> ^<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:19:2: error:<br>
>> unexpected token at start of statement<br>
>> DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);<br>
>> ^<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note:<br>
>> expanded from macro 'DEFINE'<br>
>> asm volatile("\n@->" #sym " %0 " #val : : "i" (val))<br>
>> ^<br>
>> <inline asm>:2:2: note: instantiated into assembly here<br>
>> @->MAX_NR_ZONES $4 __MAX_NR_ZONES<br>
>> ^<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:21:2: error:<br>
>> unexpected token at start of statement<br>
>> DEFINE(NR_CPUS_BITS, ilog2(CONFIG_NR_CPUS));<br>
>> ^<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note:<br>
>> expanded from macro 'DEFINE'<br>
>> asm volatile("\n@->" #sym " %0 " #val : : "i" (val))<br>
>> ^<br>
>> <inline asm>:2:2: note: instantiated into assembly here<br>
>> @->NR_CPUS_BITS $8 ilog2(CONFIG_NR_CPUS)<br>
>> ^<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:23:2: error:<br>
>> unexpected token at start of statement<br>
>> DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));<br>
>> ^<br>
>> /home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note:<br>
>> expanded from macro 'DEFINE'<br>
>> asm volatile("\n@->" #sym " %0 " #val : : "i" (val))<br>
>> ^<br>
>> <inline asm>:2:2: note: instantiated into assembly here<br>
>> @->SPINLOCK_SIZE $4 sizeof(spinlock_t)<br>
>> ^<br>
>> 4 errors generated.<br>
>><br>
>> I'm compiling the 3.17.4 version.<br>
>><br>
>> 2014-11-26 16:06 GMT+01:00 Jan-Simon Moeller <<a href="mailto:dl9pf@gmx.de" target="_blank">dl9pf@gmx.de</a>>:<br>
>> > See this page:<br>
>> > <a href="http://llvm.linuxfoundation.org/index.php/Broken_kernel_options" target="_blank">http://llvm.linuxfoundation.org/index.php/Broken_kernel_options</a><br>
>> ><br>
>> > and i attached a fixed "makefile". forgot an argument.<br>
>> ><br>
>> > Best,<br>
>> > JS<br>
>> ><br>
>> > Am Mittwoch, 26. November 2014, 16:04:00 schrieb Jan-Simon Moeller:<br>
>> > > This is a known issue, disable apparmor.<br>
>> > ><br>
>> > > The construct used (shash structure layout) - we call it VLAIS (variable<br>
>> > > length array in struct) is not supported and the driver needs to be<br>
>> ><br>
>> > changed.<br>
>> ><br>
>> > > Patches welcome.<br>
>> > ><br>
>> > > Best,<br>
>> > > JS<br>
>> > ><br>
>> > > Am Mittwoch, 26. November 2014, 15:57:54 schrieb Juan Simón:<br>
>> > > > It doesn't compile:<br>
>> > /home/simon/fuentes/kernel/linux-3.17.4/security/apparmor/crypto.c:35:2:<br>
>> > > > error: implicit declaration of function 'SHASH_DESC_ON_STACK'<br>
>> > > > [-Werror=implicit-function-declaration]<br>
>> > > ><br>
>> > > > SHASH_DESC_ON_STACK(shash, apparmor_tfm);<br>
>> > > > ^<br>
>> ><br>
>> > /home/simon/fuentes/kernel/linux-3.17.4/security/apparmor/crypto.c:35:22:<br>
>> > > > error: 'shash' undeclared (first use in this function)<br>
>> > > ><br>
>> > > > SHASH_DESC_ON_STACK(shash, apparmor_tfm);<br>
>> > > ><br>
>> > > > ^<br>
>> > > ><br>
>> > > > Is this a known bug? I haven't found it in bug tracker.<br>
>> > > > I've tested it with clang-3.5 and clang-3.6. Same error.<br>
>> > > ><br>
>> > > > 2014-11-26 13:12 GMT+01:00 Jan-Simon Moeller <<a href="mailto:dl9pf@gmx.de" target="_blank">dl9pf@gmx.de</a>>:<br>
>> > > > > Am Mittwoch, 26. November 2014, 12:53:17 schrieb Juan Simón:<br>
>> > > > > > Hi,<br>
>> > > > > > I've followed the instructions on main page to compile the kernel<br>
>> ><br>
>> > with<br>
>> ><br>
>> > > > > > clang on Ubuntu 14.04 64 bits:<br>
>> > > > > > 1. Get the latest SVN version of clang (version 3.5 from PPA)<br>
>> > > > > > 2. Get the kernel pacthed from "git clone<br>
>> > > > > > git://<a href="http://git.linuxfoundation.org/llvmlinux/kernel.git" target="_blank">git.linuxfoundation.org/llvmlinux/kernel.git</a>"<br>
>> > > > > > 3. Execute: "export HOSTCC=clang CC=clang"<br>
>> > > > ><br>
>> > > > > Exporting it in your shell environment might not end up in the build<br>
>> > > > > process<br>
>> > > > > with dpkg rules. Export it in the rules file maybe ?<br>
>> > > > ><br>
>> > > > ><br>
>> > > > > or create a "makefile" (little m !!!) in the toplevel kernel-dir<br>
>> > > > > with<br>
>> > > > > this<br>
>> > > > > content:<br>
>> > > > ><br>
>> > > > > #<br>
>> > > > ><br>
>> > > > > CC := clang<br>
>> > > > > CPP := $(CC) -E<br>
>> > > > > HOSTCC := clang<br>
>> > > > > lm = $(MAKE) -f Makefile O="$(1)" CPP="$(CPP)" CC="$(CC)"<br>
>> > > > > HOSTCC="$(HOSTCC)"<br>
>> > > > ><br>
>> > > > > %:<br>
>> > > > > @$(call lm,$(O),$@)<br>
>> > > > ><br>
>> > > > > all:<br>
>> > > > > @$(call lm,$(O),$@)<br>
>> > > > ><br>
>> > > > > #<br>
>> > > > ><br>
>> > > > > > 4. From here I compile the kernel at Ubuntu way to obtain DEB<br>
>> > > > ><br>
>> > > > > packages:<br>
>> > > > > > 1. I patched the kernel with the patches in<br>
>> ><br>
>> > <a href="http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18-rc6-vivid/" target="_blank">http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18-rc6-vivid/</a><br>
>> ><br>
>> > > > > > 2. cp /boot/config-`uname -r`<br>
>> > > > > > debian.master/config/amd64/config.flavour.i7<br>
>> > > > > > 3. fakeroot debian/rules clean<br>
>> > > > > > 4. debian/rules editconfigs<br>
>> > > > > > 5. fakeroot debian/rules clean<br>
>> > > > > > 6. fakeroot debian/rules binary-headers binary-i7<br>
>> > > > ><br>
>> > > > > binary-arch-headers<br>
>> > > > ><br>
>> > > > > > I install the generated deb packages without problems.<br>
>> > > > > ><br>
>> > > > > > This i7 flavour it has:<br>
>> > > > > ><br>
>> > > > > > CONFIG_MCORE2=y<br>
>> > > > > ><br>
>> > > > > > and it's patched with:<br>
>> > > > > ><br>
>> > > > > > -cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2)<br>
>> > > > > > +cflags-$(CONFIG_MCORE2) += -march=native $(call<br>
>> ><br>
>> > tune,native)<br>
>> ><br>
>> > > > > > My doubts are:<br>
>> > > > > > 1. Is this kernel really compiled with clang? The compilation<br>
>> > > > > > process<br>
>> > > > > > shows in console a lot of warnings typical of clang but when I<br>
>> > > > > > execute<br>
>> > > > > ><br>
>> > > > > > "cat /proc/version", after reboot with the new kernel version, it<br>
>> > > > > > shows:<br>
>> > > > > > "Linux version 3.18.0-031800rc6-i7 (root@X58A-UD5) (gcc version<br>
>> ><br>
>> > 4.8.2<br>
>> ><br>
>> > > > > > (Ubuntu 4.8.2-19ubuntu1) )"<br>
>> > > > > ><br>
>> > > > > > 2. What's the kernel version in<br>
>> > > > > > git://<a href="http://git.linuxfoundation.org/llvmlinux/kernel.git" target="_blank">git.linuxfoundation.org/llvmlinux/kernel.git</a>? In<br>
>> ><br>
>> > LLVMLinux<br>
>> ><br>
>> > > > > > main<br>
>> > > > > > page <<a href="http://llvm.linuxfoundation.org/index.php/Main_Page" target="_blank">http://llvm.linuxfoundation.org/index.php/Main_Page</a>> it<br>
>> ><br>
>> > says:<br>
>> > > > > > "Alternatively you can use the LLVMLinux kernel tree (recent<br>
>> > > > > > mainline<br>
>> > > > > ><br>
>> > > > > > with latest LLVMLinux patches applied)" but when I execute<br>
>> > > > > > "debian/rules<br>
>> > > > > > editconfigs" it shows 3.17.0 in top of console and the git page<br>
>> ><br>
>> > shows<br>
>> ><br>
>> > > > > > <<a href="http://git.linuxfoundation.org/llvmlinux/kernel.git/" target="_blank">http://git.linuxfoundation.org/llvmlinux/kernel.git/</a>> that the<br>
>> ><br>
>> > last<br>
>> ><br>
>> > > > > change<br>
>> > > > ><br>
>> > > > > > was at 15 Oct 2014.<br>
>> > ><br>
>> > > _______________________________________________<br>
>> > > LLVMLinux mailing list<br>
>> > > <a href="mailto:LLVMLinux@lists.linuxfoundation.org" target="_blank">LLVMLinux@lists.linuxfoundation.org</a><br>
>> > > <a href="https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux</a><br>
>> ><br>
>> > _______________________________________________<br>
>> > LLVMLinux mailing list<br>
>> > <a href="mailto:LLVMLinux@lists.linuxfoundation.org" target="_blank">LLVMLinux@lists.linuxfoundation.org</a><br>
>> > <a href="https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux</a><br>
><br>
> _______________________________________________<br>
> LLVMLinux mailing list<br>
> <a href="mailto:LLVMLinux@lists.linuxfoundation.org" target="_blank">LLVMLinux@lists.linuxfoundation.org</a><br>
> <a href="https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux</a><br>
<br>
</div></div>Have you applied the disable-clang-integrated-as.patch?<br>
<a href="http://git.linuxfoundation.org/?p=llvmlinux.git;a=blob;f=arch/all/patches/disable-clang-integrated-as.patch;h=4bde9a683525ce5c0aee0f46164d3028a167b445;hb=HEAD" target="_blank">http://git.linuxfoundation.org/?p=llvmlinux.git;a=blob;f=arch/all/patches/disable-clang-integrated-as.patch;h=4bde9a683525ce5c0aee0f46164d3028a167b445;hb=HEAD</a><br>
<br>
This output happens if you try to build the kernel with clang only<br>
(you still need gcc for the assembly part).<br>
<span><font color="#888888"><br>
--<br>
Simplicity is the ultimate sophistication<br>
</font></span><div><div>_______________________________________________<br>
LLVMLinux mailing list<br>
<a href="mailto:LLVMLinux@lists.linuxfoundation.org" target="_blank">LLVMLinux@lists.linuxfoundation.org</a><br>
<a href="https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux" target="_blank">https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux</a></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>