Please try the toolchain here: http://dev.lemote.com/files/resource/toolchain/cross-compile/ On Fri, Feb 20, 2015 at 3:46 AM, Mike Frysinger <vapier@xxxxxxxxxx> wrote: > i've got a lemote desktop with a quad core Loongson-3A in it: > http://www.lemote.com/products/computer/fulong/348.html > > i'm trying to build my own kernel for it, but userspace just crashes on me :(. > > the current kernel is a precompiled one from lemote themselves, and things are > compiling/running fine with it. but it's a bit stale and missing features i > want (like namespaces & seccomp). > $ uname -a > Linux lemote 3.5.0-9.lemote #1465 SMP PREEMPT Mon Aug 26 14:23:38 CST 2013 mips64 ICT Loongson-3A V0.5 FPU V0.1 lemote-3a-itx-a1101 GNU/Linux > > the userland is Gentoo. it's an o32/n32/n64 multilib with n32 as the default. > most (if not all) of userland has been built with gcc-4.8.2 using > "-O2 -march=mips64 -mplt -pipe". > $ file /bin/bash > /bin/bash: ELF 32-bit LSB executable, MIPS, N32 MIPS64 version 1 (SYSV), dynamically linked, interpreter /lib32/ld.so.1, for GNU/Linux 2.6.16, stripped > $ /lib/libc.so.6 > GNU C Library (Gentoo 2.19-r1 p3) stable release version 2.19, by Roland McGrath et al. > Copyright (C) 2014 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. > There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A > PARTICULAR PURPOSE. > Compiled by GNU CC version 4.8.2. > Compiled on a Linux 3.14.0 system on 2014-09-09. > Available extensions: > C stubs add-on version 2.1.2 > crypt add-on version 2.1 by Michael Glad and others > GNU Libidn by Simon Josefsson > Native POSIX Threads Library by Ulrich Drepper et al > BIND-8.2.3-T5B > libc ABIs: MIPS_PLT UNIQUE > For bug reporting instructions, please see: > <http://bugs.gentoo.org/>. > > i first tried lemote's sources, which i grabbed their git tree from > dev.lemote.com. i started at the same git tag (3.5.0-9.lemote) and used the > same .config as their precompiled kernel. once it booted, most userland progs > would crash. some would survive (like simple ones), but most would crash. > > i moved up to vanilla linux-3.18, starting with the same config, but got the > same behavior. > > i tried booting with the nofpu command line, but that didn't help. i also > tried manually setting cpu_has_fpu to 0 in > arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h, but that didn't > help. > > i tried gcc-4.7.4, gcc-4.8.4, and gcc-4.9.2, but none of that helped. > > i enabled the debugging in arch/mips/mm/fault.c, and you can see the attached > dmesg with some of the example crashes. when i looked at proc maps from other > binaries, it looks like those crashing addresses are close to real ones, but > slightly off (like a byte shift?). i'm just guessing since i'm not actually > looking at the crashing app itself ... just assuming the maps are largely stable > (since they seem to be in other ones). > > i tried to use strace/gdb to narrow things down, but those both crash early, so > couldn't get anywhere :). > > any pointers ? > -mike