commit: d62ed4c55a4d2fa44cb2474970973457f04bb946
parent 1e822361a9c5233e8c6eb466d945d8001698bebc
Author: fosslinux <fosslinux@aussies.space>
Date: Thu, 14 Jan 2021 21:45:36 +1100
Add patched tcc
Forces static link.
Diffstat:
4 files changed, 62 insertions(+), 3 deletions(-)
diff --git a/rootfs.sh b/rootfs.sh
@@ -36,9 +36,13 @@ ln -s . tmp/after/lib/x86-mes
ln -s . tmp/after/lib/linux/x86-mes
mkdir -p tmp/after/include/{mes,gnu,linux,sys,mach}
mkdir -p tmp/after/include/linux/{x86,x86_64}
+mkdir -p tmp/tmp
cp after.kaem tmp/
cp after.kaem.run tmp/after/kaem.run
+# Copy in all of the patches
+cp -r patches tmp/after/
+
# mescc-tools-extra
cp -r mescc-tools-extra tmp/after/
@@ -74,8 +78,11 @@ popd
mkdir -p ../sources
# sed 4.0.7
-cp sed-4.0.7.kaem tmp/after
-cp -r sed-4.0.7 tmp/after
+cp sed-4.0.7.kaem tmp/after/
+cp -r sed-4.0.7 tmp/after/
+
+# tcc patched
+cp tcc-patched.kaem tmp/after/
# tar 1.12
url=https://ftp.gnu.org/gnu/tar/tar-1.12.tar.gz
@@ -111,6 +118,9 @@ get_file https://ftp.gnu.org/gnu/diffutils/diffutils-2.7.tar.gz
# patch 2.5.9
get_file https://ftp.gnu.org/pub/gnu/patch/patch-2.5.9.tar.gz
+# patched tcc
+cp tcc-patched.kaem tmp/after/
+
# General cleanup
find tmp -name .git -exec rm -rf \;
diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run
@@ -71,9 +71,14 @@ cd diffutils-2.7
kaem --file ../diffutils-2.7.kaem
cd ..
-# Part 12: patch
+# Part 11: patch
/after/bin/gunzip patch-2.5.9.tar.gz
/after/bin/tar xf patch-2.5.9.tar
cd patch-2.5.9
kaem --file ../patch-2.5.9.kaem
cd ..
+
+# Part 12: tcc-patched
+cd tcc-0.9.27
+kaem --file ../tcc-patched.kaem
+cd ..
diff --git a/sysa/patches/tcc/static-link.patch b/sysa/patches/tcc/static-link.patch
@@ -0,0 +1,10 @@
+--- libtcc.c 2021-01-14 08:25:30.774995301 +1100
++++ libtcc.c 2021-01-14 08:26:37.594417450 +1100
+@@ -734,6 +734,7 @@
+ ++nb_states;
+
+ s->alacarte_link = 1;
++ s->static_link = 1;
+ s->nocommon = 1;
+ s->warn_implicit_function_declaration = 1;
+ s->ms_extensions = 1;
diff --git a/sysa/tcc-patched.kaem b/sysa/tcc-patched.kaem
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -ex
+
+# Vars
+prefix=/after
+libdir=${prefix}/lib
+bindir=${prefix}/bin
+
+# Patch
+patch -Np0 -i ../patches/tcc/static-link.patch
+
+# Compile
+## We have to use 0.9.26 to recompile 0.9.27, 0.9.27 is not self-hosting for
+## whatever reason.
+boot5-tcc \
+ -v \
+ -static \
+ -o ${bindir}/tcc \
+ -D TCC_TARGET_I386=1 \
+ -D CONFIG_TCCDIR=\"${libdir}/tcc\" \
+ -D CONFIG_TCC_CRTPREFIX=\"${libdir}\" \
+ -D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
+ -D CONFIG_TCC_LIBPATHS=\"${libdir}:${libdir}/tcc\" \
+ -D CONFIG_TCC_SYSINCLUDEPATHS=\"${prefix}/include\" \
+ -D TCC_LIBGCC=\"${libdir}/libc.a\" \
+ -D CONFIG_TCC_STATIC=1 \
+ -D CONFIG_USE_LIBGCC=1 \
+ -D TCC_VERSION=\"0.9.27\" \
+ -D ONE_SOURCE=1 \
+ tcc.c
+
+# Test
+tcc -version