32-bit executables on aarch64?

Mark Millard marklmi at yahoo.com
Wed Mar 31 19:39:37 UTC 2021



On 2021-Mar-31, at 11:26, Thomas David Rivers <rivers at dignus.com> wrote:

> marklmi at yahoo.com  wrote:
>> armv7# file `which uname`
>> /usr/bin/uname: ELF 32-bit LSB executable, ARM, EABI5 version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, FreeBSD-style, for FreeBSD 14.0 (1400005), not stripped
>> 
>> armv7# uname -apKU
>> FreeBSD RPi4B 14.0-CURRENT FreeBSD 14.0-CURRENT mm-src-n245445-def0058cc690 GENERIC-NODBG  arm armv7 1400005 1400005
>> 
>> (I did both buildworld builds from the same source.)
>> 
>> There is no lib32 implementation for aarch64.
>> So, direct execution of code for armv7 FreeBSD
>> without being in such a chroot is not available.
>> (I ignore qemu and the like here.)
>> 
>> ===
>> Mark Millard
> 
> Ah!
> 
> So, the kernel _can_ run a 32-bit executable...

Only in a chroot to an armv7 world, not directly.
You can use the chroot's system compiler/toolchain
to build armv7 materials for use in the chroot.

powerpc64 FreeBSD on on PowerMacs has a lib32 in
the powerpc64 world and so allows 32-bit powerpc
FreeBSD coded to be used either with or without
a choot being in use to do so. amd64 and i386 are
similar. More than the kernel is involved in
avoiding the need for a chroot to be in use.

powerpc64 allows building without lib32 and
without it the handling is like for aarch64
and armv7.

> but we just can't
> build one on an aarch64 machine...

Without a lib32 in the aarch64 world, the armv7
FreeBSD code use has to be from inside an
appropriate chroot as far as I know.

> I wonder if I can "cross-build" an LLVM/dcc for armv7 and just
> cross-compile to get a 32-bit executable that executes on 
> a 64-bit kernel.. perhaps with -static to avoid any runtime problems?

armv7 FreeBSD code use: only in an appropriate
chroot unless the lib32 has been implmented
(as is installed).

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-arm mailing list