build: switch to Mes+MesCC.
This commit is contained in:
parent
2c8917e8cf
commit
28747bb84f
16
build-gcc.sh
16
build-gcc.sh
|
@ -2,6 +2,8 @@
|
|||
set -ex
|
||||
rm -f tcc
|
||||
|
||||
export MES_PREFIX=${MES_PREFIX-../mes}
|
||||
|
||||
touch config.mak
|
||||
make clean
|
||||
crt1=$(gcc --print-file-name=crt1.o)
|
||||
|
@ -11,8 +13,9 @@ crtdir=$(dirname $crt1)
|
|||
make ETAGS
|
||||
make
|
||||
|
||||
t=tccelf
|
||||
interpreter=$(guix environment --ad-hoc patchelf -- patchelf --print-interpreter $(type -p gcc))
|
||||
gcc -o tcc tcc.c\
|
||||
gcc -c -o $t.o $t.c\
|
||||
--include=$MES_PREFIX/lib/libc-gcc.c\
|
||||
-DPOSIX=1\
|
||||
-I.\
|
||||
|
@ -23,4 +26,15 @@ gcc -o tcc tcc.c\
|
|||
-D CONFIG_TCC_ELFINTERP="\"$interpreter\""\
|
||||
-D TCC_TARGET_X86_64=1\
|
||||
-D ONE_SOURCE=yes\
|
||||
|
||||
gcc -c -o $t $t.o\
|
||||
-DPOSIX=1\
|
||||
-I.\
|
||||
-I $MES_PREFIX/include\
|
||||
-I $MES_PREFIX/lib\
|
||||
-D CONFIG_TCCDIR="\"$PWD\""\
|
||||
-D CONFIG_TCC_CRTPREFIX="\"$crtdir\""\
|
||||
-D CONFIG_TCC_ELFINTERP="\"$interpreter\""\
|
||||
-D TCC_TARGET_X86_64=1\
|
||||
-D ONE_SOURCE=yes\
|
||||
-ldl
|
||||
|
|
54
build.sh
54
build.sh
|
@ -1,13 +1,13 @@
|
|||
#! /bin/sh
|
||||
set -ex
|
||||
rm -f tcc.E tcc.hex2 tcc.M1 tcc.m1 mes-tcc
|
||||
#rm -f tcc.E tcc.hex2 tcc.M1 tcc.m1 mes-tcc
|
||||
|
||||
CC=${MESCC-mescc}
|
||||
MES=${MES-../mes/src/mes}
|
||||
MESCC=${MESCC-mescc}
|
||||
HEX2=${HEX2-hex2}
|
||||
M1=${M1-M1}
|
||||
BLOOD_ELF=${BLOOD_ELF-blood-elf}
|
||||
CFLAGS=${CFLAGS-}
|
||||
|
||||
MES_PREFIX=${MES_PREFIX-$(dirname $MESCC)/../share/mes}
|
||||
MES_SEED=${MES_SEED-../mes-seed}
|
||||
|
@ -26,37 +26,45 @@ mkdir -p $PREFIX/lib
|
|||
ABSPREFIX=$(cd $PREFIX && pwd)
|
||||
cp $TINYCC_SEED/libc+tcc-gcc.mlibc-o $ABSPREFIX/lib
|
||||
|
||||
sh $MESCC -E -o tcc.E\
|
||||
$CFLAGS\
|
||||
-I .\
|
||||
-I $MES_PREFIX/lib\
|
||||
-I $MES_PREFIX/include\
|
||||
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
||||
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
||||
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
||||
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
||||
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
||||
-D CONFIG_USE_LIBGCC=1\
|
||||
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc+tcc-gcc.mlibc-o"'\
|
||||
-D CONFIG_TCC_STATIC=1\
|
||||
-D ONE_SOURCE=yes\
|
||||
-D TCC_TARGET_I386=1\
|
||||
-D BOOTSTRAP=1\
|
||||
tcc.c
|
||||
|
||||
sh $MESCC -c -o tcc.M1 tcc.E
|
||||
tr -d '\r' < tcc.M1 > tcc.m1
|
||||
if [ -n "$ONE_SOURCE" ]; then
|
||||
sh cc.sh tcc
|
||||
files="-f tcc.m1"
|
||||
else
|
||||
sh cc.sh tccpp
|
||||
sh cc.sh tccgen
|
||||
sh cc.sh tccelf
|
||||
sh cc.sh tccrun
|
||||
sh cc.sh i386-gen
|
||||
sh cc.sh i386-link
|
||||
sh cc.sh i386-asm
|
||||
sh cc.sh tccasm
|
||||
sh cc.sh libtcc
|
||||
sh cc.sh tcc
|
||||
files="
|
||||
-f tccpp.m1
|
||||
-f tccgen.m1
|
||||
-f tccelf.m1
|
||||
-f tccrun.m1
|
||||
-f i386-gen.m1
|
||||
-f i386-link.m1
|
||||
-f i386-asm.m1
|
||||
-f tccasm.m1
|
||||
-f libtcc.m1
|
||||
-f tcc.m1
|
||||
"
|
||||
fi
|
||||
|
||||
$M1 --LittleEndian --Architecture=1\
|
||||
-f $MES_PREFIX/stage0/x86.M1\
|
||||
-f $MES_SEED/libc+tcc-mes.M1\
|
||||
-f tcc.m1\
|
||||
$files\
|
||||
-o tcc.hex2
|
||||
|
||||
$BLOOD_ELF\
|
||||
-f $MES_PREFIX/stage0/x86.M1\
|
||||
-f $MES_SEED/libc+tcc-mes.M1\
|
||||
-f tcc.m1\
|
||||
$files\
|
||||
-o tcc-blood-elf-footer.M1
|
||||
|
||||
$M1 --LittleEndian --Architecture=1\
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#! /bin/sh
|
||||
set -ex
|
||||
|
||||
t=$1
|
||||
|
||||
rm -f $t.E $t.M1 $t.m1
|
||||
|
||||
CC=${MESCC-mescc}
|
||||
MES=${MES-../mes/src/mes}
|
||||
MESCC=${MESCC-mescc}
|
||||
CFLAGS=${CFLAGS-}
|
||||
MES_PREFIX=${MES_PREFIX-$(dirname $MESCC)/../share/mes}
|
||||
|
||||
if [ -z "$interpreter" ] && guix --help; then
|
||||
interpreter=$(guix environment --ad-hoc patchelf -- patchelf --print-interpreter $(guix build --system=i686-linux hello)/bin/hello)
|
||||
elif [ -x /lib/ld-linux.so.2 ]; then
|
||||
# legacy non-GuixSD support
|
||||
interpreter=/lib/ld-linux.so.2
|
||||
fi
|
||||
|
||||
ulimit -s 17030
|
||||
|
||||
if [ -n "$ONE_SOURCE" ]; then
|
||||
CFLAGS="$CFLAGS -D ONE_SOURCE=$ONE_SOURCE"
|
||||
fi
|
||||
|
||||
if [ -n "$PREPROCESS" ]; then
|
||||
time sh $MESCC -E -o $t.E\
|
||||
$CFLAGS\
|
||||
-I .\
|
||||
-I $MES_PREFIX/lib\
|
||||
-I $MES_PREFIX/include\
|
||||
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
||||
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
||||
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
||||
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
||||
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
||||
-D CONFIG_USE_LIBGCC=1\
|
||||
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc+tcc-gcc.mlibc-o"'\
|
||||
-D CONFIG_TCC_STATIC=1\
|
||||
-D TCC_TARGET_I386=1\
|
||||
-D BOOTSTRAP=1\
|
||||
$t.c
|
||||
time sh $MESCC -c -o $t.M1 $t.E
|
||||
else
|
||||
time sh $MESCC -c -o $t.M1\
|
||||
$CFLAGS\
|
||||
-I .\
|
||||
-I $MES_PREFIX/lib\
|
||||
-I $MES_PREFIX/include\
|
||||
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
||||
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
||||
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
||||
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
||||
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
||||
-D CONFIG_USE_LIBGCC=1\
|
||||
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc+tcc-gcc.mlibc-o"'\
|
||||
-D CONFIG_TCC_STATIC=1\
|
||||
-D TCC_TARGET_I386=1\
|
||||
-D BOOTSTRAP=1\
|
||||
$t.c
|
||||
fi
|
||||
|
||||
tr -d '\r' < $t.M1 > $t.m1
|
13
doit
13
doit
|
@ -5,7 +5,18 @@ export PREFIX=usr
|
|||
export HEX2=../mescc-tools/bin/hex2
|
||||
export M1=../mescc-tools/bin/M1
|
||||
export BLOOD_ELF=../mescc-tools/bin/blood-elf
|
||||
export MESCC=../mes/guile/mescc.scm
|
||||
export MES=${MES-../mes/src/mes}
|
||||
#MES=guile
|
||||
#export MES=${MES-../mes/src/mes.gcc}
|
||||
#export MES=${MES-../mes/src/mes.mlibc-gcc}
|
||||
export PREPROCESS=1
|
||||
export ONE_SOURCE=1
|
||||
export MESCC=${MESCC-../mes/scripts/mescc}
|
||||
|
||||
#GUILE_LOAD_PATH=/home/janneke/src/nyacc/module:$GUILE_LOAD_PATH
|
||||
export GUILE_LOAD_PATH=nyacc
|
||||
|
||||
export MES_DEBUG=2
|
||||
export MES_PREFIX=../mes
|
||||
export TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
|
||||
|
||||
|
|
2
link.sh
2
link.sh
|
@ -7,7 +7,7 @@ rm -f 1.a 2.a
|
|||
./tcc ../mes/scaffold/main.c
|
||||
./i686-unknown-linux-gnu-tcc -static -o a.i686-unknown-linux-gnu-out -I $MES_PREFIX/include $TINYCC_SEED/crt1.mlibc-o $MES_PREFIX/scaffold/main.c 2> 1.a
|
||||
set +e
|
||||
./mes-tcc -static -o a.mes-out -I $MES_PREFIX/include $TINYCC_SEED/crt1.mlibc-o $MES_PREFIX/scaffold/main.c 2> 2.a
|
||||
./mes-tcc -static -o a.mes-out -I $MES_PREFIX/include -L $TINYCC_SEED $TINYCC_SEED/crt1.mlibc-o $MES_PREFIX/scaffold/main.c 2> 2.a
|
||||
readelf -a a.i686-unknown-linux-gnu-out > 1.r
|
||||
readelf -a a.mes-out > 2.r
|
||||
diff -y 1.a 2.a
|
||||
|
|
23
test.sh
23
test.sh
|
@ -15,24 +15,28 @@ mkdir -p scaffold/tests
|
|||
|
||||
if [ -x ./i686-unknown-linux-gnu-tcc ]; then
|
||||
./i686-unknown-linux-gnu-tcc\
|
||||
-g\
|
||||
-m32\
|
||||
-c\
|
||||
-o scaffold/tests/"$t".i686-unknown-linux-gnu-o\
|
||||
-o scaffold/tests/"$t".mlibc-o\
|
||||
-I $MES_PREFIX/include\
|
||||
-I $MES_PREFIX/scaffold/tests\
|
||||
$MES_PREFIX/scaffold/tests/"$t".c &> 1
|
||||
$OBJDUMP -d scaffold/tests/"$t".i686-unknown-linux-gnu-o > 1.s
|
||||
|
||||
$MES_PREFIX/scaffold/tests/"$t".c #&> 1
|
||||
#$OBJDUMP -d scaffold/tests/"$t".mlibc-o > 1.s
|
||||
./i686-unknown-linux-gnu-tcc\
|
||||
-static\
|
||||
-o scaffold/tests/"$t".i686-unknown-linux-gnu-out\
|
||||
-g\
|
||||
-m32\
|
||||
-I src\
|
||||
-I lib\
|
||||
-I include\
|
||||
-o scaffold/tests/"$t".mlibc-out\
|
||||
-I $MES_PREFIX/include\
|
||||
-I $MES_PREFIX/scaffold/tests\
|
||||
$MES_PREFIX/scaffold/tests/"$t".c &> 1.elf
|
||||
$MES_PREFIX/scaffold/tests/"$t".c
|
||||
|
||||
set +e
|
||||
scaffold/tests/"$t".i686-unknown-linux-gnu-out
|
||||
scaffold/tests/"$t".mlibc-out
|
||||
r=$?
|
||||
#$OBJDUMP -d scaffold/tests/"$t".i686-unknown-linux-gnu-out > 1.x
|
||||
set -e
|
||||
else
|
||||
r=0
|
||||
|
@ -50,6 +54,7 @@ $OBJDUMP -d scaffold/tests/"$t".mes-o > 2.s
|
|||
-o scaffold/tests/"$t".mes-out\
|
||||
-I $MES_PREFIX/include\
|
||||
-I $MES_PREFIX/scaffold/tests\
|
||||
-L $TINYCC_SEED\
|
||||
$MES_PREFIX/scaffold/tests/"$t".c &> 2.elf
|
||||
set +e
|
||||
scaffold/tests/"$t".mes-out
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#! /usr/bin/perl -w
|
||||
#! /usr/bin/env perl
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
|
|
Loading…
Reference in New Issue