scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 2ef97adeb24a81cc0fc756c07b43d34644febf0d
parent 7a8e1cc50999275573d97c4d408aeb80f3edef2c
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Sat, 16 Nov 2019 13:43:47 +0100

Fix paths and use CROSS_COMPILE

Diffstat:
Mtests/libc/execute/Makefile | 4++--
Mtests/libc/execute/cc.sh | 18++++++++++--------
Mtests/libc/execute/chktest.sh | 4++--
3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/tests/libc/execute/Makefile b/tests/libc/execute/Makefile @@ -1,6 +1,6 @@ .POSIX: -ROOT = ../../../root +ROOT = ../../.. CFLAGS = CC = SCCPREFIX=$(ROOT) ./cc.sh @@ -10,7 +10,7 @@ CC = SCCPREFIX=$(ROOT) ./cc.sh all: tests tests: - @CFLAGS='' SCCPREFIX=$(ROOT) chktest.sh libc-tests.lst + @CFLAGS='' SCCPREFIX=$(ROOT) ./chktest.sh libc-tests.lst clean: rm -f *.o *core a.out test.log diff --git a/tests/libc/execute/cc.sh b/tests/libc/execute/cc.sh @@ -29,22 +29,24 @@ do done sys=${sys:-`uname | tr 'A-Z' 'a-z'`} -abi=${abi:-amd64-sysv} +abi=${abi:-i386} out=${out:-a.out} root=${root:-$SCCPREFIX} -inc=$root/include/scc -arch_inc=$root/include/scc/bits/$abi -sys_inc=$root/include/scc/bits/$sys +inc=$root/include +arch_inc=$inc/bits/$abi +sys_inc=$inc/bits/$sys lib=$root/lib/scc/${abi}-${sys} obj=${1%.c}.o +cc=${CROSS_COMPILE}gcc +ld=${CROSS_COMPILE}ld includes="-nostdinc -I$inc -I$arch_inc -I$sys_inc" flags="-std=c99 -g -w -fno-stack-protector --freestanding -static" -if ! gcc -nopie 2>&1 | grep unrecogn >/dev/null +if ! ${cc} -nopie 2>&1 | grep unrecogn >/dev/null then - pie=-nopie + pie=-no-pie fi -gcc $flags $pie $includes -c $1 -ld -g $pie -z nodefaultlib -static -L$lib $lib/crt.o $obj -lc -o $out +${cc} $flags $pie $includes -c $1 +${ld} -g -z nodefaultlib -static -L$lib $obj -lc -lcrt -o $out diff --git a/tests/libc/execute/chktest.sh b/tests/libc/execute/chktest.sh @@ -13,9 +13,9 @@ do rm -f a.out *.o $tmp1 $tmp2 (echo $i - ./cc.sh $CFLAGS $i.c + ./cc.sh $CFLAGS -o $i $i.c echo '/^output:$/+;/^end:$/-'w $tmp1 | ed -s $i.c - ./a.out > $tmp2 + ./$i > $tmp2 diff -u $tmp1 $tmp2) >> test.log 2>&1 && printf '[PASS]' || printf '[FAIL]' printf "$state\t%s\n" $i