Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 353380 - toolchain.eclass - Add e500-double USE flag (--enable-e500-double)
Summary: toolchain.eclass - Add e500-double USE flag (--enable-e500-double)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: PPC Linux
: High enhancement (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-01 09:06 UTC by Alexander Dubov
Modified: 2011-03-01 00:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
toolchain.eclass.patch (toolchain.eclass.patch,613 bytes, patch)
2011-02-24 04:25 UTC, SpanKY
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Dubov 2011-02-01 09:06:50 UTC
When configuring gcc for use on PowerPC e200/e500 platform, it will default to always generating a single precision floating point code, unless appropriate compile time flag is specified (-mfloat-gprs=double). This is very inconvenient, considering the fact that most chips in question support double precision floating point (e500v2 and e200z6, comprising the majority of newer chips). GCC has a configuration flag, --enable-e500-double which makes it to use double precision floating point by default on this platform. It makes sense, therefore, to add an appropriate local USE flag to toolchain eclass, akin to "altivec" or mips-specific "fixed-point".


Reproducible: Always

Steps to Reproduce:
Comment 1 SpanKY gentoo-dev 2011-02-20 18:07:02 UTC
i dont want to go adding random USE flags for minor targets.  you can simply add EXTRA_ECONF="--enable-e500-double" to your build env for gcc.
Comment 2 Alexander Dubov 2011-02-21 02:42:23 UTC
Strictly speaking, this is not a minor target, but a rather major one.
To obtain reasonable performance on e200/e500 everything must be recompiled, as floating point ABI is completely different and incompatible with normal PowerPC.

These are popular processors in the embedded world and hopefully gentoo will come to support them fully one day (when eglibc hits the portage).
Comment 3 SpanKY gentoo-dev 2011-02-22 06:45:40 UTC
everybody's target is major to them.  every package in the tree should cleanly support CFLAGS, or it's a bug and you should be filing one as such.

what CTARGET exactly are you using ?
Comment 4 Alexander Dubov 2011-02-23 04:58:21 UTC
(In reply to comment #3)
> everybody's target is major to them.  every package in the tree should cleanly
> support CFLAGS, or it's a bug and you should be filing one as such.

This is a slightly different issue then CFLAGS, after all. The closer analogy would be a n32/n64 use flag of MIPS.

> 
> what CTARGET exactly are you using ?
> 

My CHOST is set to powerpc-linux-gnuspe, so CTARGET stays to be powerpc.
Comment 5 SpanKY gentoo-dev 2011-02-23 09:16:48 UTC
i dont think it is analogous to n64/n32 at all.  those ABIs change all register sizes (and iirc, the caller/callee sets), as well as the kernel ABI.

plus, that doesnt really help your argument considering i'm not a fan of those existing in the first place.

what CFLAGS exactly do you use normally ?  i dont have a problem having the code pass --enable-e500-double if it detects the user has CFLAGS targeting a new enough ppc, or has "-mfloat-gprs=double".

or go the route we already have today with softfloat.  use a CTARGET of:
powerpc-gprsdouble-linux-gnu
Comment 6 Alexander Dubov 2011-02-24 03:39:37 UTC
> 
> what CFLAGS exactly do you use normally ?

Errh, why are we discussing CFLAGS in the first place?

My original bug report is about a "configure" switch to pass during the actual sys-devel/gcc compilation, it has nothing to do with other stuff.

To answer your question, I used to have "-mspe -mfloat-gprs=double" in my CFLAGS, but after recompiling the gcc with "--enable-e500-double" I only have the distro default CFLAGS set. This is quite an improvement, considering that there are quite a few of those unfortunate packages which do not pass CFLAGS consistently to all targets, resulting in evil bugs and crashes, when some targets suddenly compile to a different version of floating point abi.

I actually filed a bug report to gcc to make "--enable-e500-double" the default on *-gnuspe gcc build, but they decided not to. This is very unfortunate, considering that e500 chips are powerful enough these days to support fast native compilations, while most low-end e200 stuff (where double precision is not available) is done through cross-compiling and other hoop jumping. 
Comment 7 SpanKY gentoo-dev 2011-02-24 04:25:32 UTC
Created attachment 263657 [details, diff]
toolchain.eclass.patch

if you didnt snip my entire comment, you might have included the part where i told you why i was looking at the CFLAGS value
Comment 8 Alexander Dubov 2011-02-25 05:02:29 UTC
(In reply to comment #7)
> Created an attachment (id=263657) [details]
> toolchain.eclass.patch
> 
> if you didnt snip my entire comment, you might have included the part where i
> told you why i was looking at the CFLAGS value
> 

I don't think the proposed snippet is a good approach.

The configure flag is necessary to abolish the need for the compile time flag.
After one compiles gcc with --enable-e500-double, he will naturally remove the -mfloat-gprs=double from his CFLAGS (this may happen inadvertently, as part of new system image deployment). Which, in turn, will lead to the next compile of gcc getting out incorrect.

Different CTARGET seems more reasonable to me, if this is the accepted way gentoo handles sub-architectures. It appears, there are some people who use powerpc-e500v2-linux-gnuspe target multiplet for this architecture, but it is not recognized as is by the gcc configure (apart from the *spe* part), so explicit flag is still necessary.
Comment 9 SpanKY gentoo-dev 2011-02-25 22:11:17 UTC
i'm not adding a USE flag.  i dont want more minor explosion especially because it causes such a headache when it comes to masking and crossdev.

keying off of CTARGET is fine along the lines of:

+	is-flagq -mfloat-gprs=double && confgcc+=" --enable-e500-double"
+	[[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=" --enable-e500-double"
Comment 10 Alexander Dubov 2011-02-28 03:28:53 UTC
(In reply to comment #9)
> i'm not adding a USE flag.  i dont want more minor explosion especially because
> it causes such a headache when it comes to masking and crossdev.
> 
> keying off of CTARGET is fine along the lines of:
> 
> +       is-flagq -mfloat-gprs=double && confgcc+=" --enable-e500-double"
> +       [[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=" --enable-e500-double"
> 

I'm fine with the CTARGET.
Comment 11 SpanKY gentoo-dev 2011-03-01 00:13:35 UTC
please make sure i havent screwed things up in the process ... and if you know of other CTARGET's that people are using, let us know so i can tweak the match

http://sources.gentoo.org/eclass/toolchain.eclass?r1=1.450&r2=1.451