Running into exec format issues with ARM64 script on 2020 macbook pro

272 views Asked by At

I am new to ARM64 so I probably made a simple mistake I was trying to get a simple script to run but kept running into this error (I am on a 2020 MacBook Pro with the latest Sonoma 14.0) zsh: exec format error: ./cubic I then tried to execute a simple helloworld script -

.global _start

.section .data
hello_message:
    .asciz "Hello, World!\\n"

.section .text
_start:
    mov x8, #64          
    mov x0, #1           
    ldr x1, =hello_message  
    ldr x2, =13           
    svc #0
    mov x8, #93          
    mov x0, #0           
    svc #0

I then compiled and linked it using -
aarch64-elf-as -o hello.o hello.s
aarch64-elf-ld -o hello hello.o

But I ran into the same issue for this script after running ./hello

zsh: exec format error: ./hello 

After running file hello I get -

hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped

So I it should be executable right???
Is it how I compiled and linked it above that is causing this issue?

I have tried it in different terminals (warp vs console) and in different shells (bash vs zsh) and get the same error everyplace everytime


I tried executing an ARM64 executable with no (known) compiling or linking issues. The ideal output would simply be - Hello, World!

0

There are 0 answers