Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 906293 - sys-libs/glibc -msoft-float buggy on MIPS
Summary: sys-libs/glibc -msoft-float buggy on MIPS
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal blocker
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-13 13:06 UTC by BRULE Herman
Modified: 2023-06-17 18:21 UTC (History)
0 users

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


Attachments
File to fix compilation error (stubs-o32_soft.h,959 bytes, text/x-chdr)
2023-05-13 13:06 UTC, BRULE Herman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description BRULE Herman 2023-05-13 13:06:45 UTC
Created attachment 861637 [details]
File to fix compilation error

Hi,
I had to create the attached file into /usr/include/gnu/stubs-o32_soft.h to be able to compile with -msoft-float on architecture MIPS (include missing).
Can you fix the glibc ebuild?
Cheers,
Comment 1 Andreas K. Hüttel archtester gentoo-dev 2023-05-27 10:06:32 UTC
I'm not sure how far you actually get when you manually add that file. 
You may just run into linking errors later on.

The missing file indicates that you toolchain has not been properly bootstrapped for the target. Essentially, what you need to do is set up a cross toolchain from hf to sf first...

Without more information there's not much we can do. If a (mips2 n32) softfloat stage is of interest, we could probably add it to the releng autobuilds though.
Comment 2 Joshua Kinard gentoo-dev 2023-06-15 17:30:41 UTC
(In reply to Andreas K. Hüttel from comment #1)
> I'm not sure how far you actually get when you manually add that file. 
> You may just run into linking errors later on.
> 
> The missing file indicates that you toolchain has not been properly
> bootstrapped for the target. Essentially, what you need to do is set up a
> cross toolchain from hf to sf first...
> 
> Without more information there's not much we can do. If a (mips2 n32)
> softfloat stage is of interest, we could probably add it to the releng
> autobuilds though.

I think you meant mips2 o32?  N32 ABI would not be possible with a mips2 ISA, which is restricted to 32-bits only (needs mips3 ISA minimum).

That said, yeah, soft-float is effectively a whole new architecture, for all intents and purposes.  One cannot build soft-float directly on a hard-float system.  Cross compilation would be needed using a soft-float CHOST tuple (I think it's something like mipsel-softfloat-linux-gnu for a little-endian mips 32-bit target), and the target system would need a soft-float-enabled kernel.  This is not a target that has been reliably supported in Gentoo, though, as FPU-less MIPS CPUs are even more esoteric than those with full FPUs.

A long-time MIPS user, Manuel Lauss, periodically posts gentoo-built soft-float builds, the latest one in Dec 2022.  That might be a good starting point for things:
http://mlau.at/files/mips32-linux/README.txt
Comment 3 BRULE Herman 2023-06-15 18:30:16 UTC
Hi, here 95% of the modem (ONU) is realtek, big endian without FPU, this build not help me.
I use this change + copy libatomic.so copy to build the gentoo for this target, this change should be default to do easy bootstrap?
Comment 4 Joshua Kinard gentoo-dev 2023-06-15 18:57:05 UTC
(In reply to BRULE Herman from comment #3)
> Hi, here 95% of the modem (ONU) is realtek, big endian without FPU, this
> build not help me.
> I use this change + copy libatomic.so copy to build the gentoo for this
> target, this change should be default to do easy bootstrap?

It sounds like you're trying to target an embedded-like system, and depending on available storage/memory, the environment may be too constrained for a Gentoo installation there.  If you're trying to build a small MIPS filesystem image for this embedded-like environment on a more standard platform, then you'll need to build a cross-compiler that can do big-endian + soft-float using the sys-devel/crossdev package to generate a cross-toolchain.  You'll also want to look into the Musl C library over GNU glibc, as that's designed more for embedded environments.  E.g., you'll probably need a CHOST tuple similar to "mips-softfloat-linux-musl" for crossdev to generate the right toolchain for you.

Another option might be to look at the OpenADK project, which is specifically geared for quickly setting up a build system for generating filesystem images for small & memory-constrained targets, so it might work out better for your scenario.  They have a number of MIPS targets that are supported and a fairly extensive configuration system.
Comment 5 BRULE Herman 2023-06-15 19:01:47 UTC
CPU 4 thread, 1T storage, 512MB DDR3, I don't see as embedded, maybe I'm too old.
I wish gentoo to have a full system, to compile with distcc (I have 50 nodes) my software and other software and run it.
Comment 6 Joshua Kinard gentoo-dev 2023-06-17 18:21:14 UTC
(In reply to BRULE Herman from comment #5)
> CPU 4 thread, 1T storage, 512MB DDR3, I don't see as embedded, maybe I'm too
> old.
> I wish gentoo to have a full system, to compile with distcc (I have 50
> nodes) my software and other software and run it.

That does sound like a beefier setup than a standard embedded environment.  I admit I am surprised they didn't just slap an FPU into it, since one of the four coprocessor slots in a MIPS CPU is typically reserved for FPU hardware and I don't see significant cost-savings in excluding that logic from the silicon.

That said, MIPS soft-float in general, regardless of endianness, has not been a supported target in Gentoo before.  So if you want to use Gentoo for this project, you'll have to bootstrap the environment yourself.  We can't just go and randomly add toolchain-generated header/include files to our toolchain packages to resolve a build issue in an unsupported target.  If it's a legit issue of the file simply not being generated by the toolchain at a certain point, then that is an upstream problem and you would need to trace down a failure point and/or even provide a testcase with upstream so that they can try and reproduce the cause.

If you do manage to bootstrap such an environment and can generate stage1/stage2/stage3 tarballs using our Catalyst stage-building tool, then you can open a few bugs with the relevant teams to get the necessary changes added.  At a minimum, that'd be the MIPS team for a soft-float profile definition, possibly toolchain for any changes to binutils/gcc/glibc (or the Gentoo Musl team for any musl changes), and the Releng maintainers for any changes you made to Catalyst and/or your *.spec files used to build those stages.