Page MenuHomeFreeBSD

amd64: improve -m32 support in machine/*.h
AbandonedPublic

Authored by brooks on Mar 28 2022, 6:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 24 2023, 10:13 AM
Unknown Object (File)
Dec 20 2023, 7:34 AM
Unknown Object (File)
Dec 12 2023, 2:30 PM
Unknown Object (File)
Nov 23 2023, 3:17 PM
Unknown Object (File)
Sep 24 2023, 9:15 PM
Unknown Object (File)
Sep 6 2023, 8:27 AM
Unknown Object (File)
Sep 2 2023, 11:24 AM
Unknown Object (File)
Aug 14 2023, 11:25 PM
Subscribers

Details

Reviewers
jhb
imp
jrtc27
Summary

Install i386 headers in /usr/include/i386 and include their contents
in place of the amd64 headers where required. In most cases, rely on
the same header guards being used to cause the amd64 body to be
ignored.

With this it is possible to compile all libraries and csu bits for
i386 against an amd64 sysroot using -m32.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 44905
Build 41793: arc lint + arc unit

Event Timeline

I'm looking for feedback on this approach.

Installing all the i386 headers is a little heavy, but easy to implement. Installing select files would be possible, if more work. Giving all the these headers the full include/x86 treatment would be more work, but maybe cleaner?

Note that I'm current missing make-delete-old support.

This revision is now accepted and ready to land.Mar 28 2022, 10:28 PM

Relying on the include guards to avoid the need for an #else seems a bit gross... and tbh I'd rather these did get the x86 treatment, you could surely automate it

sys/amd64/include/asmacros.h
43

Why?..

Relying on the include guards to avoid the need for an #else seems a bit gross... and tbh I'd rather these did get the x86 treatment, you could surely automate it

I could just go with the big hammer and smoosh the files together automatically with some fixups of the copyright blocks as required. I fear there would then be a desire to dedup the cases and getting that wrong feels like a recipe for weird bugs. That being said, I've got a short list of files that should be consolidated since they are identical.

sys/amd64/include/asmacros.h
43

vdso32 is built with -m32 but expects to find things like the machine symlink in the kernel build directory and AFACT doesn't search the sysroot at all so it doesn't find the installed i386. It's been working all along with only the amd64 asmacros.h

Hmm, I would prefer the x86 approach, but it is indeed more work.

I've done x86-ification patches with a split of combining that that have high level of duplication and punting the i386 version to a new x86/i386 directory where there is little commonality. I'll post them, likely as a GitHub PR since it's a bunch of mostly boring changes I want to be separate commits for revertability.