Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 476272 - dev-lang/v8: add mips support
Summary: dev-lang/v8: add mips support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: MIPS Linux
: Normal enhancement (vote)
Assignee: Chromium Project
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-07-09 12:06 UTC by Manuel Lauss
Modified: 2013-08-13 03:41 UTC (History)
2 users (show)

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


Attachments
MIPS support for v8-9999 ebuild (v8-9999-mips.patch,1.26 KB, patch)
2013-07-09 12:06 UTC, Manuel Lauss
Details | Diff
support little-endian MIPS32 toolchains in v8-9999.ebuild (v8-9999-mips-2.patch,882 bytes, patch)
2013-07-10 08:01 UTC, Manuel Lauss
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Lauss 2013-07-09 12:06:03 UTC
Patch so add MIPS support to v8-9999.
Builds and runs at least with my tested mipsel-softfloat-linux-gnu toolchain on real mips hardware.


Reproducible: Always
Comment 1 Manuel Lauss 2013-07-09 12:06:37 UTC
Created attachment 352920 [details, diff]
MIPS support for v8-9999 ebuild
Comment 2 Mike Gilbert gentoo-dev 2013-07-10 00:42:17 UTC
Thanks!

+*v8-3.19.18.9 (10 Jul 2013)
+
+  10 Jul 2013; Mike Gilbert <floppym@gentoo.org> +v8-3.19.18.9.ebuild,
+  -v8-3.19.17.ebuild, v8-9999.ebuild:
+  Dev channel bump. Add build support for mips, bug 476272; patch by Manuel
+  Lauss.
Comment 3 Matt Turner gentoo-dev 2013-07-10 00:50:45 UTC
Is this an upstream patch?

I notice it bails out if it's big endian or mips64, which we can handle by hard masking it on certain profiles, but then I saw this:

if [[ ${CHOST} == *loongson* ]] ; then

