Re: sys/modules/Makefile and MACHINE_ARCH vs arm64 (in use) vs aarch64 (not in use) VS. man arch; also COMPAT_FREEBSD32_ENABLED use

From: Mark Millard <marklmi_at_yahoo.com>
Date: Thu, 03 Aug 2023 00:25:29 UTC
On Aug 2, 2023, at 12:56, Mark Millard <marklmi@yahoo.com> wrote:

> On Aug 2, 2023, at 11:16, Warner Losh <imp@bsdimp.com> wrote:
> 
>> Those all look wrong to me.
>> 
>> Warner 
>> 
>> On Wed, Aug 2, 2023, 11:27 AM Mark Millard <marklmi@yahoo.com> wrote:
>> man arch reports:
>> 
>>           MACHINE       MACHINE_CPUARCH       MACHINE_ARCH
>>           arm64         aarch64               aarch64
>> . . .
>>           arm           arm                   armv6, armv7
>> 
>> So I'd not expect arm64 in MACHINE_ARCH . But
>> sys/modules/Makefile has (from a grep for MACHINE_ARCH):
>> 
>> .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "arm64"
>> .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "arm64" || ${MACHINE_ARCH:Mpowerpc64*}
>> 
>> 
>> Another issue may be that COMPAT_FREEBSD32_ENABLED is only
>> put to use in the Makefile for MACHINE_CPUARCH being i386
>> or amd64 :
>> 
>> .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
>> _agp=           agp
>> .if ${MACHINE_CPUARCH} == "i386" || !empty(COMPAT_FREEBSD32_ENABLED)
>> . . .
> 
> 
> I'll note that, for example, i386 vs. armv7 do not match
> for some struct md_ioctl field offsets and the overall
> size.

Turns out no member offsets were different but the size
was: just differing tail padding in the structure. Still
it means some conditional differences across i386 and
armv7. (I've no clue if the 32-bit powerpc lib32/chroot
handling is working on powerpc64 vs. not. So I make no
claims relative to such.)

> Mike Karels is looking at getting struct md_ioctl32
> correctly matching each of of the contexts: i386, (32-bit)
> powerpc, and armv7.
> 
> I do not know if there are other COMPAT_FREEBSD32 adjustments
> needed for differences in memory layout across the 3 (i386,
> powerpc, armv7). md_ioctl I learned about via kyua test runs
> and looking at the background for some things it reported for
> armv7.
> 
> I've not found a clear indication of what is expected to work
> for chroot/lib32 vs. what is not expected to work. It seems
> one must look in the code and see if one finds conditional
> material based, in part, on COMPAT_FREEBSD32. It might also
> be that COMPAT_FREEBSD32 for i386 vs. armv7 vs. powerpc
> might not be intending identical coverage for all I know.
> So seeing COMPAT_FREEBSD32 might not be enough to know the
> intent.


===
Mark Millard
marklmi at yahoo.com