updates for 0.18
This commit is contained in:
parent
ff1caa8017
commit
18aa2fa286
36
boot.sh
36
boot.sh
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
set -x
|
set -ex
|
||||||
|
|
||||||
TCC=${TCC-./mes-tcc}
|
TCC=${TCC-./mes-tcc}
|
||||||
if [ "$TCC" = ./mes-tcc ]; then
|
if [ "$TCC" = ./mes-tcc ]; then
|
||||||
|
@ -15,7 +15,9 @@ elif [ "$TCC" = ./boot3-tcc ]; then
|
||||||
PROGRAM_PREFIX=${PROGRAM_PREFIX-boot4-}
|
PROGRAM_PREFIX=${PROGRAM_PREFIX-boot4-}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset C_INCLUDE_PATH LIBRARY_PATH
|
||||||
PREFIX=${PREFIX-usr}
|
PREFIX=${PREFIX-usr}
|
||||||
|
mkdir -p $PREFIX
|
||||||
ABSPREFIX=$(cd $PREFIX && pwd)
|
ABSPREFIX=$(cd $PREFIX && pwd)
|
||||||
GUIX=${GUIX-$(command -v guix||:)}
|
GUIX=${GUIX-$(command -v guix||:)}
|
||||||
MES_PREFIX=${MES_PREFIX-../mes}
|
MES_PREFIX=${MES_PREFIX-../mes}
|
||||||
|
@ -46,6 +48,7 @@ if [ "$PROGRAM_PREFIX" = "boot0-" ]; then
|
||||||
-D CONFIG_USE_LIBGCC=1
|
-D CONFIG_USE_LIBGCC=1
|
||||||
-D TCC_MES_LIBC=1
|
-D TCC_MES_LIBC=1
|
||||||
"}
|
"}
|
||||||
|
LIBTCC1=-ltcc1
|
||||||
elif [ "$PROGRAM_PREFIX" = "boot1-" ]; then
|
elif [ "$PROGRAM_PREFIX" = "boot1-" ]; then
|
||||||
BOOT_CPPFLAGS=${BOOT_CPPFLAGS-"
|
BOOT_CPPFLAGS=${BOOT_CPPFLAGS-"
|
||||||
-D BOOTSTRAP=1
|
-D BOOTSTRAP=1
|
||||||
|
@ -55,6 +58,7 @@ elif [ "$PROGRAM_PREFIX" = "boot1-" ]; then
|
||||||
-D CONFIG_USE_LIBGCC=1
|
-D CONFIG_USE_LIBGCC=1
|
||||||
-D TCC_MES_LIBC=1
|
-D TCC_MES_LIBC=1
|
||||||
"}
|
"}
|
||||||
|
LIBTCC1=-ltcc1
|
||||||
elif [ "$PROGRAM_PREFIX" = "boot2-" ]; then
|
elif [ "$PROGRAM_PREFIX" = "boot2-" ]; then
|
||||||
BOOT_CPPFLAGS=${BOOT_CPPFLAGS-"
|
BOOT_CPPFLAGS=${BOOT_CPPFLAGS-"
|
||||||
-D BOOTSTRAP=1
|
-D BOOTSTRAP=1
|
||||||
|
@ -65,6 +69,7 @@ elif [ "$PROGRAM_PREFIX" = "boot2-" ]; then
|
||||||
-D CONFIG_USE_LIBGCC=1
|
-D CONFIG_USE_LIBGCC=1
|
||||||
-D TCC_MES_LIBC=1
|
-D TCC_MES_LIBC=1
|
||||||
"}
|
"}
|
||||||
|
LIBTCC1=-ltcc1
|
||||||
elif [ "$PROGRAM_PREFIX" = "boot3-" ]; then
|
elif [ "$PROGRAM_PREFIX" = "boot3-" ]; then
|
||||||
BOOT_CPPFLAGS=${BOOT_CPPFLAGS-"
|
BOOT_CPPFLAGS=${BOOT_CPPFLAGS-"
|
||||||
-D BOOTSTRAP=1
|
-D BOOTSTRAP=1
|
||||||
|
@ -88,20 +93,39 @@ elif [ "$PROGRAM_PREFIX" = "boot4-" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$TCC\
|
$TCC\
|
||||||
|
-v\
|
||||||
-static\
|
-static\
|
||||||
-o ${PROGRAM_PREFIX}tcc\
|
-o ${PROGRAM_PREFIX}tcc\
|
||||||
$BOOT_CPPFLAGS\
|
$BOOT_CPPFLAGS\
|
||||||
|
-I .\
|
||||||
|
-I $MES_PREFIX/include\
|
||||||
-D TCC_TARGET_I386\
|
-D TCC_TARGET_I386\
|
||||||
-D ONE_SOURCE=yes\
|
|
||||||
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
||||||
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
||||||
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
||||||
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
||||||
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
||||||
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc+tcc-gcc.mlibc-o"'\
|
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc.a"'\
|
||||||
|
-D ONE_SOURCE=yes\
|
||||||
|
-D CONFIG_TCC_LIBTCC1=1\
|
||||||
-D CONFIG_TCC_STATIC=1\
|
-D CONFIG_TCC_STATIC=1\
|
||||||
-D TCC_TARGET_I386=1\
|
-D TCC_TARGET_I386=1\
|
||||||
-I .\
|
-L .\
|
||||||
-I $MES_PREFIX/include\
|
|
||||||
-L $TINYCC_SEED\
|
-L $TINYCC_SEED\
|
||||||
tcc.c
|
tcc.c\
|
||||||
|
$LIBTCC1
|
||||||
|
|
||||||
|
for i in 1 i n; do
|
||||||
|
rm -f crt$i.o;
|
||||||
|
./${PROGRAM_PREFIX}tcc -c $MES_PREFIX/lib/linux/x86-mes-gcc/crt$i.c
|
||||||
|
done
|
||||||
|
|
||||||
|
# rm -f libc.a
|
||||||
|
# ./${PROGRAM_PREFIX}tcc -c -I $MES_PREFIX/include -I $MES_PREFIX/lib $MES_PREFIX/lib/libc+gnu.c
|
||||||
|
# ./${PROGRAM_PREFIX}tcc -ar rc libc.a libc+gnu.o
|
||||||
|
|
||||||
|
rm -f libtcc1.a
|
||||||
|
./${PROGRAM_PREFIX}tcc -c -g -D TCC_TARGET_I386=1 -o libtcc1.o lib/libtcc1.c
|
||||||
|
./${PROGRAM_PREFIX}tcc -ar rc libtcc1.a libtcc1.o
|
||||||
|
mkdir -p $PREFIX/lib/tcc
|
||||||
|
cp -f libtcc1.a $PREFIX/lib/tcc
|
||||||
|
|
|
@ -7,8 +7,11 @@ MES_PREFIX=${MES_PREFIX-../mes}
|
||||||
|
|
||||||
touch config.mak
|
touch config.mak
|
||||||
make clean
|
make clean
|
||||||
|
rm -f crt*.o
|
||||||
crt1=$(gcc --print-file-name=crt1.o)
|
crt1=$(gcc --print-file-name=crt1.o)
|
||||||
crtdir=$(dirname $crt1)
|
#crtdir=$(dirname $crt1)
|
||||||
|
#crti=$(gcc --print-file-name=crti.o)
|
||||||
|
#crtn=$(gcc --print-file-name=crtn.o)
|
||||||
|
|
||||||
unset ONE_SOURCE
|
unset ONE_SOURCE
|
||||||
./configure --tccdir=$PWD --crtprefix=$crtdir --extra-cflags="-DHAVE_FLOAT=1 -DHAVE_BITFIELD=1"
|
./configure --tccdir=$PWD --crtprefix=$crtdir --extra-cflags="-DHAVE_FLOAT=1 -DHAVE_BITFIELD=1"
|
||||||
|
|
28
build-x86.sh
28
build-x86.sh
|
@ -5,20 +5,25 @@ rm -f i686-unknown-linux-gnu-tcc
|
||||||
# crt1=$(i686-unknown-linux-gnu-gcc --print-file-name=crt1.o)
|
# crt1=$(i686-unknown-linux-gnu-gcc --print-file-name=crt1.o)
|
||||||
# crtdir=$(dirname $crt1)
|
# crtdir=$(dirname $crt1)
|
||||||
|
|
||||||
|
unset C_INCLUDE_PATH LIBRARY_PATH
|
||||||
|
|
||||||
PREFIX=${PREFIX-usr}
|
PREFIX=${PREFIX-usr}
|
||||||
GUIX=${GUIX-$(command -v guix||:)}
|
GUIX=${GUIX-$(command -v guix||:)}
|
||||||
MES_PREFIX=${MES_PREFIX-../mes}
|
MES_PREFIX=${MES_PREFIX-../mes}
|
||||||
MES_PREFIX=${MES_PREFIX-${MESCC%/*}/../share/mes}
|
MES_PREFIX=${MES_PREFIX-${MESCC%/*}/../share/mes}
|
||||||
TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
|
TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
|
||||||
cp $TINYCC_SEED/crt1.mlibc-o crt1.o
|
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
|
||||||
|
|
||||||
CC=${CC-i686-unknown-linux-gnu-gcc}
|
CC=${CC-i686-unknown-linux-gnu-gcc}
|
||||||
CFLAGS="
|
CFLAGS="
|
||||||
-nostdinc
|
-nostdinc
|
||||||
-nostdlib
|
-nostdlib
|
||||||
-fno-builtin
|
-fno-builtin
|
||||||
--include=$MES_PREFIX/lib/crt1.c
|
--include=$MES_PREFIX/lib/linux/x86-mes-gcc/crt1.c
|
||||||
--include=$MES_PREFIX/lib/libc+tcc-gcc.c
|
--include=$MES_PREFIX/lib/libc+tcc.c
|
||||||
|
--include=$MES_PREFIX/lib/libtcc1.c
|
||||||
-Wl,-Ttext-segment=0x1000000
|
-Wl,-Ttext-segment=0x1000000
|
||||||
"
|
"
|
||||||
|
|
||||||
|
@ -33,24 +38,25 @@ export interpreter
|
||||||
|
|
||||||
mkdir -p $PREFIX/lib
|
mkdir -p $PREFIX/lib
|
||||||
ABSPREFIX=$(cd $PREFIX && pwd)
|
ABSPREFIX=$(cd $PREFIX && pwd)
|
||||||
cp $TINYCC_SEED/libc+tcc-gcc.mlibc-o $ABSPREFIX/lib
|
cp $TINYCC_SEED/x86-mes-gcc/libc+tcc.o $ABSPREFIX/lib
|
||||||
|
cp $TINYCC_SEED/x86-mes-gcc/libtcc1.o $ABSPREFIX/lib
|
||||||
$CC -g -o i686-unknown-linux-gnu-tcc\
|
$CC -g -o i686-unknown-linux-gnu-tcc\
|
||||||
$CFLAGS\
|
$CFLAGS\
|
||||||
-I.\
|
-I.\
|
||||||
-I $MES_PREFIX/lib\
|
-I $MES_PREFIX/lib\
|
||||||
-I $MES_PREFIX/include\
|
-I $MES_PREFIX/include\
|
||||||
-D CONFIG_TCCBOOT=1\
|
|
||||||
-D TCC_MES_LIBC=1\
|
|
||||||
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
||||||
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
||||||
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
||||||
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
||||||
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
||||||
-D CONFIG_USE_LIBGCC=1\
|
-D CONFIG_USE_LIBGCC=1\
|
||||||
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc+tcc-gcc.mlibc-o"'\
|
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc.a"'\
|
||||||
-D CONFIG_TCC_STATIC=1\
|
|
||||||
-D ONE_SOURCE=yes\
|
|
||||||
-D TCC_TARGET_I386=1\
|
|
||||||
-D BOOTSTRAP=1\
|
-D BOOTSTRAP=1\
|
||||||
-D TCCBOOT_VSTACK=1\
|
-D CONFIG_TCCBOOT=1\
|
||||||
|
-D CONFIG_TCC_STATIC=1\
|
||||||
|
-D CONFIG_USE_LIBGCC=1\
|
||||||
|
-D ONE_SOURCE=1\
|
||||||
|
-D TCC_MES_LIBC=1\
|
||||||
|
-D TCC_TARGET_I386=1\
|
||||||
tcc.c
|
tcc.c
|
||||||
|
|
100
build.sh
100
build.sh
|
@ -1,7 +1,22 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
set -ex
|
|
||||||
rm -f tcc.E tcc.hex2 tcc.M1 tcc.m1 mes-tcc
|
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export BUILD_DEBUG
|
||||||
|
export MES_DEBUG
|
||||||
|
export MES_PREFIX
|
||||||
|
export PREFIX
|
||||||
|
export TINYCC_SEED
|
||||||
|
export interpreter
|
||||||
|
|
||||||
|
if [ -n "$BUILD_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
MESCCFLAGS="$MESCCFLAGS -v"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f tcc.E tcc.hex2 tcc.M1 tcc.m1 mes-tcc boot?-tcc
|
||||||
|
|
||||||
|
unset C_INCLUDE_PATH LIBRARY_PATH
|
||||||
PREFIX=${PREFIX-usr}
|
PREFIX=${PREFIX-usr}
|
||||||
GUIX=${GUIX-$(command -v guix||:)}
|
GUIX=${GUIX-$(command -v guix||:)}
|
||||||
CC=${MESCC-mescc}
|
CC=${MESCC-mescc}
|
||||||
|
@ -12,10 +27,12 @@ M1=${M1-M1}
|
||||||
BLOOD_ELF=${BLOOD_ELF-blood-elf}
|
BLOOD_ELF=${BLOOD_ELF-blood-elf}
|
||||||
|
|
||||||
MES_PREFIX=${MES_PREFIX-${MESCC%/*}/../share/mes}
|
MES_PREFIX=${MES_PREFIX-${MESCC%/*}/../share/mes}
|
||||||
MES_PREFIX=${MES_PREFIX-../mes}
|
#MES_PREFIX=${MES_PREFIX-../mes}
|
||||||
MES_SEED=${MES_SEED-../mes-seed}
|
MES_SEED=${MES_SEED-../mes-seed}
|
||||||
TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
|
TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
|
||||||
cp $TINYCC_SEED/crt1.mlibc-o crt1.o
|
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
|
||||||
|
|
||||||
if [ -z "$interpreter" -a -n "$GUIX" ]; then
|
if [ -z "$interpreter" -a -n "$GUIX" ]; then
|
||||||
interpreter=$($GUIX environment --ad-hoc patchelf -- patchelf --print-interpreter $(guix build --system=i686-linux hello)/bin/hello)
|
interpreter=$($GUIX environment --ad-hoc patchelf -- patchelf --print-interpreter $(guix build --system=i686-linux hello)/bin/hello)
|
||||||
|
@ -28,12 +45,12 @@ export interpreter
|
||||||
|
|
||||||
mkdir -p $PREFIX/lib
|
mkdir -p $PREFIX/lib
|
||||||
ABSPREFIX=$(cd $PREFIX && pwd)
|
ABSPREFIX=$(cd $PREFIX && pwd)
|
||||||
cp $TINYCC_SEED/libc+tcc-gcc.mlibc-o $ABSPREFIX/lib
|
cp $TINYCC_SEED/x86-mes-tcc/libc+tcc.o $ABSPREFIX/lib
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$ONE_SOURCE" ]; then
|
if [ -n "$ONE_SOURCE" ]; then
|
||||||
sh cc.sh tcc
|
sh cc.sh tcc
|
||||||
files="-f tcc.m1"
|
files="tcc.S"
|
||||||
else
|
else
|
||||||
sh cc.sh tccpp
|
sh cc.sh tccpp
|
||||||
sh cc.sh tccgen
|
sh cc.sh tccgen
|
||||||
|
@ -46,39 +63,50 @@ else
|
||||||
sh cc.sh libtcc
|
sh cc.sh libtcc
|
||||||
sh cc.sh tcc
|
sh cc.sh tcc
|
||||||
files="
|
files="
|
||||||
-f tccpp.m1
|
tccpp.S
|
||||||
-f tccgen.m1
|
tccgen.S
|
||||||
-f tccelf.m1
|
tccelf.S
|
||||||
-f tccrun.m1
|
tccrun.S
|
||||||
-f i386-gen.m1
|
i386-gen.S
|
||||||
-f i386-link.m1
|
i386-link.S
|
||||||
-f i386-asm.m1
|
i386-asm.S
|
||||||
-f tccasm.m1
|
tccasm.S
|
||||||
-f libtcc.m1
|
libtcc.S
|
||||||
-f tcc.m1
|
tcc.S
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$M1 --LittleEndian --Architecture=1\
|
$MESCC\
|
||||||
-f $MES_PREFIX/stage0/x86.M1\
|
$MESCCFLAGS\
|
||||||
-f $MES_SEED/libc+tcc-mes.M1\
|
-g\
|
||||||
$files\
|
-o mes-tcc\
|
||||||
-o tcc.hex2
|
-L $TINYCC_SEED\
|
||||||
|
-L $MES_SEED\
|
||||||
$BLOOD_ELF\
|
-l c+tcc\
|
||||||
-f $MES_PREFIX/stage0/x86.M1\
|
|
||||||
-f $MES_SEED/libc+tcc-mes.M1\
|
|
||||||
$files\
|
$files\
|
||||||
-o tcc-blood-elf-footer.M1
|
$TINYCC_SEED/x86-mes/libc+tcc.o
|
||||||
|
|
||||||
$M1 --LittleEndian --Architecture=1\
|
exit 0
|
||||||
-f tcc-blood-elf-footer.M1\
|
|
||||||
-o tcc-blood-elf-footer.hex2
|
|
||||||
|
|
||||||
$HEX2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000\
|
rm -f libc.a
|
||||||
-f $MES_PREFIX/stage0/elf32-header.hex2\
|
if false; then
|
||||||
-f $MES_PREFIX/lib/crt1.hex2\
|
# ../mes/lib/linux-gcc.c:33: error: bad operand with opcode 'mov'
|
||||||
-f tcc.hex2\
|
# it works with bootx-tcc
|
||||||
-f tcc-blood-elf-footer.hex2\
|
./mes-tcc -c -I $MES_PREFIX/include -I $MES_PREFIX/lib $MES_PREFIX/lib/libc+gnu.c
|
||||||
--exec_enable\
|
./mes-tcc -ar rc libc.a libc+gnu.o
|
||||||
-o mes-tcc
|
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 libc+gnu.o
|
||||||
|
fi
|
||||||
|
rm -f libtcc1.a
|
||||||
|
cp -f $TINYCC_SEED/x86-mes-gcc/libtcc1.o .
|
||||||
|
./mes-tcc -ar rc libtcc1.a libtcc1.o
|
||||||
|
|
||||||
|
sh boot.sh
|
||||||
|
TCC=./boot0-tcc sh boot.sh
|
||||||
|
TCC=./boot1-tcc sh boot.sh
|
||||||
|
TCC=./boot2-tcc sh boot.sh
|
||||||
|
TCC=./boot3-tcc sh boot.sh
|
||||||
|
|
||||||
|
ln -f boot4-tcc tcc
|
||||||
|
|
43
cc.sh
43
cc.sh
|
@ -1,5 +1,10 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
set -ex
|
set -e
|
||||||
|
|
||||||
|
if [ -n "$BUILD_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
MESCCFLAGS="$MESCCFLAGS -v"
|
||||||
|
fi
|
||||||
|
|
||||||
t=$1
|
t=$1
|
||||||
|
|
||||||
|
@ -11,6 +16,7 @@ MES=${MES-../mes/src/mes}
|
||||||
MESCC=${MESCC-mescc}
|
MESCC=${MESCC-mescc}
|
||||||
CFLAGS=${CFLAGS-}
|
CFLAGS=${CFLAGS-}
|
||||||
MES_PREFIX=${MES_PREFIX-${MESCC%/*}}
|
MES_PREFIX=${MES_PREFIX-${MESCC%/*}}
|
||||||
|
ABSPREFIX=$(cd $PREFIX && pwd)
|
||||||
|
|
||||||
if [ -z "$interpreter" -a -n "$GUIX" ]; then
|
if [ -z "$interpreter" -a -n "$GUIX" ]; then
|
||||||
interpreter=$($GUIX environment --ad-hoc patchelf -- patchelf --print-interpreter $(guix build --system=i686-linux hello)/bin/hello)
|
interpreter=$($GUIX environment --ad-hoc patchelf -- patchelf --print-interpreter $(guix build --system=i686-linux hello)/bin/hello)
|
||||||
|
@ -26,50 +32,47 @@ if [ -n "$ONE_SOURCE" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$PREPROCESS" ]; then
|
if [ -n "$PREPROCESS" ]; then
|
||||||
time sh $MESCC -E -o $t.E\
|
time sh $MESCC $MESCCFLAGS -E -o $t.E\
|
||||||
$CFLAGS\
|
$CFLAGS\
|
||||||
-I .\
|
-I .\
|
||||||
-I $MES_PREFIX/lib\
|
-I $MES_PREFIX/lib\
|
||||||
-I $MES_PREFIX/include\
|
-I $MES_PREFIX/include\
|
||||||
-D inline=\
|
-D inline=\
|
||||||
-D CONFIG_TCCBOOT=1\
|
|
||||||
-D TCC_MES_LIBC=1\
|
|
||||||
-D TCC_MES_LIBC=1\
|
|
||||||
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
||||||
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
||||||
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
||||||
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
||||||
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
||||||
-D CONFIG_USE_LIBGCC=1\
|
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc.a"'\
|
||||||
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc+tcc-gcc.mlibc-o"'\
|
|
||||||
-D CONFIG_TCC_STATIC=1\
|
|
||||||
-D TCC_TARGET_I386=1\
|
|
||||||
-D BOOTSTRAP=1\
|
-D BOOTSTRAP=1\
|
||||||
-D TCCBOOT_VSTACK=1\
|
-D CONFIG_TCCBOOT=1\
|
||||||
|
-D CONFIG_TCC_STATIC=1\
|
||||||
|
-D CONFIG_USE_LIBGCC=1\
|
||||||
|
-D TCC_MES_LIBC=1\
|
||||||
|
-D TCC_TARGET_I386=1\
|
||||||
$t.c
|
$t.c
|
||||||
time sh $MESCC -c -o $t.M1 $t.E
|
time sh $MESCC $MESCCFLAGS -S -o $t.M1 $t.E
|
||||||
else
|
else
|
||||||
time sh $MESCC -c -o $t.M1\
|
time sh $MESCC $MESCCFLAGS -S -o $t.M1\
|
||||||
$CFLAGS\
|
$CFLAGS\
|
||||||
-I .\
|
-I .\
|
||||||
-I $MES_PREFIX/lib\
|
-I $MES_PREFIX/lib\
|
||||||
-I $MES_PREFIX/include\
|
-I $MES_PREFIX/include\
|
||||||
-D inline=\
|
-D inline=\
|
||||||
-D CONFIG_TCCBOOT=1\
|
|
||||||
-D TCC_MES_LIBC=1\
|
|
||||||
-D TCC_MES_LIBC=1\
|
|
||||||
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
-D 'CONFIG_TCCDIR="'$PREFIX'/lib/tcc"'\
|
||||||
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
-D 'CONFIG_TCC_CRTPREFIX="'$PREFIX'/lib:{B}/lib:."'\
|
||||||
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
-D 'CONFIG_TCC_ELFINTERP="'$interpreter'"'\
|
||||||
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
-D 'CONFIG_TCC_LIBPATHS="'$ABSPREFIX'/lib:{B}/lib:."'\
|
||||||
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
-D 'CONFIG_TCC_SYSINCLUDEPATHS="'$MES_PREFIX'/include:'$PREFIX'/include:{B}/include"'\
|
||||||
-D CONFIG_USE_LIBGCC=1\
|
-D CONFIG_USE_LIBGCC=1\
|
||||||
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc+tcc-gcc.mlibc-o"'\
|
-D 'TCC_LIBGCC="'$ABSPREFIX'/lib/libc.a"'\
|
||||||
-D CONFIG_TCC_STATIC=1\
|
|
||||||
-D TCC_TARGET_I386=1\
|
|
||||||
-D BOOTSTRAP=1\
|
-D BOOTSTRAP=1\
|
||||||
-D TCCBOOT_VSTACK=1\
|
-D CONFIG_TCCBOOT=1\
|
||||||
|
-D CONFIG_TCC_STATIC=1\
|
||||||
|
-D CONFIG_USE_LIBGCC=1\
|
||||||
|
-D TCC_MES_LIBC=1\
|
||||||
|
-D TCC_TARGET_I386=1\
|
||||||
$t.c
|
$t.c
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tr -d '\r' < $t.M1 > $t.m1
|
tr -d '\r' < $t.M1 > $t.S
|
||||||
|
|
31
check.sh
31
check.sh
|
@ -1,6 +1,12 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
MESCC=${MESCC-mescc}
|
###MESCC=${MESCC-mescc}
|
||||||
|
MES_ARENA=70000000
|
||||||
|
MES_MAX_ARENA=70000000
|
||||||
|
export MES_ARENA MES_MAX_ARENA
|
||||||
|
MES=guile
|
||||||
|
MESCC=${MESCC-../mes/pre-inst-env mescc}
|
||||||
|
|
||||||
MES_PREFIX=${MES_PREFIX-../mes}
|
MES_PREFIX=${MES_PREFIX-../mes}
|
||||||
MES_PREFIX=${MES_PREFIX-${MESCC%/*}}
|
MES_PREFIX=${MES_PREFIX-${MESCC%/*}}
|
||||||
|
|
||||||
|
@ -87,7 +93,10 @@ t
|
||||||
82-define
|
82-define
|
||||||
83-heterogenoous-init
|
83-heterogenoous-init
|
||||||
84-struct-field-list
|
84-struct-field-list
|
||||||
85-sizeof
|
86-strncpy
|
||||||
|
87-sscanf
|
||||||
|
90-strpbrk
|
||||||
|
91-fseek
|
||||||
"
|
"
|
||||||
|
|
||||||
broken="
|
broken="
|
||||||
|
@ -110,13 +119,6 @@ t
|
||||||
21-char[]
|
21-char[]
|
||||||
22-while-char[]
|
22-while-char[]
|
||||||
23-pointer
|
23-pointer
|
||||||
61-array
|
|
||||||
62-array
|
|
||||||
63-struct-cell
|
|
||||||
64-make-cell
|
|
||||||
76-pointer-arithmetic
|
|
||||||
7k-for-each-elem
|
|
||||||
7o-struct-pre-post
|
|
||||||
"
|
"
|
||||||
|
|
||||||
if [ ! -x ./i686-unknown-linux-gnu-tcc ]; then
|
if [ ! -x ./i686-unknown-linux-gnu-tcc ]; then
|
||||||
|
@ -197,7 +199,6 @@ tests="
|
||||||
43_void_param
|
43_void_param
|
||||||
44_scoped_declarations
|
44_scoped_declarations
|
||||||
45_empty_for
|
45_empty_for
|
||||||
46_grep
|
|
||||||
47_switch_return
|
47_switch_return
|
||||||
48_nested_break
|
48_nested_break
|
||||||
49_bracket_evaluation
|
49_bracket_evaluation
|
||||||
|
@ -213,28 +214,20 @@ broken="$broken
|
||||||
22_floating_point
|
22_floating_point
|
||||||
23_type_coercion
|
23_type_coercion
|
||||||
24_math_library
|
24_math_library
|
||||||
28_strings
|
|
||||||
31_args
|
|
||||||
34_array_assignment
|
34_array_assignment
|
||||||
37_sprintf
|
37_sprintf
|
||||||
40_stdio
|
40_stdio
|
||||||
46_grep
|
|
||||||
49_bracket_evaluation
|
49_bracket_evaluation
|
||||||
|
55_lshift_type
|
||||||
"
|
"
|
||||||
|
|
||||||
#22_floating_point ; float
|
#22_floating_point ; float
|
||||||
#23_type_coercion ; float
|
#23_type_coercion ; float
|
||||||
#24_math_library ; float
|
#24_math_library ; float
|
||||||
#27_sizeof ; float
|
#27_sizeof ; float
|
||||||
#28_strings ; TODO: strncpy strchr strrchr memset memcpy memcmp
|
|
||||||
#34_array_assignment ; fails with GCC
|
#34_array_assignment ; fails with GCC
|
||||||
#37_sprintf ; integer formatting unsupported
|
#37_sprintf ; integer formatting unsupported
|
||||||
#38_multiple_array_index ; unspported: (decl (decl-spec-list (type-spec (fixed-type "int"))) (init-declr-list (init-declr (array-of (array-of (ident "a") (p-expr (fixed "4"))) (p-expr (fixed "4"))))))
|
|
||||||
#39_typedef ;unsupported: (decl (decl-spec-list (stor-spec (typedef)) (type-spec (typename "MyFunStruct"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "MoreFunThanEver")))))
|
|
||||||
|
|
||||||
#40_stdio ; f* functions
|
|
||||||
#42_function_pointer ; f* functions
|
|
||||||
#46_grep ; f* functions
|
|
||||||
#49_bracket_evaluation ; float
|
#49_bracket_evaluation ; float
|
||||||
|
|
||||||
|
|
||||||
|
|
10
doit
10
doit
|
@ -2,13 +2,13 @@
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
export BLOOD_ELF
|
export BLOOD_ELF
|
||||||
|
export BUILD_DEBUG
|
||||||
export GUILE_LOAD_PATH
|
export GUILE_LOAD_PATH
|
||||||
export HEX2
|
export HEX2
|
||||||
export M1
|
export M1
|
||||||
export MES
|
export MES
|
||||||
export MESCC
|
export MESCC
|
||||||
export MES_DEBUG
|
export MES_DEBUG
|
||||||
export MES_DEBUG
|
|
||||||
export MES_PREFIX
|
export MES_PREFIX
|
||||||
export ONE_SOURCE
|
export ONE_SOURCE
|
||||||
export PREFIX
|
export PREFIX
|
||||||
|
@ -20,10 +20,14 @@ HEX2=../mescc-tools/bin/hex2
|
||||||
M1=../mescc-tools/bin/M1
|
M1=../mescc-tools/bin/M1
|
||||||
BLOOD_ELF=../mescc-tools/bin/blood-elf
|
BLOOD_ELF=../mescc-tools/bin/blood-elf
|
||||||
MES=${MES-../mes/src/mes}
|
MES=${MES-../mes/src/mes}
|
||||||
|
MES_ARENA=70000000
|
||||||
|
MES_MAX_ARENA=70000000
|
||||||
|
export MES_ARENA MES_MAX_ARENA
|
||||||
|
|
||||||
MES=guile
|
MES=guile
|
||||||
#MES=${MES-../mes/src/mes.gcc}
|
#MES=${MES-../mes/src/mes.gcc}
|
||||||
#MES=${MES-../mes/src/mes.mlibc-gcc}
|
#MES=${MES-../mes/src/mes.mlibc-gcc}
|
||||||
MESCC=${MESCC-../mes/scripts/mescc}
|
MESCC=${MESCC-../mes/pre-inst-env mescc}
|
||||||
|
|
||||||
#GUILE_LOAD_PATH=/home/janneke/src/nyacc/module:$GUILE_LOAD_PATH
|
#GUILE_LOAD_PATH=/home/janneke/src/nyacc/module:$GUILE_LOAD_PATH
|
||||||
GUILE_LOAD_PATH=nyacc
|
GUILE_LOAD_PATH=nyacc
|
||||||
|
@ -51,3 +55,5 @@ sh build.sh
|
||||||
sh compile.sh
|
sh compile.sh
|
||||||
sh link.sh ||:
|
sh link.sh ||:
|
||||||
sh check.sh
|
sh check.sh
|
||||||
|
rm -rf usr
|
||||||
|
sh install.sh
|
||||||
|
|
29
install.sh
29
install.sh
|
@ -1,19 +1,26 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
set -ex
|
|
||||||
|
if [ -n "$BUILD_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
PREFIX=${PREFIX-usr}
|
PREFIX=${PREFIX-usr}
|
||||||
MES_PREFIX=${MES_PREFIX-${MESCC%/*}}
|
MES_PREFIX=${MES_PREFIX-${MESCC%/*}}
|
||||||
TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
|
TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
|
||||||
|
|
||||||
mkdir -p $PREFIX/bin
|
mkdir -p $PREFIX/bin
|
||||||
cp mes-tcc $PREFIX/bin
|
cp tcc $PREFIX/bin
|
||||||
[ -f boot0-tcc ] && { cp boot0-tcc $PREFIX/bin; ln -sf boot0-tcc $PREFIX/bin/tcc; }
|
|
||||||
[ -f boot1-tcc ] && { cp boot1-tcc $PREFIX/bin; ln -sf boot1-tcc $PREFIX/bin/tcc; }
|
|
||||||
[ -f boot2-tcc ] && { cp boot2-tcc $PREFIX/bin; ln -sf boot2-tcc $PREFIX/bin/tcc; }
|
|
||||||
[ -f boot3-tcc ] && { cp boot3-tcc $PREFIX/bin; ln -sf boot3-tcc $PREFIX/bin/tcc; }
|
|
||||||
mkdir -p $PREFIX/lib
|
|
||||||
cp $TINYCC_SEED/* $PREFIX/lib
|
|
||||||
cp crt1.o $PREFIX/lib
|
|
||||||
mkdir -p $PREFIX/lib/tcc
|
|
||||||
#TODO: cp libtcc1.a?? $PREFIX/lib/tcc
|
|
||||||
tar -C $MES_PREFIX -cf- include | tar -C $PREFIX -xf-
|
tar -C $MES_PREFIX -cf- include | tar -C $PREFIX -xf-
|
||||||
|
|
||||||
|
mkdir -p $PREFIX/lib
|
||||||
|
cp crt1.o $PREFIX/lib/crt1.o
|
||||||
|
cp crti.o $PREFIX/lib/crti.o
|
||||||
|
cp crtn.o $PREFIX/lib/crtn.o
|
||||||
|
|
||||||
|
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-
|
||||||
|
|
10
link.sh
10
link.sh
|
@ -10,20 +10,20 @@ TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
|
||||||
c=${1-$MES_PREFIX/scaffold/main}
|
c=${1-$MES_PREFIX/scaffold/main}
|
||||||
b=scaffold/${c##*/}
|
b=scaffold/${c##*/}
|
||||||
|
|
||||||
rm -f "$b".mlibc-out
|
rm -f "$b".mes-gcc-out
|
||||||
rm -f "$b".mes-out
|
rm -f "$b".mes-out
|
||||||
|
|
||||||
./i686-unknown-linux-gnu-tcc\
|
./i686-unknown-linux-gnu-tcc\
|
||||||
-static -g -o "$b".mlibc-out -I $MES_PREFIX/include -L $TINYCC_SEED "$c".c 2> "$b".mlibc-stderr
|
-static -g -o "$b".mes-gcc-out -I $MES_PREFIX/include -L $TINYCC_SEED "$c".c 2> "$b".mes-gcc-stderr
|
||||||
set +e
|
set +e
|
||||||
${MES_TCC-./mes-tcc}\
|
${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 $TINYCC_SEED "$c".c 2> "$b".mes-stderr
|
||||||
objdump -d "$b".mlibc-out > "$b".mlibc-d
|
objdump -d "$b".mes-gcc-out > "$b".mes-gcc-d
|
||||||
objdump -d "$b".mes-out > "$b".mes-d
|
objdump -d "$b".mes-out > "$b".mes-d
|
||||||
#readelf -a a.i686-unknown-linux-gnu-out > 1.r
|
#readelf -a a.i686-unknown-linux-gnu-out > 1.r
|
||||||
#readelf -a a.mes-out > 2.r
|
#readelf -a a.mes-out > 2.r
|
||||||
#diff -y 1.a 2.a
|
#diff -y 1.a 2.a
|
||||||
echo diff -y "$b".mlibc-stderr "$b".mes-stderr
|
echo diff -y "$b".mes-gcc-stderr "$b".mes-stderr
|
||||||
echo diff -y "$b".mlibc-d "$b".mes-d
|
echo diff -y "$b".mes-gcc-d "$b".mes-d
|
||||||
"$b".mes-out
|
"$b".mes-out
|
||||||
|
|
||||||
|
|
2
tccrun.c
2
tccrun.c
|
@ -770,7 +770,7 @@ static int rt_get_caller_pc(addr_t *paddr, CONTEXT *uc, int level)
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
#ifdef CONFIG_TCC_STATIC
|
#ifdef CONFIG_TCC_STATIC
|
||||||
|
|
||||||
#if !BOOTSTRAP
|
#if 1 //!BOOTSTRAP
|
||||||
/* dummy function for profiling */
|
/* dummy function for profiling */
|
||||||
void *dlopen(const char *filename, int flag)
|
void *dlopen(const char *filename, int flag)
|
||||||
{
|
{
|
||||||
|
|
21
test.sh
21
test.sh
|
@ -10,6 +10,8 @@ TINYCC_SEED=${TINYCC_SEED-../tinycc-seed}
|
||||||
OBJDUMP=${OBJDUMP-objdump}
|
OBJDUMP=${OBJDUMP-objdump}
|
||||||
DIFF=${DIFF-diff}
|
DIFF=${DIFF-diff}
|
||||||
|
|
||||||
|
unset C_INCLUDE_PATH LIBRARY_PATH
|
||||||
|
|
||||||
t=${1-$MES_PREFIX/scaffold/tests/t}
|
t=${1-$MES_PREFIX/scaffold/tests/t}
|
||||||
mkdir -p scaffold
|
mkdir -p scaffold
|
||||||
b=scaffold/${t##*/}
|
b=scaffold/${t##*/}
|
||||||
|
@ -20,7 +22,7 @@ r=0
|
||||||
if [ -x ./i686-unknown-linux-gnu-tcc ]; then
|
if [ -x ./i686-unknown-linux-gnu-tcc ]; then
|
||||||
./i686-unknown-linux-gnu-tcc\
|
./i686-unknown-linux-gnu-tcc\
|
||||||
-c\
|
-c\
|
||||||
-o "$b".mlibc-o\
|
-o "$b".mes-gcc-o\
|
||||||
-nostdlib\
|
-nostdlib\
|
||||||
-g\
|
-g\
|
||||||
-m32\
|
-m32\
|
||||||
|
@ -28,21 +30,22 @@ if [ -x ./i686-unknown-linux-gnu-tcc ]; then
|
||||||
-I $MES_PREFIX/include\
|
-I $MES_PREFIX/include\
|
||||||
-I $MES_PREFIX/scaffold/tests\
|
-I $MES_PREFIX/scaffold/tests\
|
||||||
-I $MES_PREFIX/scaffold/tinycc\
|
-I $MES_PREFIX/scaffold/tinycc\
|
||||||
"$t".c
|
"$t".c &> 1
|
||||||
#$OBJDUMP -d "$t".mlibc-o > 1.s
|
#$OBJDUMP -d "$t".mes-gcc-o > 1.s
|
||||||
./i686-unknown-linux-gnu-tcc\
|
./i686-unknown-linux-gnu-tcc\
|
||||||
-static\
|
-static\
|
||||||
-o "$b".mlibc-out\
|
-o "$b".mes-gcc-out\
|
||||||
|
-L .\
|
||||||
-L $TINYCC_SEED\
|
-L $TINYCC_SEED\
|
||||||
"$b".mlibc-o
|
"$b".mes-gcc-o &> 1.link
|
||||||
set +e
|
set +e
|
||||||
"$b".mlibc-out > "$b".mlibc-stdout
|
"$b".mes-gcc-out arg1 arg2 arg3 arg4 arg5 > "$b".mes-gcc-stdout
|
||||||
m=$?
|
m=$?
|
||||||
set -e
|
set -e
|
||||||
[ -f "$t".exit ] && r=$(cat "$t".exit)
|
[ -f "$t".exit ] && r=$(cat "$t".exit)
|
||||||
[ $m = $r ]
|
[ $m = $r ]
|
||||||
if [ -f "$t".expect ]; then
|
if [ -f "$t".expect ]; then
|
||||||
$DIFF -ub "$t".expect "$b".mlibc-stdout;
|
$DIFF -ub "$t".expect "$b".mes-gcc-stdout;
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -67,9 +70,9 @@ $TCC\
|
||||||
-I $MES_PREFIX/scaffold/tests\
|
-I $MES_PREFIX/scaffold/tests\
|
||||||
-I $MES_PREFIX/scaffold/tinycc\
|
-I $MES_PREFIX/scaffold/tinycc\
|
||||||
-L $TINYCC_SEED\
|
-L $TINYCC_SEED\
|
||||||
"$t".c
|
"$t".c &> 2.link
|
||||||
set +e
|
set +e
|
||||||
"$b".mes-out > "$b".mes-stdout
|
"$b".mes-out arg1 arg2 arg3 arg4 arg5 > "$b".mes-stdout
|
||||||
m=$?
|
m=$?
|
||||||
#$OBJDUMP -d "$t".mes-out > 2.x
|
#$OBJDUMP -d "$t".mes-out > 2.x
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue