shithub: scc

Download patch

ref: 675581f2a90f86ee912f4576ccaadca0f7f08ebf
parent: a94bf959708854d93cb82e4d73eeffa108633036
author: zerous Naveen Narayanan <[email protected]>
date: Sat Nov 16 08:43:47 EST 2019

Fix paths and use CROSS_COMPILE

--- 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 @@
 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
--- a/tests/libc/execute/cc.sh
+++ b/tests/libc/execute/cc.sh
@@ -29,22 +29,24 @@
 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
--- a/tests/libc/execute/chktest.sh
+++ b/tests/libc/execute/chktest.sh
@@ -13,9 +13,9 @@
 	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