[llvmlinux] Compiling sources from llvmlinux/kernel.git

Juan Simón decedion at gmail.com
Wed Nov 26 15:46:41 UTC 2014


This is my Makefile: http://pastebin.com/NDXyv2L2

2014-11-26 16:43 GMT+01:00 Juan Simón <decedion at gmail.com>:

> I'm compiling the kernel 3.17.4 downloaded from
> https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.17.4.tar.xz, not the
> git version.
>
> 2014-11-26 16:42 GMT+01:00 Vinícius Tinti <viniciustinti at gmail.com>:
>
>> On Wed, Nov 26, 2014 at 1:40 PM, Juan Simón <decedion at gmail.com> wrote:
>> > My config file:  http://pastebin.com/qtvSyeKt
>> >
>> > 2014-11-26 16:38 GMT+01:00 Juan Simón <decedion at gmail.com>:
>> >>
>> >> Yes, I've applied all kernel-patches from
>> >>
>> http://buildbot.llvm.linuxfoundation.org/configs/x86_64/kernel-patches.tar.bz2
>> >> with 'bzcat ../kernel-patches.tar.bz2 | patch -p1':
>> >>
>> >> kernel/linux-3.17.4$ grep -i clang Makefile
>> >> ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
>> >> ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
>> >> COMPILER := clang
>> >> ifeq ($(COMPILER),clang)
>> >> CLANG_TARGET    := -target $(notdir $(CROSS_COMPILE:%-=%))
>> >> CLANG_GCC_TC    := -gcc-toolchain $(GCC_TOOLCHAIN)
>> >> CLANG_IA_FLAG    = -no-integrated-as
>> >> CLANG_FLAGS    := $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_IA_FLAG)
>> >> ifeq ($(COMPILER),clang)
>> >>
>> >> My relevant environment variables:
>> >>
>> >> LDFLAGS=-Wl,--as-needed -Wl,-s -Wl,-S -Wl,-O1 -Wl,--hash-style=gnu
>> >> -Wl,--sort-common
>> >> MAKEFLAGS=-s
>> >> CPPFLAGS=-m64 -fPIC -pipe -march=native -mtune=native -Ofast
>> >> -fomit-frame-pointer -fivopts -w -fno-math-errno
>> >> CXXFLAGS=-m64 -fPIC -pipe -march=native -mtune=native -Ofast
>> >> -fomit-frame-pointer -fivopts -w -fno-math-errno
>> >> CPP=clang-3.6 -E
>> >>
>> >>
>> 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
>> >> HOSTCC=clang-3.6
>> >> LANG=es_ES.UTF-8
>> >> CONCURRENCY_LEVEL=9
>> >> CXX=clang++-3.6
>> >> CFLAGS=-m64 -fPIC -pipe -march=native -mtune=native -Ofast
>> >> -fomit-frame-pointer -fivopts -w -fno-math-errno
>> >> CC=clang-3.6
>> >>
>> >> The errors are:
>> >> 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.
>> >> make[4]: *** [kernel/bounds.s] Error 1
>> >> make[3]: *** [prepare0] Error 2
>> >> make[2]: *** [sub-make] Error 2
>> >> make[1]: *** [prepare] Error 2
>> >> make: ***
>> >>
>> [/home/simon/fuentes/kernel/linux-3.17.4/debian/stamps/stamp-prepare-tree-i7]
>> >> Error 2
>> >>
>> >> 2014-11-26 16:23 GMT+01:00 Vinícius Tinti <viniciustinti at gmail.com>:
>> >>>
>> >>> On Wed, Nov 26, 2014 at 1:18 PM, Jan-Simon Moeller <dl9pf at gmx.de>
>> wrote:
>> >>> > 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
>> >>> >
>> >>> > _______________________________________________
>> >>> > LLVMLinux mailing list
>> >>> > LLVMLinux at lists.linuxfoundation.org
>> >>> > https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux
>> >>>
>> >>> Have you applied the disable-clang-integrated-as.patch?
>> >>>
>> >>>
>> http://git.linuxfoundation.org/?p=llvmlinux.git;a=blob;f=arch/all/patches/disable-clang-integrated-as.patch;h=4bde9a683525ce5c0aee0f46164d3028a167b445;hb=HEAD
>> >>>
>> >>> This output happens if you try to build the kernel with clang only
>> >>> (you still need gcc for the assembly part).
>> >>>
>> >>> --
>> >>> Simplicity is the ultimate sophistication
>> >>> _______________________________________________
>> >>> LLVMLinux mailing list
>> >>> LLVMLinux at lists.linuxfoundation.org
>> >>> https://lists.linuxfoundation.org/mailman/listinfo/llvmlinux
>> >>
>> >>
>> >
>>
>> Could you pastebin 'git diff Makefile'?
>>
>> --
>> Simplicity is the ultimate sophistication
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/llvmlinux/attachments/20141126/588d9705/attachment-0001.html>


More information about the LLVMLinux mailing list