System Programming

Cross-Running Applications

Arm64 architectures are becoming more widespread than ever. The architecture is no longer just used for phones but also for personal computers and server computers. Learning some basic assembly has become necessary.

In addition to learning some basic assembly in this article, we will be using a powerful sub-tool of QEMU that allows cross-running native applications from other architectures. In our case, we will be running arm64 (aka aarch64) binaries on x86_64.

The Technology Stack Considered

TL;DR

The quickest way is to use the below docker:

docker run -it amine2029/qemu-user-aarch64
# wait for the bash from the docker; then
make
make run

Environment

To install the environment on ubuntu use the following apt commands:

sudo apt install gcc-aarch64-linux-gnu                                                                                                                                 sudo apt install qemu-user
sudo apt install make

Hello World Example

Source Code

Cross-Compile and Link “hello.asm”

aarch64-linux-gnu-as hello.asm -o hello.o
aarch64-linux-gnu-gcc hello.o -o hello.elf -nostdlib -static

Run the Cross-Compiled Binary

qemu-aarch64 ./hello.elf

Link to GitHub: https://github.com/Aminem2019/qemu-user-example

That’s it for today, feel free to comment, and don’t forget to clap and follow for more ;)

--

--

Big fan of technology with a recent interest in finance following the rise of cryptocurrencies.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amine

Amine

9 Followers

Big fan of technology with a recent interest in finance following the rise of cryptocurrencies.