3

I'am trying to compile and run a 32 bit binary on a Cortex-A72 Armv8 using gcc compiler but i am not able to do it. I followed this prior thread Having trouble compiling 32-bit binary on 64-bit linux armv8 machine and i am realized too that the -m32 flag is not supported on ARMv8 linux machines.
Looking at https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html i didn’t find anything interesting.

In according to https://linux.die.net/man/1/arm-linux-gnu-gcc the AArch64 gcc options are:

-mbig-endian -mlittle-endian -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large -mstrict-align -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer -mtls-dialect=desc -mtls-dialect=traditional -march=name -mcpu=name -mtune=name

So my question is: is it possible to compile and run a 32-bit binary on a 64-bit linux Armv8 machine ? and is so, how ?

Thank you.

EDIT: this https://jensd.be/1126/linux/cross-compiling-for-arm-or-aarch64-on-debian-or-ubuntu worked for me

Sp00nc3
  • 87
  • 1
  • 8

1 Answers1

0

You can download the AArch32 target with hard float (arm-none-linux-gnueabihf) toolchain from the Cortex-A toolchain Arm site.

The archive file name is gcc-arm-10.2-2020.11-aarch64-arm-none-linux-gnueabihf.tar.xz, in the AArch64 Linux hosted cross compilers section.

You may need to install additional packages on your Aarch64 system - search for How to run 32-bit (armhf) binaries on 64-bit (arm64) and your Linux distribution name.

Frant
  • 5,382
  • 1
  • 16
  • 22