[llvm-dev] Compiling Linux kernel with LLVM for mips64el

Leslie Zhai via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 12 19:48:34 PDT 2018


Hi LLVM and Kernel developers,

I am building Linux Kernel[1] with LLVM toolchain[2] for mips64el. It is 
just able to workaround[3] build, please teach me how to fix PR38063 and 
PR38128, thanks a lot!

1. Linux Kernel 4.9 branch 
https://github.com/loongson-community/linux-stable/tree/rebase-4.9

2. Loongson clang version 7.0.0 
(git at github.com:Loong-Language/loong-clang.git 
c36069cffc57a30a20782bf327a87bed4e48a6c2) 
(git at github.com:Loong-Language/loong-llvm.git 
59cb663e72874dda740aa2b18bf47ba65b32fe9b) (based on LLVM 7.0.0svn)
Target: mips64el-redhat-linux
Thread model: posix
InstalledDir: /opt/loong-llvm/bin
Found candidate GCC installation: /usr/lib/gcc/mips64el-redhat-linux/4.9.3
Selected GCC installation: /usr/lib/gcc/mips64el-redhat-linux/4.9.3
Candidate multilib: .;
Selected multilib: .;

3. Ugly workaround in Kernel and Compiler sides 
https://github.com/loongson-community/linux-stable/issues
$ readelf -h vmlinux
ELF Header:
   Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
   Class:                             ELF64
   Data:                              2's complement, little endian
   Version:                           1 (current)
   OS/ABI:                            UNIX - System V
   ABI Version:                       0
   Type:                              EXEC (Executable file)
   Machine:                           MIPS R3000
   Version:                           0x1
   Entry point address:               0xffffffff811c94e0
   Start of program headers:          64 (bytes into file)
   Start of section headers:          37391984 (bytes into file)
   Flags:                             0x80000001, noreorder, mips64r2
   Size of this header:               64 (bytes)
   Size of program headers:           56 (bytes)
   Number of program headers:         2
   Size of section headers:           64 (bytes)
   Number of section headers:         27
   Section header string table index: 24

4. Failed Checking missing-syscalls for O32 
https://bugs.llvm.org/show_bug.cgi?id=38063
5. Unsupported inline asm tying incompatible types 
https://bugs.llvm.org/show_bug.cgi?id=38128

-- 
Regards,
Leslie Zhai





More information about the llvm-dev mailing list