Add new step mes-libc-patched

This commit is contained in:
Paul Dersey 2021-01-29 11:43:10 -05:00
parent 85ead5582e
commit 7c90d5bf4c
3 changed files with 55 additions and 7 deletions

View File

@ -106,43 +106,48 @@ cd tcc-0.9.27
kaem --file tcc-patched.kaem
cd ..
# Part 13: make
# Part 13: mes-libc-patched
cd tcc-0.9.27
kaem --file mes-libc-patched.kaem
cd ..
# Part 14: make
pkg="make-3.80"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 14: bzip2
# Part 15: bzip2
pkg="bzip2-1.0.8"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 15: coreutils
# Part 16: coreutils
pkg="coreutils-5.0"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 16: grep
# Part 17: grep
pkg="grep-2.4"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 16: heirloom-devtools
# Part 18: heirloom-devtools
pkg="heirloom-devtools-070527"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 17: bash
# Part 19: bash
pkg="bash-2.05b"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 18: m4
# Part 20: m4
pkg="m4-1.4"
cd ${pkg}
kaem --file ${pkg}.kaem

View File

@ -0,0 +1,14 @@
#!/bin/sh
set -ex
cd src/mes-libc
# Patch
patch -Np0 -i ../../patches/mes-libc-qsort.patch
# Recompile libc
cd ../tcc-0.9.27
kaem --file ../../compile-libc.kaem
cd ../..

View File

@ -0,0 +1,29 @@
--- lib/stdlib/qsort.c
+++ lib/stdlib/qsort.c
@@ -1,6 +1,7 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+ * Copyright © 2021 Paul Dersey <pdersey@gmail.com>
*
* This file is part of GNU Mes.
*
@@ -24,10 +25,14 @@
void
qswap (void *a, void *b, size_t size)
{
- char *buf[8];
- memcpy (buf, a, size);
- memcpy (a, b, size);
- memcpy (b, buf, size);
+ char *pa = a;
+ char *pb = b;
+ do
+ {
+ char tmp = *pa;
+ *pa++ = *pb;
+ *pb++ = tmp;
+ } while (--size > 0);
}
size_t