commit: 7c90d5bf4c632f41b1b493ffe845857ae6fdfdcb
parent 85ead5582e248619db9357883d889a74f3e8dcf4
Author: Paul Dersey <pdersey@gmail.com>
Date: Fri, 29 Jan 2021 11:43:10 -0500
Add new step mes-libc-patched
Diffstat:
3 files changed, 55 insertions(+), 7 deletions(-)
diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run
@@ -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
diff --git a/sysa/tcc-0.9.27/mes-libc-patched.kaem b/sysa/tcc-0.9.27/mes-libc-patched.kaem
@@ -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 ../..
diff --git a/sysa/tcc-0.9.27/patches/mes-libc-qsort.patch b/sysa/tcc-0.9.27/patches/mes-libc-qsort.patch
@@ -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