From 7c90d5bf4c632f41b1b493ffe845857ae6fdfdcb Mon Sep 17 00:00:00 2001 From: Paul Dersey Date: Fri, 29 Jan 2021 11:43:10 -0500 Subject: [PATCH] Add new step mes-libc-patched --- sysa/after.kaem.run | 19 ++++++++----- sysa/tcc-0.9.27/mes-libc-patched.kaem | 14 ++++++++++ sysa/tcc-0.9.27/patches/mes-libc-qsort.patch | 29 ++++++++++++++++++++ 3 files changed, 55 insertions(+), 7 deletions(-) create mode 100755 sysa/tcc-0.9.27/mes-libc-patched.kaem create mode 100644 sysa/tcc-0.9.27/patches/mes-libc-qsort.patch diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run index 8390c23..4c2f701 100755 --- 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 new file mode 100755 index 0000000..39da1ab --- /dev/null +++ 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 new file mode 100644 index 0000000..5cf668d --- /dev/null +++ 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 ++ * Copyright © 2021 Paul Dersey + * + * 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