Code: Select all
/* Data segment: define our message string and calculate its length. */
msg:
.ascii "Hello, ARM64!\n"
len = . - msg
.text
/* Our application's entry point. */
.globl _start
_start:
/* syscall write(int fd, const void *buf, size_t count) */
mov x0, #1 /* fd := STDOUT_FILENO */
ldr x1, =msg /* buf := msg */
ldr x2, =len /* count := len */
mov w8, #64 /* write is syscall #64 */
svc #0 /* invoke syscall */
/* syscall exit(int status) */
mov x0, #0 /* status := 0 */
mov w8, #93 /* exit is syscall #93 */
svc #0 /* invoke syscall */
Code: Select all
ld.lld: error: duplicate symbol: _start
>>> defined at crtbegin.c
>>> /home/developer/Android/android-ndk-r27c-linux/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/./../sysroot/usr/lib/aarch64-linux-android/27/crtbegin_dynamic.o:(_start)
>>> defined at /tmp/hello64bit-fb91b4.o:(.text+0x0)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Code: Select all
ld.lld: error: undefined symbol: main
>>> referenced by crtbegin.c
>>> /home/developer/Android/android-ndk-r27c-linux/android-ndk-r27c/toolchains/llvm/prebuilt/linux-x86_64/bin/./../sysroot/usr/lib/aarch64-linux-android/27/crtbegin_dynamic.o:(_start_main)