Skip to content

Instantly share code, notes, and snippets.

@romac
Last active December 22, 2015 01:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romac/6397977 to your computer and use it in GitHub Desktop.
Save romac/6397977 to your computer and use it in GitHub Desktop.
BITS 64
global _foo
_foo:
mov rax, 42
ret
#include <stdio.h>
int foo( void );
int main( void )
{
printf( "%d\n", foo() );
return 0;
}
foo: main.o foo.o
clang -o $@ $^
%.o: %.c
clang -o $@ -c $^
%.o: %.s
yasm -f macho64 -o $@ $^
clean:
rm foo
rm ./*.o
.PHONY: clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment