ARM64 assembly

Table of Contents

Next: , Up: (dir)   [Contents]

ARM64 assembly

This manual is for program, version version.


Previous: , Up: Top   [Contents]

1 Introduction

Get code ==> $ git clone https://github.com/sys-build/env_arm64_study.git

Change Directioy ==> $ cd env_arm64_study

Code list

$ cat main.c
#include <stdio.h>

extern int add(int, int);
int main()
{
	printf("hello arm64, 1+2=%d \n", add(1, 2));
	return 0;
}

$ cat hello.s
	.align	2
	.global	add
	.type	add, %function
add:
	add	w0, w0, w1
	ret

	.align	2
	.global	add_long
	.type	add_long, %function
add_long:
	add	x0, x0, x1
	ret

	.align	2
	.global	add64
	.type	add64, %function
add64:
	add	x0, x0, x1
	ret

Build and run

user@13e8173e8de4:~/work$ aarch64-linux-gnu-gcc -o hello hello.s main.c -static
user@13e8173e8de4:~/work$ qemu-aarch64 hello
hello arm64, 1+2=3