From 0829c5762cd1b23da09d7e9318ce7a9e5ea648f2 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 12 Aug 2016 14:17:55 +0200 Subject: [PATCH] mescc/elf.mes: write minimal ELF header. --- .gitignore | 1 + GNUmakefile | 2 +- elf.mes | 12 ++++++++++++ mescc.scm | 10 ++++++++-- 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 elf.mes diff --git a/.gitignore b/.gitignore index dc0185ba..11e545fe 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.go *.o *~ +/a.out /mes /mes.h /environment.i diff --git a/GNUmakefile b/GNUmakefile index bb38f22f..cc5cf4fc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -118,7 +118,7 @@ guile-paren: paren.test echo '___P((()))' | guile -s $^ mescc: all - echo ' EOF ' | cat base0.mes base0-$(CONDIF).mes base.mes quasiquote.mes let.mes scm.mes syntax-cond.mes lib/srfi/srfi-0.scm lib/record.mes lib/record.scm lib/srfi/srfi-9.scm lib/lalr.mes lib/lalr.scm c-lexer.scm mescc.scm - main.c | ./mes + echo ' EOF ' | cat base0.mes base0-$(CONDIF).mes base.mes quasiquote.mes let.mes scm.mes syntax-cond.mes lib/srfi/srfi-0.scm lib/record.mes lib/record.scm lib/srfi/srfi-9.scm lib/lalr.mes lib/lalr.scm c-lexer.scm mescc.scm - main.c | ./mes > a.out mescc.test: lib/lalr.scm c-lexer.scm mescc.scm cat $^ > $@ diff --git a/elf.mes b/elf.mes new file mode 100644 index 00000000..494469c0 --- /dev/null +++ b/elf.mes @@ -0,0 +1,12 @@ +;;; -*-scheme-*- + +(write-char #x7f) +(write-char #x45) +(write-char #x4c) +(write-char #x46) +(write-char #x08) +(write-char #x48) +(write-char #x65) +(write-char #x6c) +(write-char #x6c) +(write-char #x6f) diff --git a/mescc.scm b/mescc.scm index 49fc89a9..065be6a7 100644 --- a/mescc.scm +++ b/mescc.scm @@ -405,6 +405,12 @@ (lambda () (c-parser (c-lexer errorp) errorp)))) -(display "program: ") -(display (mescc)) +(display "program: " 2) +(display (mescc) 2) +(newline 2) + +(define elf-header '(#x7f #E #L #F #x01)) + +(define elf-header '(#x7f #x45 #x4c #x46 #x01)) +(map write-char elf-header) (newline)