Date: Thu, 18 May 2023 11:52:56 -0700 From: Mark Millard <marklmi@yahoo.com> To: Thomas David Rivers <rivers@dignus.com> Cc: John F Carr <jfc@mit.edu>, "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org> Subject: Re: 32-bit executables on aarch64? Message-ID: <9916CA51-E1F3-45C5-A489-6731B12D6F65@yahoo.com> In-Reply-To: <46BE47DA-9306-4682-8320-D2CBEB5918F7@mit.edu> References: <202305181816.34IIGA8P024382@office.dignus.com> <46BE47DA-9306-4682-8320-D2CBEB5918F7@mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On May 18, 2023, at 11:22, John F Carr <jfc@mit.edu> wrote: > I had to set up a jail to test 32 bit ARM on a 64 bit host. I just install a armv7 world in a directory tree and have a script that does a chroot into the directory tree after devfs and nullfs mounts (and also does the umount's). An example: # more ~/do-chroot-main-CA7.sh=20 #! /bin/sh mkdir -p /usr/obj/DESTDIRs/main-CA7-chroot/dev/ \ && mount -tdevfs devfs /usr/obj/DESTDIRs/main-CA7-chroot/dev/ \ && mkdir -p = /usr/obj/DESTDIRs/main-CA7-chroot/usr/local/poudriere/data/packages/main-C= A7-default/ \ && mount_nullfs /usr/local/poudriere/data/packages/main-CA7-default \ = /usr/obj/DESTDIRs/main-CA7-chroot/usr/local/poudriere/data/packages/main-C= A7-default/ \ && mkdir -p /usr/obj/DESTDIRs/main-CA7-chroot/usr/ports/ \ && mount_nullfs /usr/ports /usr/obj/DESTDIRs/main-CA7-chroot/usr/ports/ = \ && env IN_CHROOT=3D"main-CA7-chroot" chroot = /usr/obj/DESTDIRs/main-CA7-chroot/ umount /usr/obj/DESTDIRs/main-CA7-chroot/usr/ports/ umount = /usr/obj/DESTDIRs/main-CA7-chroot/usr/local/poudriere/data/packages/main-C= A7-default/ umount /usr/obj/DESTDIRs/main-CA7-chroot/dev/ ("IN_CHROOT" is something specific to what I set up.) Clearly I adjust some material in the armv7 world as well, such as causing it to use the path: /usr/local/poudriere/data/packages/main-CA7-default/ > If you get past the link error, expect the program to fail at startup. Yea, no system lib32 for enabling armv7 programs directly. (powerpc64 and powerpc is an example context where lib32 was put in place.) > $ file /bin/ls /usr/jail/armv7/bin/ls > /bin/ls: ELF 64-bit LSB pie executable, ARM aarch64, = version 1 (FreeBSD), dynamically linked, interpreter = /libexec/ld-elf.so.1, for FreeBSD 13.2 (1302505), FreeBSD-style, = stripped > /usr/jail/armv7/bin/ls: ELF 32-bit LSB executable, ARM, EABI5 version = 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, = FreeBSD-style, for FreeBSD 13.2 (1302500), stripped > $ /usr/jail/armv7/bin/ls > ELF interpreter /libexec/ld-elf.so.1 not found, error 8 > Abort trap >=20 > "Not found" means "is not a 32 bit executable." Because both 32 and = 64 bit progams use the same intepreter pathname they can't both work. >=20 >=20 >> On May 18, 2023, at 14:16, Thomas David Rivers <rivers@dignus.com> = wrote: >>=20 >>=20 >> Tried the following with a small "hello world" program on=20 >> FreeBSD freebsd 13.2-RELEASE FreeBSD 13.2-RELEASE = releng/13.2-n254617-525ecfdad597 GENERIC arm64 >>=20 >> # cc -m32 hello.c >>=20 >> To get these errors: >>=20 >> ld: error: /tmp/hello-1eb3b8.o is incompatible with /usr/lib/crt1.o >> cc: error: linker command failed with exit code 1 (use -v to see = invocation) >>=20 >> Is building a 32-bit program not supported on 13.2 arm64? >>=20 >> man cc >>=20 >> gave me the CLANG doc... which didn't even mention "m32"; so perhaps >> I just need a different set of options? I tried -arch arm but I = still >> got 64-bit code. Also, I tried several other -arch options and = didn't >> see a difference, even with -arch x86, I still got Aarch64 code. >>=20 >> - Many thanks! - >> - Dave Rivers - >>=20 >> -- >> rivers@dignus.com Work: (919) 676-0847 >> Get your mainframe programming tools at http://www.dignus.com >>=20 >=20 =3D=3D=3D Mark Millard marklmi at yahoo.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9916CA51-E1F3-45C5-A489-6731B12D6F65>