I have a function foo written in assembly and compiled with yasm and GCC on Linux (Ubuntu) 64-bit. It simply prints a message to stdout using puts(), here is how it looks:
bits 64
extern puts
global foo
section .data
message:
db 'foo() called', 0
section .text
foo:
push rbp
mov rbp, rsp
lea rdi, [rel message]
call puts
pop rbp
ret
Run Code Online (Sandbox Code Playgroud)
It is called by a C program compiled with GCC:
extern void foo();
int main() {
foo(); …Run Code Online (Sandbox Code Playgroud)