Score:2

Compiling ARMv7A (AArch32) code on an ARMv8A (AArch64) machine?

id flag

I've read in many places that ARMv8A supports backwards compatible ARMv7A code (the former is now called AArch64 and the later is now called AArch32).

I'm running an ARMv8A machine (on the Raspberry Pi 4B, with the BCM2835 SoC), but I would like to write and debug GNU Assembly code written in ARMv7A language. How do I compile .S files written in ARMv7A and run it on my machine?

I was hoping that something like

    gcc MyAsmFile.S -march=armv7-a

would work, but I get the following error:

    cc1: **error**: unknown value: 'armv7-a' for '-march'
    cc1: *note*: valid arguments are: armv8-a ... armv8.6-a native; did you mean '**armv8-a**'?

Any advice would be appreciated! The reason is that I'd like to practice ARMv7A code specifically as that is what we will use at work.

hr flag
Maybe you need an actual cross toolchain (gcc-arm-linux-gnueabihf possibly)?
Gregory Fenn avatar
id flag
Thank you but how do I then run the compiled code? Is there any special flags I would need to tell gcc-arm-linux-gnuabihf that the code is written in ARMv7A but will be run on an AArch32? Or are these identical and can just run natively interchangably?
hr flag
Sorry I know nothing about that architecture really
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.