mescc/elf.mes: write minimal ELF header.

This commit is contained in:
Jan Nieuwenhuizen 2016-08-12 14:17:55 +02:00
parent 2097e9e4ef
commit 0829c5762c
4 changed files with 22 additions and 3 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
*.go
*.o
*~
/a.out
/mes
/mes.h
/environment.i

View file

@ -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 $^ > $@

12
elf.mes Normal file
View file

@ -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)

View file

@ -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)