From bertrand.garrigues at laposte.net Tue Sep 25 22:25:58 2012 From: bertrand.garrigues at laposte.net (Bertrand Garrigues) Date: Wed, 26 Sep 2012 00:25:58 +0200 Subject: [Mipsel] [mipsel] compilation flags for loongson Message-ID: <20120926002558.69b2f71d@baimi.jia> Hi, I was wondering which compilation flags are used to build the Parabola distribution for the mips64 architecture. It seems that only the kernel is a mips-64 bit binary, all the progams or libs of the distribution are 32 bits. I heard that there was a gcc with special optimization flags for the yeelong, taking full advantage of the mips architecture, but it seems it is not available on the mainstream, so I guess it is not stable yet. Could someone explain what is currently the recommended method to compile with the loongson ? Regards, Bertrand Garrigues From bryan at katofiad.co.nz Wed Sep 26 02:03:38 2012 From: bryan at katofiad.co.nz (Bryan Baldwin) Date: Wed, 26 Sep 2012 14:03:38 +1200 Subject: [Mipsel] [mipsel] compilation flags for loongson In-Reply-To: <20120926002558.69b2f71d@baimi.jia> References: <20120926002558.69b2f71d@baimi.jia> Message-ID: <5062627A.7040105@katofiad.co.nz> On 09/26/2012 10:25 AM, Bertrand Garrigues wrote: > I was wondering which compilation flags are used to build the Parabola > distribution for the mips64 architecture. It seems that only the > kernel is a mips-64 bit binary, all the progams or libs of the > distribution are 32 bits. > > I heard that there was a gcc with special optimization flags for the > yeelong, taking full advantage of the mips architecture, but it seems > it is not available on the mainstream, so I guess it is not stable yet. > > Could someone explain what is currently the recommended method to > compile with the loongson ? Hi Bertrand, I've been working on a custom pure64 MIPS build system to make a functioning cross-compiler for the loongson2f. But ABI for MIPS is different to the hard distinction between 64bit and 32bit that we've come to expect from the x86 architecture. This document shows some helpful clues about flags used with the loongson2f: http://code.google.com/p/clfs/wiki/loongson2f I still have problems with my cross compiler, in that, once start building on the native machine the toolchain is very confused about which /lib{,32,64} path it needs to link dynamic libraries. Most of this is due to shortcomings and neglect for the MIPS architecture in glibc. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 554 bytes Desc: OpenPGP digital signature URL: From mtjm at mtjm.eu Wed Sep 26 08:01:29 2012 From: mtjm at mtjm.eu (=?utf-8?Q?Micha=C5=82_Mas=C5=82owski?=) Date: Wed, 26 Sep 2012 10:01:29 +0200 Subject: [Mipsel] [mipsel] compilation flags for loongson In-Reply-To: <20120926002558.69b2f71d@baimi.jia> (Bertrand Garrigues's message of "Wed, 26 Sep 2012 00:25:58 +0200") References: <20120926002558.69b2f71d@baimi.jia> Message-ID: <87fw652ox2.fsf@mtjm.eu> > I was wondering which compilation flags are used to build the Parabola > distribution for the mips64 architecture. It seems that only the > kernel is a mips-64 bit binary, all the progams or libs of the > distribution are 32 bits. [0] sets these: -O2 -march=loongson2f -mabi=n32 -pipe -mplt -Wa,-mfix-loongson2f-nop -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 We use the N32 ABI, it has 64-bit registers and 32-bit pointers. It's enough for most programs, I would not consider N64 needed on a machine with just 1?GiB of RAM (ld needs more memory when linking debug WebKit, it's very slow on an x86_64 machine with just 4?GiB of RAM). N64 has bigger programs and changing ABIs without rebuilding whole distro would be very difficult. > I heard that there was a gcc with special optimization flags for the > yeelong, taking full advantage of the mips architecture, but it seems > it is not available on the mainstream, so I guess it is not stable yet. The "-march=loongson2f -mabi=n32" flags should do it (other sources recommend -O3, we use -O2). O32 which is used in Debian uses 32-bit part of integer registers, only 16 of 32 floating point registers and have other inefficiences. There are sources stating a 30% performance improvement for N32. [0] https://projects.parabolagnulinux.org/abslibre.git/tree/libre/pacman/PKGBUILD -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: not available URL: From mtjm at mtjm.eu Wed Sep 26 08:03:57 2012 From: mtjm at mtjm.eu (=?utf-8?Q?Micha=C5=82_Mas=C5=82owski?=) Date: Wed, 26 Sep 2012 10:03:57 +0200 Subject: [Mipsel] [mipsel] compilation flags for loongson In-Reply-To: <5062627A.7040105@katofiad.co.nz> (Bryan Baldwin's message of "Wed, 26 Sep 2012 14:03:38 +1200") References: <20120926002558.69b2f71d@baimi.jia> <5062627A.7040105@katofiad.co.nz> Message-ID: <87bogt2osy.fsf@mtjm.eu> > But ABI for MIPS is > different to the hard distinction between 64bit and 32bit that we've > come to expect from the x86 architecture. x32 makes these more similar. > I still have problems with my cross compiler, in that, once start > building on the native machine the toolchain is very confused about > which /lib{,32,64} path it needs to link dynamic libraries. Most of this > is due to shortcomings and neglect for the MIPS architecture in glibc. These are well-specified, just Parabola uses /lib instead of /lib32 for N32 since PKGBUILDs are not designed to change such things (other N32 distros use /lib32). -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: not available URL: From bryan at katofiad.co.nz Wed Sep 26 13:06:11 2012 From: bryan at katofiad.co.nz (Bryan Baldwin) Date: Thu, 27 Sep 2012 01:06:11 +1200 Subject: [Mipsel] [mipsel] compilation flags for loongson In-Reply-To: <87bogt2osy.fsf@mtjm.eu> References: <20120926002558.69b2f71d@baimi.jia> <5062627A.7040105@katofiad.co.nz> <87bogt2osy.fsf@mtjm.eu> Message-ID: <5062FDC3.6060505@katofiad.co.nz> On 09/26/2012 08:03 PM, Micha? Mas?owski wrote: > These are well-specified, just Parabola uses /lib instead of /lib32 for > N32 since PKGBUILDs are not designed to change such things (other N32 > distros use /lib32). Thanks for the info. When I've built my cross toolchain I've patched several files for eglibc to use appropriate /lib{,32,64}, which has never worked. Your other post on build flags and ABI settings is very interesting. I'll try incorporating those into my next build and go with n32. :) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 554 bytes Desc: OpenPGP digital signature URL: From fauno at kiwwwi.com.ar Wed Sep 26 14:14:51 2012 From: fauno at kiwwwi.com.ar (=?utf-8?Q?Nicol=C3=A1s?= Reynolds) Date: Wed, 26 Sep 2012 11:14:51 -0300 Subject: [Mipsel] [mipsel] compilation flags for loongson In-Reply-To: <5062FDC3.6060505@katofiad.co.nz> References: <20120926002558.69b2f71d@baimi.jia> <5062627A.7040105@katofiad.co.nz> <87bogt2osy.fsf@mtjm.eu> <5062FDC3.6060505@katofiad.co.nz> Message-ID: <87pq58rhus.fsf@kiwwwi.com.ar> Bryan Baldwin writes: > On 09/26/2012 08:03 PM, Micha? Mas?owski wrote: >> These are well-specified, just Parabola uses /lib instead of /lib32 for >> N32 since PKGBUILDs are not designed to change such things (other N32 >> distros use /lib32). > > Thanks for the info. When I've built my cross toolchain I've patched > several files for eglibc to use appropriate /lib{,32,64}, which has > never worked. Your other post on build flags and ABI settings is very > interesting. I'll try incorporating those into my next build and go with > n32. :) could you explain what are you trying to do? we have a loongson2f crosscompiler working, that we use for distributed crossbuilding[0] and it works very well... i was just documenting myself to build packages without the native compiler, so we could bootstrap parabola to any architecture. i'm reading clfs[1] (again!) and i was about to check how openwrt does it[2]. in particular because bootstraping arch/parabola documentation is severely lacking (though everyone's doing it) and i may need it to build an arm parabola for my ebook :P [0]: https://wiki.parabolagnulinux.org/Cross-toolchain_and_distcc now that i see it it needs update for the latest crosstoolchain [1]: http://cross-lfs.org/view/CLFS-1.2.0/mips/final-system/eglibc.html see "10.7.4. Configuring The Dynamic Loader" [2]: https://dev.openwrt.org/wiki/GetSource -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 489 bytes Desc: not available URL: From bertrand.garrigues at laposte.net Wed Sep 26 20:59:12 2012 From: bertrand.garrigues at laposte.net (Bertrand Garrigues) Date: Wed, 26 Sep 2012 22:59:12 +0200 Subject: [Mipsel] [mipsel] compilation flags for loongson In-Reply-To: <87fw652ox2.fsf@mtjm.eu> References: <20120926002558.69b2f71d@baimi.jia> <87fw652ox2.fsf@mtjm.eu> Message-ID: <20120926225912.7085cfda@baimi.jia> On Wed, 26 Sep 2012 10:01:29 +0200 mtjm at mtjm.eu (Micha? Mas?owski) wrote: > > I was wondering which compilation flags are used to build the > > Parabola distribution for the mips64 architecture. It seems that > > only the kernel is a mips-64 bit binary, all the progams or libs of > > the distribution are 32 bits. > > [0] sets these: > > -O2 -march=loongson2f -mabi=n32 -pipe -mplt -Wa,-mfix-loongson2f-nop > -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 > > We use the N32 ABI, it has 64-bit registers and 32-bit pointers. It's > enough for most programs, I would not consider N64 needed on a machine > with just 1?GiB of RAM (ld needs more memory when linking debug > WebKit, it's very slow on an x86_64 machine with just 4?GiB of RAM). > > N64 has bigger programs and changing ABIs without rebuilding whole > distro would be very difficult. > > > I heard that there was a gcc with special optimization flags for the > > yeelong, taking full advantage of the mips architecture, but it > > seems it is not available on the mainstream, so I guess it is not > > stable yet. > > The "-march=loongson2f -mabi=n32" flags should do it (other sources > recommend -O3, we use -O2). O32 which is used in Debian uses 32-bit > part of integer registers, only 16 of 32 floating point registers and > have other inefficiences. There are sources stating a 30% performance > improvement for N32. > > [0] > https://projects.parabolagnulinux.org/abslibre.git/tree/libre/pacman/PKGBUILD Thanks for your explanations, it's very interesting ! I'll check these flags out. Regards, Bertrand Garrigues From bryan at katofiad.co.nz Thu Sep 27 10:08:30 2012 From: bryan at katofiad.co.nz (Bryan Baldwin) Date: Thu, 27 Sep 2012 22:08:30 +1200 Subject: [Mipsel] [mipsel] compilation flags for loongson In-Reply-To: <87pq58rhus.fsf@kiwwwi.com.ar> References: <20120926002558.69b2f71d@baimi.jia> <5062627A.7040105@katofiad.co.nz> <87bogt2osy.fsf@mtjm.eu> <5062FDC3.6060505@katofiad.co.nz> <87pq58rhus.fsf@kiwwwi.com.ar> Message-ID: <5064259E.4@katofiad.co.nz> On 27/09/12 02:14, Nicol?s Reynolds wrote: > could you explain what are you trying to do? we have a loongson2f > crosscompiler working, that we use for distributed crossbuilding[0] and > it works very well... > > i was just documenting myself to build packages without the native > compiler, so we could bootstrap parabola to any architecture. i'm > reading clfs[1] (again!) and i was about to check how openwrt does > it[2]. > > in particular because bootstraping arch/parabola documentation is > severely lacking (though everyone's doing it) and i may need it to build > an arm parabola for my ebook :P > > > [0]: https://wiki.parabolagnulinux.org/Cross-toolchain_and_distcc now > that i see it it needs update for the latest crosstoolchain > [1]: http://cross-lfs.org/view/CLFS-1.2.0/mips/final-system/eglibc.html > see "10.7.4. Configuring The Dynamic Loader" > [2]: https://dev.openwrt.org/wiki/GetSource This is exactly what I was doing. The difference was I was attempting a pure64 bit build. It is almost working, but not quite. I joined this list primarily for crosstalk on building for MIPS. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 554 bytes Desc: OpenPGP digital signature URL: