[llvmlinux] Compiling sources from llvmlinux/kernel.git

Jan-Simon Moeller dl9pf at gmx.de
Wed Nov 26 15:18:55 UTC 2014


What version of clang do you use ?

Am Mittwoch, 26. November 2014, 16:18:14 schrieb Juan Simón:
> Thanks.
> I have saved the 'makefile', I've disabled "AppArmor" and I have compiled
> again but it fails:
> In file included from
> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs_64.c:17:
> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:969:6:
> warning: variable 'do_reloc' is used uninitialized whenever 'if' condition
> is false
>       [-Wsometimes-uninitialized]
>         if (!use_real_mode)
>             ^~~~~~~~~~~~~~
> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:981:14:
> note: uninitialized use occurs here
>         walk_relocs(do_reloc);
>                     ^~~~~~~~
> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:969:2:
> note: remove the 'if' if its condition is always true
>         if (!use_real_mode)
>         ^~~~~~~~~~~~~~~~~~~
> /home/simon/fuentes/kernel/linux-3.17.4/arch/x86/tools/relocs.c:966:24:
> note: initialize the variable 'do_reloc' to silence this warning
>                         const char *symname);
>                                             ^
>                                              = NULL
> 1 warning generated.
> /home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:18:2: error:
> unexpected token at start of statement
>         DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);
>         ^
> /home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note:
> expanded from macro 'DEFINE'
>         asm volatile("\n at ->" #sym " %0 " #val : : "i" (val))
>                         ^
> <inline asm>:2:2: note: instantiated into assembly here
> @->NR_PAGEFLAGS $25 __NR_PAGEFLAGS
>  ^
> /home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:19:2: error:
> unexpected token at start of statement
>         DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);
>         ^
> /home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note:
> expanded from macro 'DEFINE'
>         asm volatile("\n at ->" #sym " %0 " #val : : "i" (val))
>                         ^
> <inline asm>:2:2: note: instantiated into assembly here
> @->MAX_NR_ZONES $4 __MAX_NR_ZONES
>  ^
> /home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:21:2: error:
> unexpected token at start of statement
>         DEFINE(NR_CPUS_BITS, ilog2(CONFIG_NR_CPUS));
>         ^
> /home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note:
> expanded from macro 'DEFINE'
>         asm volatile("\n at ->" #sym " %0 " #val : : "i" (val))
>                         ^
> <inline asm>:2:2: note: instantiated into assembly here
> @->NR_CPUS_BITS $8 ilog2(CONFIG_NR_CPUS)
>  ^
> /home/simon/fuentes/kernel/linux-3.17.4/kernel/bounds.c:23:2: error:
> unexpected token at start of statement
>         DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));
>         ^
> /home/simon/fuentes/kernel/linux-3.17.4/include/linux/kbuild.h:5:18: note:
> expanded from macro 'DEFINE'
>         asm volatile("\n at ->" #sym " %0 " #val : : "i" (val))
>                         ^
> <inline asm>:2:2: note: instantiated into assembly here
> @->SPINLOCK_SIZE $4 sizeof(spinlock_t)
>  ^
> 4 errors generated.
> 
> I'm compiling the 3.17.4 version.
> 
> 2014-11-26 16:06 GMT+01:00 Jan-Simon Moeller <dl9pf at gmx.de>:
> > See this page:
> > http://llvm.linuxfoundation.org/index.php/Broken_kernel_options
> > 
> > and i attached a fixed "makefile". forgot an argument.
> > 
> > Best,
> > JS
> > 
> > Am Mittwoch, 26. November 2014, 16:04:00 schrieb Jan-Simon Moeller:
> > > This is a known issue, disable apparmor.
> > > 
> > > The construct used (shash structure layout) - we call it VLAIS (variable
> > > length array in struct) is not supported and the driver needs to be
> > 
> > changed.
> > 
> > > Patches welcome.
> > > 
> > > Best,
> > > JS
> > > 
> > > Am Mittwoch, 26. November 2014, 15:57:54 schrieb Juan Simón:
> > > > It doesn't compile:
> > /home/simon/fuentes/kernel/linux-3.17.4/security/apparmor/crypto.c:35:2:
> > > > error: implicit declaration of function 'SHASH_DESC_ON_STACK'
> > > > [-Werror=implicit-function-declaration]
> > > > 
> > > >   SHASH_DESC_ON_STACK(shash, apparmor_tfm);
> > > >   ^
> > 
> > /home/simon/fuentes/kernel/linux-3.17.4/security/apparmor/crypto.c:35:22:
> > > > error: 'shash' undeclared (first use in this function)
> > > > 
> > > >   SHASH_DESC_ON_STACK(shash, apparmor_tfm);
> > > >   
> > > >                       ^
> > > > 
> > > > Is this a known bug? I haven't found it in bug tracker.
> > > > I've tested it with clang-3.5 and clang-3.6. Same error.
> > > > 
> > > > 2014-11-26 13:12 GMT+01:00 Jan-Simon Moeller <dl9pf at gmx.de>:
> > > > > Am Mittwoch, 26. November 2014, 12:53:17 schrieb Juan Simón:
> > > > > > Hi,
> > > > > > I've followed the instructions on main page to compile the kernel
> > 
> > with
> > 
> > > > > > clang on Ubuntu 14.04 64 bits:
> > > > > >    1. Get the latest SVN version of clang (version 3.5 from PPA)
> > > > > >    2. Get the kernel pacthed from "git clone
> > > > > >    git://git.linuxfoundation.org/llvmlinux/kernel.git"
> > > > > >    3. Execute: "export HOSTCC=clang CC=clang"
> > > > > 
> > > > > Exporting it in your shell environment might not end up in the build
> > > > > process
> > > > > with dpkg rules. Export it in the rules file maybe ?
> > > > > 
> > > > > 
> > > > > or create a "makefile" (little m !!!) in the toplevel kernel-dir
> > > > > with
> > > > > this
> > > > > content:
> > > > > 
> > > > > #
> > > > > 
> > > > > CC              := clang
> > > > > CPP             := $(CC) -E
> > > > > HOSTCC          := clang
> > > > > lm = $(MAKE) -f Makefile O="$(1)" CPP="$(CPP)" CC="$(CC)"
> > > > > HOSTCC="$(HOSTCC)"
> > > > > 
> > > > > %:
> > > > >         @$(call lm,$(O),$@)
> > > > > 
> > > > > all:
> > > > >         @$(call lm,$(O),$@)
> > > > > 
> > > > > #
> > > > > 
> > > > > >    4. From here I compile the kernel at Ubuntu way to obtain DEB
> > > > > 
> > > > > packages:
> > > > > >       1. I patched the kernel with the patches in
> > 
> > http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18-rc6-vivid/
> > 
> > > > > >       2. cp /boot/config-`uname -r`
> > > > > >       debian.master/config/amd64/config.flavour.i7
> > > > > >       3. fakeroot debian/rules clean
> > > > > >       4. debian/rules editconfigs
> > > > > >       5. fakeroot debian/rules clean
> > > > > >       6. fakeroot debian/rules binary-headers binary-i7
> > > > > 
> > > > > binary-arch-headers
> > > > > 
> > > > > > I install the generated deb packages without problems.
> > > > > > 
> > > > > > This i7 flavour it has:
> > > > > > 
> > > > > > CONFIG_MCORE2=y
> > > > > > 
> > > > > > and it's patched with:
> > > > > > 
> > > > > > -cflags-$(CONFIG_MCORE2)        += -march=i686 $(call tune,core2)
> > > > > > +cflags-$(CONFIG_MCORE2)        += -march=native $(call
> > 
> > tune,native)
> > 
> > > > > > My doubts are:
> > > > > >    1. Is this kernel really compiled with clang? The compilation
> > > > > >    process
> > > > > >    shows in console a lot of warnings typical of clang but when I
> > > > > >    execute
> > > > > > 
> > > > > > "cat /proc/version", after reboot with the new kernel version, it
> > > > > > shows:
> > > > > > "Linux version 3.18.0-031800rc6-i7 (root at X58A-UD5) (gcc version
> > 
> > 4.8.2
> > 
> > > > > > (Ubuntu 4.8.2-19ubuntu1) )"
> > > > > > 
> > > > > >    2. What's the kernel version in
> > > > > >    git://git.linuxfoundation.org/llvmlinux/kernel.git? In
> > 
> > LLVMLinux
> > 
> > > > > >    main
> > > > > >    page <http://llvm.linuxfoundation.org/index.php/Main_Page> it
> > 
> > says:
> > > > > >    "Alternatively you can use the LLVMLinux kernel tree (recent
> > > > > >    mainline
> > > > > > 
> > > > > > with latest LLVMLinux patches applied)" but when I execute
> > > > > > "debian/rules
> > > > > > editconfigs" it shows 3.17.0 in top of console and the git page
> > 
> > shows
> > 
> > > > > > <http://git.linuxfoundation.org/llvmlinux/kernel.git/> that the
> > 
> > last
> > 
> > > > > change
> > > > > 
> > > > > > was at 15 Oct 2014.
> > > 
> > > _______________________________________________
> > > LLVMLinux mailing list
> > > LLVMLinux at lists.linuxfoundation.org
> > > https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux
> > 
> > _______________________________________________
> > LLVMLinux mailing list
> > LLVMLinux at lists.linuxfoundation.org
> > https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux



More information about the LLVMLinux mailing list