From b5731533853fc09966147e0a3f20d8e94a9f9a5b Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Sun, 12 Feb 2012 11:05:24 +0100 Subject: [PATCH] Add a small assembler program --- .gitignore | 1 + Makefile | 7 +++++++ asm/null.s | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 asm/null.s diff --git a/.gitignore b/.gitignore index ab9dcb4..c703ac4 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ /log +/asm/null /c/c++-dynamic-null /c/c++-static-null /c/c-diet-dynamic-null diff --git a/Makefile b/Makefile index 3b70f75..e290bf9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ PROGS = \ + asm/null \ c/c-diet-static-null c/c-diet-dynamic-null \ c/c-libc-static-null c/c-libc-dynamic-null \ c/c++-static-null c/c++-dynamic-null \ @@ -28,6 +29,11 @@ all: $(PROGS) $(PROGS): Makefile +asm/null: asm/null.s + as -o asm/null.o $< + ld -o $@ asm/null.o + strip $@ + c-diet-static-%: %.c diet gcc -static -O2 -Wall -o $@ $< strip $@ @@ -80,6 +86,7 @@ log: $(PROGS) $(SCRIPTS) Makefile .PHONY: log clean: + cd asm && rm *.o cd haskell && rm -f *.hi *.o cd ocaml && rm -f *.cmo *.cmi *.cmx *.o rm -f $(PROGS) diff --git a/asm/null.s b/asm/null.s new file mode 100644 index 0000000..09fdd80 --- /dev/null +++ b/asm/null.s @@ -0,0 +1,10 @@ + /* NOTE: this is hard-coded for x86-64; I don't know enough + assembly to make this nice and use system headers, etc. */ + .file "null.s" + .text + .globl _start + +_start: + mov $60, %eax + xor %rdx, %rdx + syscall -- 2.39.5