zer0
zer0

Reputation: 3

'Illegal Instruction' when trying to run a .ELF file on Raspberry PI 4

I have been trying to assemble some simple ARM 64 bit assembly for my Raspberry Pi 4, and it returns the message 'Illegal instruction' when i try to run the .elf file. I am accessing the Pi through SSH in puTTY, running the standard Raspberry PI 64 bit OS (not lite as I forgot), and editing the code in GNU Nano 7.2. The Pi was updated and upgraded around 30 mins before I tried to run it so its unlikely that there was an issue. There is a screenshot of what I get when I compile and run. This is my first time interacting with assembly, I am happy to answer any questions and try any solutions.

Here is the code (screenshot):

# Test

.global _start
.section .text

_start:
        mov x0, #4


.section .data

I assembled this with gcc using as test.asm -o test.o;gcc test.o -o test.elf -nostdlib, which runs without any messages (screenshot).

Upvotes: 0

Views: 29

Answers (0)

Related Questions