Answer the question
In order to leave comments, you need to log in
How to correctly connect cinvoke to FASM under ELF64?
Elementary preparation for a beginner:
format ELF64 executable 3
entry start
; include 'linInclude/import32.inc'
; include 'linInclude/proc32.inc'
; interpreter '/lib/ld-linux.so.2'
include 'linInclude/import64.inc'
include 'linInclude/proc64.inc'
interpreter '/lib64/ld-linux-x86-64.so.2'
needed 'libc.so.6'
import exit,\
printf
segment readable executable
cinvoke printf, fmtS, msg
cinvoke exit
segment readable writeable
msg db 'Hello, World!', 0xA, 0
fmtS db '%s', 0xA, 0
Answer the question
In order to leave comments, you need to log in
include 'linInclude/proc64.inc'
format ELF64 executable 3
include '/usr/share/fasm/examples/elfexe/dynamic/import64.inc'
interpreter '/lib64/ld-linux-x86-64.so.2'
needed 'libc.so.6'
import exit, printf
segment readable executable
entry $
lea rdi, [fmtS]
lea rsi, [msg]
call [printf]
call [exit]
segment readable writeable
msg db 'Hello, World!', 0xA, 0
fmtS db '%s', 0xA, 0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question