Page MenuHomeFreeBSD

Enable /usr/lib32 for o32 binaries on mips64.
ClosedPublic

Authored by jhb on Jan 3 2017, 7:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 7, 12:25 AM
Unknown Object (File)
Mar 10 2024, 9:27 AM
Unknown Object (File)
Mar 10 2024, 7:48 AM
Unknown Object (File)
Mar 10 2024, 7:48 AM
Unknown Object (File)
Jan 10 2024, 11:16 PM
Unknown Object (File)
Dec 28 2023, 8:49 PM
Unknown Object (File)
Dec 28 2023, 8:45 PM
Unknown Object (File)
Dec 27 2023, 9:09 AM
Subscribers

Details

Summary

Build and install an o32 set of libraries on mips64 suitable for running
o32 binaries via COMPAT_FREEBSD32. Enable COMPAT_FREEBSD32 in MALTA64.

Test Plan
  • Run mips o32 binaries under a MALTA64 kernel in qemu.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 6549
Build 6773: arc lint + arc unit

Event Timeline

jhb retitled this revision from to Enable /usr/lib32 for o32 binaries on mips64..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added reviewers: jmallett, adrian.
jhb added inline comments.
Makefile.libcompat
43

I could perhaps move the OBJCOPY bits out of the .ifdef, though if I did that I would probably just make that part MI as it's the same value on amd64 and powerpc as well.

jmallett edited edge metadata.

This looks good to me, though it'd be nice to see the default ISA thing resolved or confirmed. I also do favour collapsing the target emulation stuff more as possible, but it's not worth holding this up.

Makefile.libcompat
37

I think this is wrong. Do we in other places use -march=mips64 as the default for 64-bit MIPS? I thought we used MIPS III as the base target ISA for 64-bit MIPS, in which case we'd certainly want likewise for the o32 libs for an otherwise-unspecified 64-bit MIPS system. But then, I'm basically of the belief that TARGET_CPUTYPE ought to be required on MIPS. What does GCC default to?

This revision is now accepted and ready to land.Jan 4 2017, 3:46 AM
Makefile.libcompat
37

I'm not sure what we use as the base as it is some local hack we have to gcc 4.2.1 to set the default ABI. To use an external toolchain I have to set a default CPUTYPE when building (so just using TARGET_ARCH=mips fails to build with external GCC for example). I have a pending patch to set a minimum -march= in bsd.cpu.mk. My guess was to use -march=mips32 for o32 and -march=mips64 for n64/n32. If you have a better suggestion we can use something else.

Makefile.libcompat
37

It looks like with GCC in base we internally use the ISA "from-abi", except for 32-bit binaries, for which we default to mips3, so we don't end up with MIPS I ISA awfulness. So I suppose we should use -march=mips3 here, to match gnu/usr.bin/cc/Makefile.inc.

Makefile.libcompat
37

Hmmm, ok. In this case we know are building for a 64-bit capable CPU though (e.g. on FreeBSD/amd64 the 32-bit libc can assume SSE2 is present even though it's not available on all i386 CPUs because the lib32 libc will only be present on amd64 CPUs which do always have SSE2). Not sure if there is a minimum -march= setting for 64-bit mips that is above mips3. If not, I'm fine with using mips3.

bdrewery edited edge metadata.

This made me notice that hier(7) is missing /usr/lib32, but it is a separate issue.

Makefile.libcompat
37

MIPS-III is the 32-bit and 64-bit baseline for FreeBSD, so it's appropriate here. We depend on MIPS-III features, and anything above that is optional, and requires a CPUTYPE be specified.

jhb edited edge metadata.
  • Rebase.
  • Use mips3 instead of mips64 as default -march.
  • Pull OBJCOPY override out if .ifdef.
This revision now requires review to proceed.Jan 6 2017, 8:06 PM
jmallett edited edge metadata.
This revision is now accepted and ready to land.Jan 6 2017, 8:07 PM
imp edited edge metadata.

This looks good, modulo one or two nits. The unrelated changes can be lumped in if it's a big hassle. The emulation stuff is OK to go in, but it will likely get grumps from kan@.

Makefile.libcompat
11–16

Perhaps this should be done as a separate commit, since it is not mips related.

26–28

likewise.

43

This undoes, a little, kan@'s moves to not specify the name here because it's inconsistent between internal and external toolchains.

Makefile.libcompat
11–16

Hmm, I can.

43

No, this works fine with external GCC./binutils. The thing that is different is the internal name in linker scripts (upstream binutils appends "-freebsd" to the OUTPUT_FORMAT() string). The linker emulation names are the same for both.

This revision was automatically updated to reflect the committed changes.