diff --git a/README.md b/README.md index a98136e..6085993 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,12 @@ is required later for autotools. more complex edits, including just changes to lines. Luckily, we are able to patch patch using sed only. -#### Part 13: patched tinycc +#### Part 13: patched mes-libc + +Since patch is available at this point, we can apply additional fixes to +mes-libc that are not included in the wip-m2 branch and recompile libc. + +#### Part 14: patched tinycc In Guix, tinycc is patched to force static linking. Prior to this step, we have been forced to manually specify static linking for each tool. Now that we have @@ -217,11 +222,6 @@ patch, we can patch tinycc to force static linking and then recompile it. Note that we have to do this using tinycc 0.9.26, as tinycc 0.9.27 cannot recompile itself for unknown reasons. -#### Part 14: patched mes-libc - -Since patch is available at this point, we can apply additional fixes to -mes-libc that are not included in the wip-m2 branch and recompile libc. - #### Part 15: make 3.80 GNU `make` is now built so we have a more robust building system. `make` allows diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run index 29d646e..f2a0ab1 100755 --- a/sysa/after.kaem.run +++ b/sysa/after.kaem.run @@ -101,16 +101,16 @@ cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 13: tcc-patched -cd tcc-0.9.27 -kaem --file tcc-patched.kaem -cd .. - -# Part 14: mes-libc-patched +# Part 13: mes-libc-patched cd tcc-0.9.27 kaem --file mes-libc-patched.kaem cd .. +# Part 14: tcc-patched +cd tcc-0.9.27 +kaem --file tcc-patched.kaem +cd .. + # Part 15: make pkg="make-3.80" cd ${pkg} diff --git a/sysa/tcc-0.9.27/mes-libc-patched.kaem b/sysa/tcc-0.9.27/mes-libc-patched.kaem index 39da1ab..1944b66 100755 --- a/sysa/tcc-0.9.27/mes-libc-patched.kaem +++ b/sysa/tcc-0.9.27/mes-libc-patched.kaem @@ -6,6 +6,7 @@ cd src/mes-libc # Patch patch -Np0 -i ../../patches/mes-libc-qsort.patch +patch -Np0 -i ../../patches/mes-libc-crt1.patch # Recompile libc cd ../tcc-0.9.27 diff --git a/sysa/tcc-0.9.27/patches/mes-libc-crt1.patch b/sysa/tcc-0.9.27/patches/mes-libc-crt1.patch new file mode 100644 index 0000000..fd1b954 --- /dev/null +++ b/sysa/tcc-0.9.27/patches/mes-libc-crt1.patch @@ -0,0 +1,23 @@ +Fix issue in mes-libc crt where argc was getting truncated to lower byte and +prevented programs with more than 255 arguments from working correctly. + +--- lib/linux/x86-mes-gcc/crt1.c ++++ lib/linux/x86-mes-gcc/crt1.c +@@ -48,7 +48,7 @@ _start () + asm ( + "mov %%ebp,%%eax\n\t" + "add $4,%%eax\n\t" +- "movzbl (%%eax),%%eax\n\t" ++ "mov (%%eax),%%eax\n\t" + "add $3,%%eax\n\t" + "shl $2,%%eax\n\t" + "add %%ebp,%%eax\n\t" +@@ -64,7 +64,7 @@ _start () + + "mov %ebp,%eax\n\t" + "add $4,%eax\n\t" +- "movzbl (%eax),%eax\n\t" ++ "mov (%eax),%eax\n\t" + "push %eax\n\t" + + "call main\n\t"