Following code:
.intel_syntax noprefix.text .global _start_start: ret
compiles using GCC: gcc -o main -nostartfiles -nostdlib main.S
But this does throw a memory-access-error when calling ./main
So I thought - maybe Stack-Alignment:
.intel_syntax noprefix.text .global _start_start: sub rsp, 8 ret
This code also compiles using the same flags.However, this code does never return.
So how do I create a main()-Assembly-Procedure using Gcc?
This, however, works:
.intel_syntax noprefix.text .global _start_start: mov rax, 60 ;Linux Syscall: exit() mov rdi, 13 syscall
Are there any workarounds, so calling ret
would suffice?