From b0c6943121f186c79d2152694d209f82904ff1e1 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 30 Sep 2021 17:03:17 +0200 Subject: cc: rearanged for a pseudo-main --- miniany/README.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'miniany/README.html') diff --git a/miniany/README.html b/miniany/README.html index 40c9c49..9b7fcbf 100644 --- a/miniany/README.html +++ b/miniany/README.html @@ -38,7 +38,7 @@

Compiled in either hosted (host libc) or freestanding (our own libc, currently IA-32 Linux kernel only syscalls):

./build.sh cc hostcc hosted d
 ./build.sh cc hostcc freestanding d
-./cc \< test1.c \> test1.asm
+./cc < test1.c > test1.asm
 

Create a plain binary from the assembly code:

fasm test1.asm test1.bin
@@ -54,12 +54,12 @@
 

Here again you can choose the host compiler for compiling C4.

Then we have to create the standard input for C4 using:

-
echo -n -e "\034" \> EOF
+
echo -n -e "\034" > EOF
 cat cc.c EOF hello.c | ./c4
 cat c4.c EOF cc.c EOF hello.c | ./c4
 cat c4.c4 EOF c4.c EOF cc.c EOF hello.c | ./c4
 
-

EOF contains the traditional FS (file separator) character in the ASCII character set. Every time c4/c4.c is invoked it reads exacly one input file up to the first FS character (or stops at the end of stdin).

+

EOF contains the traditional FS (file separator) character in the ASCII character set. Every time c4 is invoked it reads exacly one input file up to the first FS character (or stops at the end of stdin).

We can also use -s, or -d on every level as follows:

cat cc.c EOF hello.c | ./c4 -d
 
@@ -89,3 +89,8 @@ cat c4.c4 EOF c4.c EOF cc.c EOF hello.c | ./c4
  • https://github.com/felipensp/assembly/blob/master/x86/itoa.s, for putint (early debugging keyword)
  • https://baptiste-wicht.com/posts/2011/11/print-strings-integers-intel-assembly.htm (earldy debugging keyword)
  • +

    Documentation:

    + -- cgit v1.2.3-54-g00ecf