erf. Now we need to set our CHOST differently on loongson systems for this to work right?
Comment 4 Mike Gilbert gentoo-dev 2013-07-10 01:00:46 UTC
(In reply to Matt Turner from comment #3)
> Is this an upstream patch?
> 

The patch just adds some logic to toggle various gyp flags.

The relevent gyp section is here:

https://code.google.com/p/v8/source/browse/trunk/build/common.gypi#323
Comment 5 Mike Gilbert gentoo-dev 2013-07-10 01:05:07 UTC
(In reply to Matt Turner from comment #3)
> if [[ ${CHOST} == *loongson* ]] ; then
> 
> erf. Now we need to set our CHOST differently on loongson systems for this
> to work right?

It looks like passing mips_arch_variant=loongson flag causes '-mips3 -Wa,-mips3' to be added to CFLAGS. If there is a better way to handle this, great.
Comment 6 Manuel Lauss 2013-07-10 06:40:21 UTC
(In reply to Matt Turner from comment #3)
> Is this an upstream patch?
> 
> I notice it bails out if it's big endian or mips64, which we can handle by
> hard masking it on certain profiles, but then I saw this:
> 
> if [[ ${CHOST} == *loongson* ]] ; then
> 
> erf. Now we need to set our CHOST differently on loongson systems for this
> to work right?

I just added loongson because the gyp files  have it in there.  Better 64bit MIPS support likely needs a few more adjustments in the v8 source/gyp files.
Right now I can only test mips32.
Comment 7 Anthony Basile gentoo-dev 2013-07-10 07:50:54 UTC
(In reply to Manuel Lauss from comment #6)
> (In reply to Matt Turner from comment #3)
> > Is this an upstream patch?
> > 
> > I notice it bails out if it's big endian or mips64, which we can handle by
> > hard masking it on certain profiles, but then I saw this:
> > 
> > if [[ ${CHOST} == *loongson* ]] ; then
> > 
> > erf. Now we need to set our CHOST differently on loongson systems for this
> > to work right?
> 
> I just added loongson because the gyp files  have it in there.  Better 64bit
> MIPS support likely needs a few more adjustments in the v8 source/gyp files.
> Right now I can only test mips32.

The loongson image we're supporting has the following

    CFLAGS="-O2 -march=loongson2f -Wa,-mfix-loongson2f-nop -pipe"
    CXXFLAGS="${CFLAGS}"
    CHOST="mips64el-unknown-linux-gnu"

The patch in comment 1 would not match correctly.  It matches on ${CHOST} == mips*el* and gives myarch="mipsel" which is not what we want.
Comment 8 Manuel Lauss 2013-07-10 07:59:58 UTC
(In reply to Anthony Basile from comment #7)
> (In reply to Manuel Lauss from comment #6)
> > (In reply to Matt Turner from comment #3)
> > > Is this an upstream patch?
> > > 
> > > I notice it bails out if it's big endian or mips64, which we can handle by
> > > hard masking it on certain profiles, but then I saw this:
> > > 
> > > if [[ ${CHOST} == *loongson* ]] ; then
> > > 
> > > erf. Now we need to set our CHOST differently on loongson systems for this
> > > to work right?
> > 
> > I just added loongson because the gyp files  have it in there.  Better 64bit
> > MIPS support likely needs a few more adjustments in the v8 source/gyp files.
> > Right now I can only test mips32.
> 
> The loongson image we're supporting has the following
> 
>     CFLAGS="-O2 -march=loongson2f -Wa,-mfix-loongson2f-nop -pipe"
>     CXXFLAGS="${CFLAGS}"
>     CHOST="mips64el-unknown-linux-gnu"
> 
> The patch in comment 1 would not match correctly.  It matches on ${CHOST} ==
> mips*el* and gives myarch="mipsel" which is not what we want.

okay i'll change the patch to only support mips32 and i'll leave 64bit/micromips support to you imgtec guys :)
Comment 9 Manuel Lauss 2013-07-10 08:01:28 UTC
Created attachment 352986 [details, diff]
support little-endian MIPS32 toolchains in v8-9999.ebuild

Support little-endian MIPS32 toolchain in v8-9999 ebuild
Comment 10 Anthony Basile gentoo-dev 2013-07-10 08:55:28 UTC
(In reply to Manuel Lauss from comment #6)
> > 
> > The patch in comment 1 would not match correctly.  It matches on ${CHOST} ==
> > mips*el* and gives myarch="mipsel" which is not what we want.
> 
> okay i'll change the patch to only support mips32 and i'll leave
> 64bit/micromips support to you imgtec guys :)

We'll have to think about how to match on the loongson because 

    mips64el-unknown-linux-gnu-gcc -mips3 -mabi=32 -o test test.c

works just fine to create LE mipsIII o32 elfs, but would bail out saying die "generic MIPS 64bit is not yet supported" using your first patch.  Matching on CHOST is really not correct anyhow.  The v8 build system should test if it can use the toolchain to build its most preferred set of cflags and the drop accordingly.  The CHOST does not specify all the possibilities.

The real problem I'm having here is, why does v8 not build for 64-bits or BE? Is there asm in there?  Are there alignment problems?  These should be addressed because the default for the loongson is (and should remain) ABI=n32.

Last point, falling back on myconf+=" -Dmips_arch_variant=mips32" if the CHOST doesn't match 32r2 may be a problem because not all 32-bit mips can handle arch=mips32.  Most can so let's cross that bridge if we hit it.
Comment 11 Manuel Lauss 2013-07-10 09:45:09 UTC
(In reply to Anthony Basile from comment #10)
> (In reply to Manuel Lauss from comment #6)
> > > 
> > > The patch in comment 1 would not match correctly.  It matches on ${CHOST} ==
> > > mips*el* and gives myarch="mipsel" which is not what we want.
> > 
> > okay i'll change the patch to only support mips32 and i'll leave
> > 64bit/micromips support to you imgtec guys :)
> 
> We'll have to think about how to match on the loongson because 
> 
>     mips64el-unknown-linux-gnu-gcc -mips3 -mabi=32 -o test test.c
> 
> works just fine to create LE mipsIII o32 elfs, but would bail out saying die
> "generic MIPS 64bit is not yet supported" using your first patch.  Matching
> on CHOST is really not correct anyhow.  The v8 build system should test if
> it can use the toolchain to build its most preferred set of cflags and the
> drop accordingly.  The CHOST does not specify all the possibilities.
> 
> The real problem I'm having here is, why does v8 not build for 64-bits or
> BE? Is there asm in there?  Are there alignment problems?  These should be
> addressed because the default for the loongson is (and should remain)
> ABI=n32.
> 
> Last point, falling back on myconf+=" -Dmips_arch_variant=mips32" if the
> CHOST doesn't match 32r2 may be a problem because not all 32-bit mips can
> handle arch=mips32.  Most can so let's cross that bridge if we hit it.

I haven't checked the v8 source thoroughly it be and 64 bit are indeed
implemented (if loongson is supported, I guess 64bit is in there somewhere).
I only wanted to get 32bit working since that is the only hardware I have to
test it on.  I won't submit patches enabling stuff I can't test.
Comment 12 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-07-25 20:48:19 UTC
What is the status here?

I see two patches, and a following discussion.

I'm fine with taking some patch isolated to MIPS, just let me know which one. Do you also want a ~mips keyword on the latest v8 dev channel ebuild?
Comment 13 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2013-08-13 03:41:35 UTC
I think this was fixed in v8-3.19.18.9.