Reputation: 53
I would like to compile/assemble an assembly (.s) file that returns 0. To compile it, I am using gcc -m32 -nostdlib file.s -o out
.
But I get the following errors:
file.s:3:14: error: unexpected token in operand
movl $0, %eax
^
file.s:4:5: error: invalid instruction
ret
^
When I run gcc -m32 -v
, it says the target is "arm-apple-darwin21.1.0", if that could help answering my question.
Here is my assembly:
file.s
.globl main
main:
movl $0, %eax
ret
Any ideas on how I could solve this? Thank you and have a nice day.
Upvotes: 1
Views: 475
Reputation: 53
I fixed it, thanks to everyone who came by this question. As Jester said in the comment section, it was just my assembly code not being compatible with an ARM system.
Upvotes: 1