Skip to content

Instantly share code, notes, and snippets.

@docwhat
Created January 30, 2021 02:17
Show Gist options
  • Save docwhat/dfd5d376b0fc69ac11c057401942ad4e to your computer and use it in GitHub Desktop.
Save docwhat/dfd5d376b0fc69ac11c057401942ad4e to your computer and use it in GitHub Desktop.
Playing with clang and assembly
#include <stdlib.h>
#include <unistd.h>
#define HELLO "Hello, world!\n"
int main(int argc, char *argv[])
{
write(1, HELLO, sizeof(HELLO));
exit(0);
}
default: hello hello-asm
hello-asm.s: hello.c
clang -S -masm=intel -o $@ $<
%: %.s
clang -o $@ $<
%: %.o
clang -o $@ $<
.PHONY: clean
clean:
@git clean -xffd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment