-
Notifications
You must be signed in to change notification settings - Fork 9
/
selfcompile_compiler
executable file
·28 lines (14 loc) · 1.49 KB
/
selfcompile_compiler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
# Use the self-hosting compiler to compile the compiler written in L2 and replace the self-hosting and test compilers with the result
set -e
cd ./src
echo "* Compiling the syscall wrapper and cast function ..."
gcc --static -g -c -o ../bin/x86_64.o x86_64.s
ulimit -s unlimited
echo "* Compiling L2 source code into object files ..."
../bin/l2compile core-meta.l2 text-meta.l2 flow-meta.l2 elf-meta.l2 x86-64-linux-interface.l2 lexer.l2 x86-64-object.l2 expressions.l2 x86-64-assembler.l2 analysis.l2 x86-64-generator.l2 compile.l2 list.l2 64-numbers.l2 hash-table.l2 x86-64-arithmetic-intrinsics.l2 - arithmetic - ../bin/x86_64.o
echo "* Linking the produced object files together and replacing l2compile ..."
gold --script ../l2.ld --entry 0x400000 --gc-sections arithmetic.o x86-64-linux-interface.l2.o elf-meta.l2.o lexer.l2.o x86-64-object.l2.o expressions.l2.o x86-64-assembler.l2.o analysis.l2.o x86-64-generator.l2.o x86-64-arithmetic-intrinsics.l2.o list.l2.o 64-numbers.l2.o hash-table.l2.o text-meta.l2.o compile.l2.o flow-meta.l2.o ../bin/x86_64.o -o ../bin/l2compile
cp ../bin/l2compile ../bin/l2compilet
echo "* Removing the intermediate files ..."
rm "arithmetic.o" "x86-64-linux-interface.l2.o" "lexer.l2.o" "x86-64-object.l2.o" "expressions.l2.o" "x86-64-assembler.l2.o" "analysis.l2.o" "x86-64-generator.l2.o" "x86-64-arithmetic-intrinsics.l2.o" "compile.l2.o" "list.l2.o" "64-numbers.l2.o" "elf-meta.l2.o" "flow-meta.l2.o" "text-meta.l2.o" "core-meta.l2.o" "hash-table.l2.o"