Re: 32-bit executables on aarch64?

John F Carr <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
I had to set up a jail to test 32 bit ARM on a 64 bit host.  If you get past the link error, expect the program to fail at startup.

$ 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

"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.


> On May 18, 2023, at 14:16, Thomas David Rivers <[email protected]> wrote:
> 
> 
> Tried the following with a small "hello world" program on 
>   FreeBSD freebsd 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC arm64
> 
> # cc -m32 hello.c
> 
> To get these errors:
> 
>  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)
> 
> Is building a 32-bit program not supported on 13.2 arm64?
> 
>  man cc
> 
> 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.
> 
> - Many thanks! -
> - Dave Rivers -
> 
> --
> [email protected]                        Work: (919) 676-0847
> Get your mainframe programming tools at http://www.dignus.com
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.