Fix mes-libc crt1 to allow commands with greater than 255 arguments to run
Also reverse order of tcc-patched and mes-libc-patched stages.
This commit is contained in:
parent
9961c4b75f
commit
b929dc84b4
12
README.md
12
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
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
Loading…
Reference in New Issue