Created
January 30, 2021 02:17
-
-
Save docwhat/dfd5d376b0fc69ac11c057401942ad4e to your computer and use it in GitHub Desktop.
Playing with clang and assembly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <unistd.h> | |
#define HELLO "Hello, world!\n" | |
int main(int argc, char *argv[]) | |
{ | |
write(1, HELLO, sizeof(HELLO)); | |
exit(0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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