From 4489941a8ff6ce49a9060f3f918790336e4b87e1 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 11 Oct 2018 19:16:04 +0200 Subject: [PATCH] build: Support building from bootstrap-mes. --- boot.sh | 6 +++--- bootstrap.sh | 2 +- build-x86.sh | 12 ++++++------ build.sh | 20 +++++++++----------- check.sh | 4 ++-- install.sh | 6 ++++-- link.sh | 6 +++--- test.sh | 6 +++--- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/boot.sh b/boot.sh index 1c984c9..c5c8960 100755 --- a/boot.sh +++ b/boot.sh @@ -23,8 +23,8 @@ GUIX=${GUIX-$(command -v guix||:)} MES_PREFIX=${MES_PREFIX-../mes} ##MES_PREFIX=${MES_PREFIX-$(dirname $MESCC)/../share/mes} C_INCLUDE_PATH=${C_INCLUDE_PATH-$MES_PREFIX/include} -TINYCC_SEED=${TINYCC_SEED-../tinycc-seed} -LIBRARY_PATH=${LIBRARY_PATH-..$TINYCC_SEED} +MES_SEED=${MES_SEED-../mes-seed} +LIBRARY_PATH=${LIBRARY_PATH-..$MES_SEED} if [ -z "$interpreter" -a -n "$GUIX" ]; then interpreter=$($GUIX environment --ad-hoc patchelf -- patchelf --print-interpreter $(guix build --system=i686-linux hello)/bin/hello) @@ -111,7 +111,7 @@ $TCC\ -D CONFIG_TCC_STATIC=1\ -D TCC_TARGET_I386=1\ -L .\ - -L $TINYCC_SEED\ + -L $MES_SEED\ tcc.c\ $LIBTCC1 diff --git a/bootstrap.sh b/bootstrap.sh index ac6e0e9..e78d39b 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -6,7 +6,7 @@ export HEX2=../mescc-tools/bin/hex2 export M1=../mescc-tools/bin/M1 export MESCC=../mes/guile/mescc.scm export MES_PREFIX=../mes -export TINYCC_SEED=../tinycc-seed +export MES_SEED=../mes-seed sh build.sh sh check.sh diff --git a/build-x86.sh b/build-x86.sh index 8b67c5b..9be98cc 100755 --- a/build-x86.sh +++ b/build-x86.sh @@ -11,10 +11,10 @@ PREFIX=${PREFIX-usr} GUIX=${GUIX-$(command -v guix||:)} MES_PREFIX=${MES_PREFIX-../mes} MES_PREFIX=${MES_PREFIX-${MESCC%/*}/../share/mes} -TINYCC_SEED=${TINYCC_SEED-../tinycc-seed} -cp $TINYCC_SEED/x86-mes-gcc/crt1.o crt1.o -cp $TINYCC_SEED/x86-mes-gcc/crti.o crti.o -cp $TINYCC_SEED/x86-mes-gcc/crtn.o crtn.o +MES_SEED=${MES_SEED-../mes-seed} +cp $MES_SEED/x86-mes-gcc/crt1.o crt1.o +cp $MES_SEED/x86-mes-gcc/crti.o crti.o +cp $MES_SEED/x86-mes-gcc/crtn.o crtn.o CC=${CC-i686-unknown-linux-gnu-gcc} CFLAGS=" @@ -38,8 +38,8 @@ export interpreter mkdir -p $PREFIX/lib ABSPREFIX=$(cd $PREFIX && pwd) -cp $TINYCC_SEED/x86-mes-gcc/libc+tcc.o $ABSPREFIX/lib -cp $TINYCC_SEED/x86-mes-gcc/libtcc1.o $ABSPREFIX/lib +cp $MES_SEED/x86-mes-gcc/libc+tcc.o $ABSPREFIX/lib +cp $MES_SEED/x86-mes-gcc/libtcc1.o $ABSPREFIX/lib $CC -g -o i686-unknown-linux-gnu-tcc\ $CFLAGS\ -I.\ diff --git a/build.sh b/build.sh index e15fc80..346a953 100755 --- a/build.sh +++ b/build.sh @@ -6,7 +6,7 @@ export BUILD_DEBUG export MES_DEBUG export MES_PREFIX export PREFIX -export TINYCC_SEED +export MES_SEED export interpreter if [ -n "$BUILD_DEBUG" ]; then @@ -29,10 +29,9 @@ BLOOD_ELF=${BLOOD_ELF-blood-elf} MES_PREFIX=${MES_PREFIX-${MESCC%/*}/../share/mes} #MES_PREFIX=${MES_PREFIX-../mes} MES_SEED=${MES_SEED-../mes-seed} -TINYCC_SEED=${TINYCC_SEED-../tinycc-seed} -cp $TINYCC_SEED/x86-mes-tcc/crt1.o crt1.o -cp $TINYCC_SEED/x86-mes-tcc/crti.o crti.o -cp $TINYCC_SEED/x86-mes-tcc/crtn.o crtn.o +cp $MES_SEED/x86-mes-gcc/crt1.o crt1.o +cp $MES_SEED/x86-mes-gcc/crti.o crti.o +cp $MES_SEED/x86-mes-gcc/crtn.o crtn.o if [ -z "$interpreter" -a -n "$GUIX" ]; then interpreter=$($GUIX environment --ad-hoc patchelf -- patchelf --print-interpreter $(guix build --system=i686-linux hello)/bin/hello) @@ -45,7 +44,7 @@ export interpreter mkdir -p $PREFIX/lib ABSPREFIX=$(cd $PREFIX && pwd) -cp $TINYCC_SEED/x86-mes-tcc/libc+tcc.o $ABSPREFIX/lib +cp $MES_SEED/x86-mes-gcc/libc+tcc.o $ABSPREFIX/lib if [ -n "$ONE_SOURCE" ]; then @@ -80,11 +79,10 @@ $MESCC\ $MESCCFLAGS\ -g\ -o mes-tcc\ - -L $TINYCC_SEED\ -L $MES_SEED\ -l c+tcc\ $files\ - $TINYCC_SEED/x86-mes/libc+tcc.o + $MES_SEED/x86-mes/libc+tcc.o rm -f libc.a if false; then @@ -93,12 +91,12 @@ if false; then ./mes-tcc -c -I $MES_PREFIX/include -I $MES_PREFIX/lib $MES_PREFIX/lib/libc+gnu.c ./mes-tcc -ar rc libc.a libc+gnu.o else - ##./mes-tcc -ar rc libc.a $TINYCC_SEED/x86-mes-tcc/libc+gnu.o - cp -f $TINYCC_SEED/x86-mes-gcc/libc+gnu.o . + ##./mes-tcc -ar rc libc.a $MES_SEED/x86-mes-gcc/libc+gnu.o + cp -f $MES_SEED/x86-mes-gcc/libc+gnu.o . ./mes-tcc -ar rc libc.a libc+gnu.o fi rm -f libtcc1.a -cp -f $TINYCC_SEED/x86-mes-gcc/libtcc1.o . +cp -f $MES_SEED/x86-mes-gcc/libtcc1.o . ./mes-tcc -ar rc libtcc1.a libtcc1.o sh boot.sh diff --git a/check.sh b/check.sh index 600c540..83e830c 100755 --- a/check.sh +++ b/check.sh @@ -304,11 +304,11 @@ mkdir -p scaffold/tinycc expect=$(echo $broken | wc -w) for t in $tests; do - if [ ! -f $MES_PREFIX/scaffold/tinycc/"$t.c" ]; then + if [ ! -f tests/tests2/"$t.c" ]; then echo ' [SKIP]' continue; fi - sh test.sh "$MES_PREFIX/scaffold/tinycc/$t" &> scaffold/tinycc/"$t".log + sh test.sh tests/tests2/"$t" &> tests/tests2/"$t".log r=$? total=$((total+1)) if [ $r = 0 ]; then diff --git a/install.sh b/install.sh index 577ec46..80f81d9 100755 --- a/install.sh +++ b/install.sh @@ -8,7 +8,7 @@ set -e PREFIX=${PREFIX-usr} MES_PREFIX=${MES_PREFIX-${MESCC%/*}} -TINYCC_SEED=${TINYCC_SEED-../tinycc-seed} +MES_SEED=${MES_SEED-../mes-seed} mkdir -p $PREFIX/bin cp tcc $PREFIX/bin @@ -23,4 +23,6 @@ mkdir -p $PREFIX/lib/tcc cp libc.a $PREFIX/lib cp libtcc1.a $PREFIX/lib/tcc -tar -C $TINYCC_SEED -cf- . | tar -C $PREFIX/lib -xf- +tar -C $MES_SEED -cf- . | tar -C $PREFIX/lib -xf- + +rm -f $PREFIX/lib/linux/x86_64-mes/crt1 diff --git a/link.sh b/link.sh index 4dac72f..efaf6a4 100755 --- a/link.sh +++ b/link.sh @@ -3,7 +3,7 @@ set -ex rm -f 1.a 2.a MES_PREFIX=${MES_PREFIX-../mes} -TINYCC_SEED=${TINYCC_SEED-../tinycc-seed} +MES_SEED=${MES_SEED-../mes-seed} # trivial bin ###./tcc ../mes/scaffold/main.c @@ -14,10 +14,10 @@ rm -f "$b".mes-gcc-out rm -f "$b".mes-out ./i686-unknown-linux-gnu-tcc\ - -static -g -o "$b".mes-gcc-out -I $MES_PREFIX/include -L $TINYCC_SEED "$c".c 2> "$b".mes-gcc-stderr + -static -g -o "$b".mes-gcc-out -I $MES_PREFIX/include -L $MES_SEED "$c".c 2> "$b".mes-gcc-stderr set +e ${MES_TCC-./mes-tcc}\ - -static -g -o "$b".mes-out -I $MES_PREFIX/include -L $TINYCC_SEED "$c".c 2> "$b".mes-stderr + -static -g -o "$b".mes-out -I $MES_PREFIX/include -L $MES_SEED "$c".c 2> "$b".mes-stderr objdump -d "$b".mes-gcc-out > "$b".mes-gcc-d objdump -d "$b".mes-out > "$b".mes-d #readelf -a a.i686-unknown-linux-gnu-out > 1.r diff --git a/test.sh b/test.sh index b165a21..34ccdf0 100755 --- a/test.sh +++ b/test.sh @@ -6,7 +6,7 @@ TCC=${TCC-./mes-tcc} MESCC=${MESCC-mescc} MES_PREFIX=${MES_PREFIX-../mes} MES_PREFIX=${MES_PREFIX-${MESCC%/*}} -TINYCC_SEED=${TINYCC_SEED-../tinycc-seed} +MES_SEED=${MES_SEED-../mes-seed} OBJDUMP=${OBJDUMP-objdump} DIFF=${DIFF-diff} @@ -36,7 +36,7 @@ if [ -x ./i686-unknown-linux-gnu-tcc ]; then -static\ -o "$b".mes-gcc-out\ -L .\ - -L $TINYCC_SEED\ + -L $MES_SEED\ "$b".mes-gcc-o &> 1.link set +e "$b".mes-gcc-out arg1 arg2 arg3 arg4 arg5 > "$b".mes-gcc-stdout @@ -69,7 +69,7 @@ $TCC\ -I $MES_PREFIX/include\ -I $MES_PREFIX/scaffold/tests\ -I $MES_PREFIX/scaffold/tinycc\ - -L $TINYCC_SEED\ + -L $MES_SEED\ "$t".c &> 2.link set +e "$b".mes-out arg1 arg2 arg3 arg4 arg5 > "$b".mes-stdout